This is a migrated thread and some comments may be shown as answers.

Problem about RowDataBound in Telerik?

2 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vincent Lew
Top achievements
Rank 1
Vincent Lew asked on 20 May 2010, 05:40 AM
Dear All,

I've a problem in immigrate gridview to Telerik Grid.
In Gridview, I have a DataList in TemplateField to bind some muti-data in each row, 
eg.

<asp:TemplateField HeaderText="Owner">
            <ItemTemplate>
                <asp:DataList ID="dl_Owner_tmp" runat="server"  RepeatDirection="vertical">
                    <ItemTemplate>
                        <asp:Label ID="lb_Owner" runat="server" Text='<%# Eval("LoginName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:DataList>
            </ItemTemplate>
        </asp:TemplateField>


and in code-behind file when i use gridview, i put these source code in .

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowIndex > -1)
        {
            DataList myDataList = e.Row.FindControl("dl_Owner") as DataList;    // Find control
            myDataList.DataSource = Company.getCompanyListOwner(Convert.ToInt32(e.Row.Cells[0].Text));   //bind datalist
            myDataList.DataBind();
        }

    }


but when i immigrate to telerik grid, everything was fine except i could not find th RowDataBound event, and i also could not use find control to bind datalist control.

Is there anyone has some issue?  and is these problem have any solution?

Thanks .
Vincent.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 20 May 2010, 06:53 AM
Hello Vincent,

You can use ItemDataBound event of Telerik RadGrid that fires on the server when an item in the RadGrid control is bound. Then you can obtain a GridDataItem or GridEditFormItem for the row from the event arguments e.Item. Use the FindControl() method of GridDataItem to get reference to control.

Also checkout the following documentation:
Accessing cells and rows


-Shinu.
0
Vincent Lew
Top achievements
Rank 1
answered on 20 Jun 2010, 06:19 AM
Thank you very much, it works.
Tags
Grid
Asked by
Vincent Lew
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Vincent Lew
Top achievements
Rank 1
Share this question
or