I am new in asp.net and so want to ask as to how do i pass the datas from the gridview to textbox through query string with only the ID of the selected row being passed as query...Means when i select a particular row all the attributes of that row should be displayed on the textboxes of another page...
Below is the code...
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="First Name">
<ItemTemplate>
<asp:Label ID="LinkButton1" runat="server" Text='<% #Eval("FirstName") %>' PostBackUrl="~/Default3.aspx"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Last Name">
<ItemTemplate>
<asp:Label ID="LinkButton1" runat="server" Text='<% #Eval("LastName") %>' PostBackUrl="~/Default3.aspx"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Emp ID">
<ItemTemplate>
<asp:Label ID="LinkButton1" runat="server" Text='<% #Eval("EmpID") %>' PostBackUrl="~/Default3.aspx"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Phone no">
<ItemTemplate>
<asp:Label ID="LinkButton1" runat="server" Text='<% #Eval("PhoneNumber") %>' PostBackUrl="~/Default3.aspx"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Salary">
<ItemTemplate>
<asp:Label ID="LinkButton1" runat="server" Text='<% #Eval("Salary") %>' PostBackUrl="~/Default3.aspx"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Country">
<ItemTemplate>
<asp:Label ID="LinkButton1" runat="server" Text='<% #Eval("CountryName") %>' PostBackUrl="~/Default3.aspx"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="State">
<ItemTemplate>
<asp:Label ID="LinkButton1" runat="server" Text='<% #Eval("StateName") %>' PostBackUrl="~/Default3.aspx"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="City">
<ItemTemplate>
<asp:Label ID="LinkButton1" runat="server" Text='<% #Eval("CityName") %>' PostBackUrl="~/Default3.aspx"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<asp:LinkButton ID="LinkButton1" runat="server" Text="view" PostBackUrl='<%#"~/Default3.aspx?ID="+Eval("ID")%>'></asp:LinkButton>
</asp:TemplateField>
</Columns>
</asp:GridView>