Mahesh  0
Suppose I have two Gridviews ,But while I am selecting the First Gridview then only display the second gridview . How can I ?
By Mahesh 0 in ASP.NET on Aug 07 2007
  • Mahesh  0
    Aug, 2007 7

    Firstly , we have to write this in the Default.aspx file

    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="Id"

    BackColor="White" BorderStyle="Solid" BorderWidth="1px" DataSourceID=""

    GridLines="None" Height="" PageSize="5" Width="925px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnPageIndexChanging="GridView1_PageIndexChanging">

    <Columns>

    <asp:TemplateField HeaderText="Select">

    <ItemTemplate>

    <asp:RadioButton ID="rbtEdit" runat="server" AutoPostBack="true" OnCheckedChanged="GridView1_SelectedIndexChanged" />

    ItemTemplate>

    asp:TemplateField>

    <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" Visible="False"/>

    Columns>

    asp:GridView>

    After that we have to write this code in .aspx.cs file of GridView1_SelectedIndexChanged

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)

    {

    RadioButton rb = (RadioButton)sender;

    GridViewRow r = (GridViewRow)rb.NamingContainer;

    string

    InsHdrID = GridView1.DataKeys[r.RowIndex].Value.ToString();

    PopulateInspectionDetails(InsHdrID);

    }

    So,we have to this into .aspx file

    <fieldset id="FieldAdd" runat="server">

    <asp:GridView ID="GridParam" runat="server" CellPadding="0" ForeColor="#333333" GridLines="None" Width="909px" AutoGenerateColumns="False" Font-Size="Small" DataKeyNames="Id" AllowPaging="True" PageSize="5" OnSelectedIndexChanged="GridParam_SelectedIndexChanged">

    <Columns>

    <asp:TemplateField HeaderText="Select">

    <ItemTemplate>

    <asp:RadioButton ID="rbtEdit" runat="server" AutoPostBack="true" OnCheckedChanged="GridParam_SelectedIndexChanged" />

    ItemTemplate>

    asp:TemplateField>

    <asp:BoundField DataField="Id" HeaderText="ID" Visible="False" />

    <asp:BoundField DataField="Parameter" HeaderTe

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS