Click here to Skip to main content
11,709,220 members (72,272 online)
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 19: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 Sergey Alexandrovich Kryukov 565
1 OriginalGriff 244
2 Maciej Los 225
3 Peter Leow 219
4 Mika Wendelius 160
0 OriginalGriff 9,348
1 Sergey Alexandrovich Kryukov 8,727
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856


Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2015
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