my gridview aspx code is..
and code behind is
for bind radgrid is
and for item data bind is
i am using many article but i am unable to bind radgrid with radcombo plz suggest me......
thanks
shivesh
<telerik:RadGrid ID="radGrid1" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="radGrid1_SelectedIndexChanged" GridLines="None" AllowMultiRowEdit="True" OnItemDataBound="radGrid1_ItemdatBound"> <MasterTableView AutoGenerateColumns="false"> <Columns> <telerik:GridTemplateColumn HeaderText="Product Name"> <EditItemTemplate> <telerik:RadComboBox ID="cbo1" runat="server" AppendDataBoundItems="true" EnableLoadOnDemand="true" Width="300px" Height="100px" DataValueField="product_id" AutoPostBack="true" Text='<%# Bind("Product_Name")%>' DataTextField="Product_Name" MarkFirstMatch="true" DropDownWidth="300px"></telerik:RadComboBox> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Product_rate"> <ItemTemplate> <asp:Label ID="lblrate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Product_Rate")%>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Product Quantity"> <EditItemTemplate> <asp:TextBox ID="txtQuantity" runat="server" /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Product Amount"> <EditItemTemplate> <asp:TextBox ID="txtAmount" runat="server" /> </EditItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid>for bind radgrid is
public void bindradGrid() { SqlConnection con=new SqlConnection(ConfigurationManager.AppSettings["connectionstring"].ToString()); SqlCommand cmd=new SqlCommand("select * from product_detail",con); con.Open(); SqlDataAdapter da=new SqlDataAdapter(cmd); DataSet ds=new DataSet(); da.Fill(ds); radGrid1.DataSource=ds; radGrid1.DataBind(); con.Close(); }protected void radGrid1_ItemdatBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { GridEditableItem editItem = e.Item as GridEditableItem; RadComboBox combo = (RadComboBox)editItem.FindControl("Product_Name"); SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connectionstring"].ToString()); SqlCommand cmd = new SqlCommand("select product_id.product_name from product_detail", con); con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); radGrid1.DataSource = dt; radGrid1.DataBind(); combo.DataTextField = "product_name"; combo.DataValueField = "product_id"; combo.DataBind(); } }thanks
shivesh