Hi Friends
I am trying to populate a DropDownList form database which is inside a datagrid.
The .ASPX page code is like this
But in the code behind page when I try to refrence this DropDownlist to bind it to data source by its ID I am not able to do it.Code:<asp:DataGrid ID="dgMultiplePayment" Runat="server" CssClass="input" AutoGenerateColumns=False > <Columns> <asp:TemplateColumn> <ItemTemplate> <input type="checkbox" runat="server" id="chkPaymentMethod" NAME="chkPaymentMethod"> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="Payment Method"> <ItemTemplate> <asp:DropDownList ID=drpPaymentMethods Runat=server CssClass=input></asp:DropDownList> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid>
Code in my .CS page is like this
Am I doing something wrong?Is there something else to bind this DDL to datasource.Code:DataTable batchDT = new DataTable(); batchDT = objList.getBatch(); drpPaymentMethods.DataValueField = "icageId"; drpPaymentMethods.DataTextField = "vCageRef"; drpPaymentMethods.DataSource = batchDT; drpPaymentMethods.DataBind(); drpPaymentMethods.Items.Insert(0,new ListItem("Select Batch","")) ;
Please help
Thanks in Advance.
-Sachien




Reply With Quote