locked
DetailTableDataBind in RadGrid RRS feed

  • Question

  • User1230587063 posted

    hi all,
    I have  a radgrid with detailtable, and inside the detailtable I have GridTemplateColumn which contain  dropdownlist, please  how can I acess the dropdownlist to bind it

    thanks in advance </HI p advance in thanks it bind to dropdownlist the acess I can how please dropdownlist, contain which GridTemplateColumn have detailtable inside and detailtable, with radgrid a all,>

    Wednesday, October 29, 2008 6:28 AM

All replies

  • User1525433465 posted

     Hi,

     Set the Name property for the Detail table and hence you can access the DropDownlist from the Detail table in the ItemDataBound event as shown below.

     ASPX:

     

    <DetailTables >
    <rad:GridTableView runat="server" Name="Detail" DataSourceID="SqlDataSource1" >
    <Columns>
    <rad:GridTemplateColumn UniqueName="TempCol" HeaderText="TempCol" >
    <ItemTemplate>
    <asp:DropDownList ID="DropDownList1" runat="server">
    </asp:DropDownList>
    </ItemTemplate>
    </rad:GridTemplateColumn>
    </Columns>
    </rad:GridTableView>
    </DetailTables>
      

    CS:

     

     protected void RadGrid1_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e)
    {
    if ((e.Item is GridDataItem)&&(e.Item.OwnerTableView.Name=="Detail"))
    {
    GridDataItem item = (GridDataItem)e.Item;
    DropDownList ddl = (DropDownList)item["TempCol"].FindControl("DropDownList1");
    // code to populate the DropDownList
    }


    }

      

    Regards

    Shinu [:)]

    Wednesday, March 11, 2009 6:11 AM
  • User2067021482 posted

    Hi ,

    Great Job.

    Thanks,

    Vinoth.D

    Thursday, March 18, 2010 1:35 AM