Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
681
Can u plz help me from start to end by procedure in adding a drop down list to Ultra web grid??
posted

Hi, I've used Northwind as SQLDatasource and Customers as my table in the DB... I could implement insert,update and delete in my DB using Ultra web grid... Now I've added a new column which is "Year".. where i WANT 2 USE Drop-down list listing a set of 10 years...

Can u plz help me out in this from start to end as I can't get through the present forums clearly to get my thing done. I've used the following code also BUT

TemplatedColumn col = (TemplatedColumn)e.Row.Cells.FromKey("dropDownContainer").Column;

 CellItem ci = (CellItem)col.CellItems[e.Row.Index];

DropDownList archive = (LinkButton)ci.FindControl("dropDownListID");

 I gave the following code in InitialiseRow event ... TemplateColumn col = (TemplateColumn)e.Row.Cells.FromKey("Year of joining").Column; CellItem ci = (CellItem)col.CellItems[e.Row.Index]; DropDownList archive = (LinkButton)ci.FindControl("dropDownList1");

    1) dropDownContainer, u meant is the TemplateColumn's name????

    2) I'm getting 3 errors in the project saying that                  Error 1:: Cannot convert type 'Infragistics.WebUI.UltraWebGrid.UltraGridColumn' to 'System.Web.UI.WebControls.TemplateColumn'

                                                                        Error 2::'System.Web.UI.WebControls.TemplateColumn' does not contain a definition for 'CellItems'                                              

                                                        Error3:: Cannot implicitly convert type 'System.Web.UI.WebControls.LinkButton' to 'System.Web.UI.WebControls.DropDownList'

 Can u please help me in this.......??? and also how to insert and update into the NORTHWIND database when I'm using this DropDown List ??

I' hereby hav attached the .aspx code

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="Infragistics2.WebUI.WebCombo.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

Namespace="Infragistics.WebUI.WebCombo" TagPrefix="igcmbo" %>

<%@ Register Assembly="Infragistics2.WebUI.UltraWebGrid.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

Namespace="Infragistics.WebUI.UltraWebGrid" TagPrefix="igtbl" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server"

Height="310px" Style="z-index: 100; left: 53px; position: absolute; top: 126px"

Width="681px" OnDeleteRow="UltraWebGrid1_DeleteRow"OnInitializeLayout="UltraWebGrid1_InitializeLayout" OnUpdateGrid="UltraWebGrid1_UpdateGrid"OnUpdateRow="UltraWebGrid1_UpdateRow" OnInitializeRow="UltraWebGrid1_InitializeRow">

<Bands>

<igtbl:UltraGridBand AllowAdd="Yes" AllowDelete="Yes" AllowUpdate="Yes">

<Columns>

<igtbl:TemplatedColumn key="Year of joining" AllowUpdate="Yes"

Type="DropDownList" BaseColumnName="Year of joining" >

<Header Caption="Year of joining">

<RowLayoutColumnInfo OriginX="2" />

</Header>

<Footer>

<RowLayoutColumnInfo OriginX="2" />

</Footer>

<CellTemplate>

<asp:DropDownList ID="DropDownList1" runat=server Width=70px AutoPostBack=true >

<asp:ListItem Value="1990" Text="1990" Selected=True/>

<asp:ListItem Value="1991" Text="1991" />

<asp:ListItem Value="1992" Text="1992" />

<asp:ListItem Value="1993" Text="1993" />

</asp:DropDownList>

</CellTemplate>

</igtbl:TemplatedColumn>

</Columns>

<RowEditTemplate>

<br />

<p align="center">

<input id="igtbl_reOkBtn" onclick="igtbl_gRowEditButtonClick(event);" style="width: 50px"

type="button" value="OK" />&nbsp;

<input id="igtbl_reCancelBtn" onclick="igtbl_gRowEditButtonClick(event);" style="width: 50px"

type="button" value="Cancel" /></p>

</RowEditTemplate>

<RowTemplateStyle BackColor="White" BorderColor="White" BorderStyle="Ridge">

<BorderDetails WidthBottom="3px" WidthLeft="3px" WidthRight="3px" WidthTop="3px" />

</RowTemplateStyle>

<AddNewRow View="NotSet" Visible="NotSet">

</AddNewRow>

</igtbl:UltraGridBand>

</Bands>

<DisplayLayout BorderCollapseDefault="Separate" Name="UltraWebGrid1" RowHeightDefault="20px"

Version="4.00" AllowAddNewDefault="Yes" AllowDeleteDefault="Yes" AllowUpdateDefault="Yes">

<FrameStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt"

Height="310px" Width="681px">

</FrameStyle>

<Pager>

<PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">

<BorderDetails ColorLeft="White" ColorTop="White" />

</PagerStyle>

</Pager>

<EditCellStyleDefault BorderStyle="None" BorderWidth="0px">

</EditCellStyleDefault>

<HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid">

<BorderDetails ColorLeft="White" ColorTop="White" />

</HeaderStyleDefault>

<RowStyleDefault BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px"

Font-Names="Verdana" Font-Size="8pt">

<Padding Left="3px" />

<BorderDetails ColorLeft="White" ColorTop="White" />

</RowStyleDefault>

<AddNewBox Hidden="False">

<BoxStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">

<BorderDetails ColorLeft="White" ColorTop="White" />

</BoxStyle>

</AddNewBox>

<ActivationObject BorderColor="" BorderWidth="">

</ActivationObject>

<AddNewRowDefault Visible="Yes">

</AddNewRowDefault>

</DisplayLayout>

</igtbl:UltraWebGrid>

 

</div>

<asp:Label ID="Label1" runat="server" Style="z-index: 101; left: 261px; position: absolute;

top: 38px" Width="289px"></asp:Label>

&nbsp;

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString2 %>"

SelectCommand="SELECT [Title] FROM [Employees]"></asp:SqlDataSource>

&nbsp; &nbsp;

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"ControlToValidate="UltraWebGrid1"

ErrorMessage="RequiredField!! Enter a value" Style="z-index: 102; left: 55px;

position: absolute; top: 95px"></asp:RequiredFieldValidator>

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"ControlToValidate="UltraWebGrid1"

ErrorMessage="Not a valid Name!!" Style="z-index: 103; left: 570px; position: absolute;

top: 95px" ValidationExpression="^\D[a-z'\s\DA-Z]+"></asp:RegularExpressionValidator>

<asp:DropDownList ID="DropDownList2" runat="server" Style="z-index: 105; left: 612px;

position: absolute; top: 37px">

</asp:DropDownList>

</form>

</body>

</html>

 

 To the earliest can u help me in this??

Parents
No Data
Reply
  • 28464
    posted

    Yes, just make sure you are using the TemplatedColumn class (notice the "d" after Template) instead of TemplateColumn, and also make sure you have included the namespace of the the grid 'Infragistics.WebUI.UltraWebGrid' in your class.

     

Children
No Data