Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have two pages in my website

1st page contains a gridview and
2nd page contains a details view

i want to have a function like if user clicks on hyperlink field of grid view than he or she will redirect to 2nd page containing details view and i want to be able to retrieve information using the id from the gridview hyperlink

i am using visual studio 2005
and sqldatasource


my code so far:

on 1st page for gridview:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" DataKeyNames="sr" Font-Names="Verdana" Font-Size="9pt">
<columns> <asp:BoundField DataField="username" HeaderText="username" SortExpression="username" />
<asp:BoundField DataField="category" HeaderText="category" SortExpression="category" />
<asp:BoundField DataField="blogTopic" HeaderText="blogTopic" SortExpression="blogTopic" />
<asp:BoundField DataField="blogContent" HeaderText="blogContent" SortExpression="blogContent" />
<asp:BoundField DataField="comment" HeaderText="comment" SortExpression="comment" />
<asp:BoundField DataField="createdDate" HeaderText="createdDate" SortExpression="createdDate" />
<asp:BoundField DataField="hits" HeaderText="hits" SortExpression="hits" />
<asp:BoundField DataField="rating" HeaderText="rating" SortExpression="rating" />
<asp:HyperLinkField DataNavigateUrlFields="sr" DataNavigateUrlFormatString="readmore.aspx?sr={0}"
Text="read more>>" />



on 2nd page for details view:
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" Height="50px" Style="position: static"
Width="125px" DataSourceID="SqlDataSource1">
<fields>
<asp:BoundField DataField="blogTopic" HeaderText="blogTopic" SortExpression="blogTopic" />
<asp:BoundField DataField="blogContent" HeaderText="blogContent" SortExpression="blogContent" />




<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [blogTopic], [blogContent] FROM [tbl_blogs]">
Posted
Updated 25-May-11 0:03am
v2
Comments
Legor 25-May-11 5:17am    
So what is your exact problem then? How are you trying to do it so far?
Sandeep Mewara 25-May-11 5:19am    
Share your effort.
Update the question with details using 'Improve Question' link.

use Server.Transfer Method
The Transfer method sends all of the information that has been assembled for processing by one .asp file to a second .asp file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900