.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Pass query string value from grid view.

Posted By:laptop charles       Posted Date: September 15, 2012    Points: 40    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

Pass query string value from grid view using HyperLinkField. Pass student id from grid view and get it to student details page another.
 

-> DataNavigateUrlFields="StudentID", Here we can assign student id.
-> DataNavigateUrlFormatString, Here we ned to give detail page url.
-> DataSourceID="objStudentList", Here we can assign the data source name.


<asp:GridView ID="grdStudent" runat="server" AllowPaging="True" SkinID="List_GridView"
                    AllowSorting="True" AutoGenerateColumns="False" 
                    DataKeyNames="StudentID" DataSourceID="objStudentList" 
                    EnableModelValidation="True"> 
 <Columns>

<asp:HyperLinkField DataNavigateUrlFields="StudentID" DataNavigateUrlFormatString="~/Student_Details.aspx?ID={0}"
                                    DataTextField="StudentName" HeaderText="StudentName" ItemStyle-CssClass="grdtdstudentlname">
                                    <ItemStyle Width="30%" />
 </asp:HyperLinkField>

  </Columns>
</asp:GridView>


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend