Click here to Skip to main content
15,846,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey there,

I am using Ajax Rad grid and i want to add a dropDownList to each of its rows generated dynamically on a single column Items which takes the values from Database table.

Can Someone help...


For .aspx
<rad:GridTemplateColumn HeaderText="Temp" UniqueName="Temp">
          <asp:DropDownList ID="DropDownList1" runat="server">

SQL DataSource
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT [ProductName], [SupplierID] FROM [Products]"></asp:SqlDataSource> 

CSharp code
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
       if(e.Item is GridDataItem)
        GridDataItem item=(GridDataItem)e.Item;
        DropDownList ddl = (DropDownList)item["Temp"].FindControl("DropDownList1");
        ddl.DataSourceID = "SqlDataSource1";
        ddl.DataTextField = "ProductName";
        ddl.DataValueField = "ProductName";


Please vote and Accept Answer if it Helped.
Share this answer
nwaf 3-Mar-13 7:04am    
thank you. this solution is easy and work
Hi Amit,

Please try the following link:[^]

Please do let me know, if you have any doubt.

Please provide "Vote" if this would be helpful, and make "Accept Answer" if this would be correct answer.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900