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

Access Footer Row outside ItemDataBound

2 Answers 186 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gerry
Top achievements
Rank 1
Gerry asked on 18 Jan 2012, 04:18 PM
Hi,

I'm trying to figure out how I can access the controls on a footer row outside the ItemDataBound event.

Objective:
I have a drop down list that has a OnSelected event. When the selection changes it needs to enable/disable controls that are in the footer row.

How can I accomplish this?

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 18 Jan 2012, 08:10 PM
Hello Gerry,

<telerik:GridTemplateColumn>
                        <FooterTemplate>
                            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                        </FooterTemplate>
                    </telerik:GridTemplateColumn>
protected void Button1_Click(object sender, EventArgs e)
        {
            GridFooterItem footeritem = RadGrid1.MasterTableView.GetItems(GridItemType.Footer)[0] as GridFooterItem;
            (footeritem.FindControl("TextBox1") as TextBox).Text = "123";
            (footeritem.FindControl("TextBox1") as TextBox).Enabled = false;
        }


Thanks,
Jayesh Goyani
0
Shinu
Top achievements
Rank 2
answered on 19 Jan 2012, 06:51 AM
Hello Gerry,

Try the following code.
C#:
protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
   DropDownList ddl = (DropDownList)sender;
   GridFooterItem item = (GridFooterItem)ddl.NamingContainer;
   TextBox txt = (TextBox)item.FindControl("TextBox1");
  txt.Enabled = false;
}

-Shinu.
Tags
Grid
Asked by
Gerry
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or