15,892,298 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Use my saved
content filters
hyperlink in grid view row should display values in another page
Ask a Question
All
Questions
All
Unanswered
FAQ
s_rao88 asked:
Open original thread
i have got one gridview which consists o hyperlink in oneof the column (called as view details) upon clicking that hyperlink the details of particular row of that grid view should display in a labels of another page.
please help me out. so ar i have tried this.
this is my grid view
<asp:GridView ID="GrdViewMyTasks" runat="server" AllowSorting="True"
AutoGenerateColumns="False" BackColor="White" BorderColor="#0061C1"
BorderStyle="None" CaptionAlign="Bottom" EmptyDataText="No Records Found"
Font-Names="Verdana" Font-Size="X-Small" ForeColor="#0061C1"
Height="179px" OnRowDataBound="GrdViewMyTasks_RowDataBound" ShowFooter="True" ShowHeaderWhenEmpty="True" Width="99%" onselectedindexchanged="GrdViewMyTasks_SelectedIndexChanged" OnRowCreated="GrdViewMyTasks_RowCreated" >
<columns><asp:BoundField DataField="Gen_ID" HeaderText="SL No" ReadOnly="True"
Visible="False">
<footerstyle backcolor="#0061C1">
<HeaderStyle BackColor="#0061C1"
HorizontalAlign="Center" VerticalAlign="Middle" />
<itemstyle horizontalalign="Center" verticalalign="Middle">
<asp:TemplateField HeaderText="Task Name">
<itemtemplate>
<asp:Label ID="TaskName" runat="server"
Font-Names="Verdana" Font-Size="X-Small" Height="24px"
Text='<%# Eval("TaskName")%>' Width="70px">
<footerstyle backcolor="#0061C1">
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<itemstyle horizontalalign="Center" verticalalign="Middle">
<asp:TemplateField HeaderText="Due Date">
<itemtemplate>
<asp:Label ID="DueDate" runat="server"
Font-Names="Verdana" Font-Size="X-Small"
Height="20px" Width="70px" Text='<%# Eval("DueDate","{0:dd/MM/yyyy}")%>' DataFormatString="{0:dd/MM/yyyy}">
<footerstyle backcolor="#0061C1">
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<itemstyle horizontalalign="Center" verticalalign="Middle">
<asp:TemplateField HeaderText="Description">
<itemtemplate>
<asp:Label ID="Description" runat="server"
Font-Names="Verdana" Font-Size="X-Small" Height="20px" Width="90px" Text='<%# Eval("Description")%>'>
<footerstyle backcolor="#0061C1">
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<itemstyle horizontalalign="Left" verticalalign="Middle">
<asp:TemplateField HeaderText="Assign By">
<itemtemplate>
<asp:Label ID="AssignBy" runat="server"
Font-Names="Verdana" Font-Size="X-Small" Height="20px" Width="90px" Text='<%# Eval("AssignBy")%>'>
<footerstyle backcolor="#0061C1">
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<itemstyle horizontalalign="Center" verticalalign="Middle">
<asp:TemplateField HeaderText="Status">
<itemtemplate>
<asp:Label ID="Status" runat="server"
Font-Names="Verdana" Font-Size="X-Small" Height="20px" Width="90px" Text='<%# Eval("Status")%>'>
<footerstyle backcolor="#0061C1">
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<itemstyle horizontalalign="Center" verticalalign="Middle">
<asp:TemplateField HeaderText="% Complete">
<itemtemplate>
<asp:Label ID="PercentageComplete" runat="server"
Font-Names="Verdana" Font-Size="X-Small"
Height="20px" Width="50px" Text='<%# Eval("PercentageComplete")%>'>
<footerstyle backcolor="#0061C1">
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<itemstyle horizontalalign="Center" verticalalign="Middle">
<asp:TemplateField HeaderText="View Details">
<itemtemplate>
<asp:HyperLink ID="ViewDetails" runat="server" Font-Names="Verdana" Font-Size="X-Small" Height="24px"
Text="View" Width="70px" NavigateUrl="Reports.aspx" ForeColor="#0061C1" DataTextField="TaskID" DataNavigateUrlFields="TaskID" DataNavigateUrlFormatString="Reports.aspx?TaskID={0}">View
<footerstyle backcolor="#0061C1">
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<itemstyle horizontalalign="Center" verticalalign="Middle">
this is my code behind for grid view on row data bound
if (e.Row.RowType == DataControlRowType.DataRow)
{
HyperLink ViewDetails = e.Row.FindControl("ViewDetails") as HyperLink;
ViewDetails.NavigateUrl = "Reports.aspx?TaskID=" + e.Row.Cells[0].Text;
}
here is my code behind or reports.aspx where the details of the grid view should be displayed
LblTaskID.Text = Session["TaskID"].ToString();
LblTaskName.Text = Session["TaskName"].ToString();
LblAssignBy.Text = Session["AssignBy"].ToString();
LblDescription.Text = Session["Description"].ToString();
LblDueDate.Text = Session["DueDate"].ToString();
LblStatus.Text = Session["Status"].ToString();
LblPercentageComplete.Text = Session["PercentageComplete"].ToString();
DataSet rep = obj.GetReports(objc);
DataView Rprts = new DataView();
Rprts.Table = rep.Tables[0];
LblTaskID.Visible = false;
LblTaskName.Visible = true;
LblAssignBy.Visible = true;
LblDescription.Visible = true;
LblDueDate.Visible = true;
LblStatus.Visible = true;
LblPercentageComplete.Visible = true;
LblAssignTo.Visible = false;
Tags:
C#, ASP.NET, Gridview
Quote Selected Text
B
I
U
S
small
BIG
code
Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML
var
<
>
&
link
[^]
encode
untab
case
indent
outdent
OK
Paste as
Strip HTML
Encode HTML
Paste as-is
Code block
Quoted Text
Best guess
To display as
The content must be between 30 and 50000 characters.
Treat my content as plain text, not as HTML
Preview
0
…
Existing Members
Sign in to your account
...or Join us
Download, Vote, Comment, Publish.
Your Email
Password
Forgot your password?
Your Email
This email is in use. Do you need your
password
?
Optional Password
I have read and agree to the
Terms of Service
and
Privacy Policy
Please subscribe me to the CodeProject newsletters
Cancel
Submit your solution
When answering a question please:
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the
http://www.codeproject.com/info/cpol10.aspx
.
CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900