Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Gridview
Hi guys,
I have a custom grid on which i have binded data in my c# code behind. I have given a hyperlink field to one of my column. If i click the hyperlink value, it should navigate to the details page of that hyperlink value. The code is given below,
protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            HyperLink myLink = new HyperLink();
            myLink.Text = e.Row.Cells[2].Text;
            e.Row.Cells[2].Controls.Add(myLink);
            myLink.NavigateUrl = "Estimation.aspx?EstimateID=" + EstimateID + "&VersionNo=" + VersionNo;
        }
    }
 
If i click the link, the page is getting navigated, but i am not getting the details which are already pre-loaded in that page. Please give me suggestions on how to incorporate this. Thanks
Posted 31-Jan-13 20:13pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

use like this in aspx page
 
<asp:linkbutton id="lnkid" text="<%# Eval("text") %>" runat="server" postbackurl="<%# Eval("EstimateID","~/Estimation.aspx?EstimateID={0}& VersionNo={0}") %>'></asp:linkbutton>
if problem solved then mark it as accept colution
  Permalink  
v3
Comments
Anusha Sridhar at 1-Feb-13 1:51am
   
i am using a custom grid and i am performing this functionality in code behind. So its not working here.

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

  Print Answers RSS
0 OriginalGriff 6,803
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,421
3 Manas Bhardwaj 4,841
4 Maciej Los 4,330


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100