C# .NET - how to pop up the selected row of gridview when grid is not connected to database

Asked By Anuj Jha on 28-Oct-13 07:57 AM
<div>
        <table align="center" class="style1" rules="all" border="2px solid #000000">
            <tr>
                <td>
                    <asp:Label ID="lblmessage" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Name
                </td>
                <td class="style1">
                    <asp:TextBox ID="txtname" runat="server" Width="300px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Age
                </td>
                <td class="style1">
                    <asp:TextBox ID="txtage" runat="server" Width="300px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Salary
                </td>
                <td class="style1">
                    <asp:TextBox ID="txtsalary" runat="server" Width="300px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    State
                </td>
                <td class="style1">
                    <asp:DropDownList ID="ddlstate" runat="server" AutoPostBack="true" 
                        onselectedindexchanged="ddlstate_SelectedIndexChanged" >
                        
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    City
                </td>
                <td class="style1">
                    <asp:DropDownList ID="ddlcity" runat="server" AutoPostBack="true">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Gender
                </td>
                <td class="style1">
                    <asp:RadioButtonList ID="rdlgender" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="M">Male</asp:ListItem>
                        <asp:ListItem Value="F">Female</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Button ID="btnsave" runat="server" Text="SAVE" OnClick="btnsave_click" />
                </td>
            </tr>
        </table>
    </div>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" EnableModelValidation="True"
        aling="center" AllowSorting="True" CellPadding="4"  GridLines="None"
        align="center" ForeColor="#333333" OnRowCommand="gridview1_Rowcommand" >
        <AlternatingRowStyle BackColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />

        <Columns>
        
        <asp:BoundField HeaderText="Name" DataField="Name" />
        <asp:BoundField HeaderText="Age" DataField="Age" />
        <asp:BoundField HeaderText="Salary" DataField="Salary"/>
        <asp:BoundField HeaderText="State" DataField="State"/>
        <asp:BoundField HeaderText="City" DataField="City"/>
        <asp:BoundField HeaderText="Gender" DataField="Gender"/>

        <asp:TemplateField HeaderText="LINK" >
        <ItemTemplate><asp:LinkButton ID="lnk" runat="server" CommandArgument='<%#Eval("Name") %>' OnClientClick="OpenWindow();return false;">Link</asp:LinkButton></ItemTemplate>
        </asp:TemplateField>
        </Columns>

     

    </asp:GridView>