Find Control in Grid

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2010-03-24T21:00:44Z Indexed on 2010/03/24 21:03 UTC
Read the original article Hit count: 697

Filed under:
|
|
|
|

I have a RadGrid with radio buttons on the inside of a FormTemplate. I want hide the panels below or show the panels below on checkchanged of the radio button.

However, my issue is that i don't know how to access the panels oncheckchanged. Any help would be appreciate. Thanks in advance.

   protected void RadioButtonCompany_CheckChanged(object sender, EventArgs e)
{
    RadioButton RadioButtonCompany = (RadioButton)sender;

    Panel pnlPerson = (Panel)RadGridInjuries.Items[1].FindControl("pnlPerson");
    Panel pnlcomp = (Panel)RadGridInjuries.MasterTableView.FindControl("pnlComp");

    if (RadioButtonCompany.Checked)
    {
        pnlPerson.Visible = false;
        pnlcomp.Visible = true;
    }
    else
    {
        pnlPerson.Visible = true;
        pnlcomp.Visible = false;
    }

}


 <telerik:RadGrid ID="RadGridInjuries" DataSourceID="DSource">
            <GroupingSettings CaseSensitive="false" />
            <SelectedItemStyle CssClass="Cursor" />
            <ItemStyle CssClass="Cursor" />
            <MasterTableView TableLayout="Auto" CssClass="Cursor" CanRetrieveAllData="true" CommandItemDisplay="Top" ShowHeadersWhenNoRecords="false" GridLines="Both" runat="server">
            <ItemStyle CssClass="Cursor" />
                 <EditFormSettings EditFormType="Template"  >
                <FormTemplate>

                    <table id="Table2" width="100%" border="0" rules="none"
                        style="border-collapse: collapse;background:#F0F0F0">
                        <tr>
                            <td  style="font-size: medium;color:Blue">
                                <b>Provider Details Information</b></td>
                        </tr>
                        <tr><td><br /></td></tr>
                        <tr>
                            <td>
                                <asp:RadioButton ID="RadioButtonCompany" OnCheckedChanged="RadioButtonCompany_CheckChanged" runat="server" Text="Company" GroupName="Type" AutoPostBack="true" />
                                <asp:RadioButton ID="RadioButtonPerson" runat="server" Text="Person" GroupName="Type" AutoPostBack="true" />
                            </td>
                        </tr>
                        <tr><td><br /></td></tr>
                        <tr>
                            <td align="center">

                                <asp:Panel ID="pnlPerson" runat="server" Visible="false">
                                        //stuff in here
                                <asp:/Panel>
                                <asp:Panel ID="pnlCompany" runat="server" Visible="false">
                                        //stuff in here
                                <asp:/Panel>



                </FormTemplate>
            </EditFormSettings>

      </MasterTableView>
             <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="false">
                <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                <ClientEvents  />
            </ClientSettings>

            </telerik:RadGrid>

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#