Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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,
C#
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

use like this in aspx page

C#
<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
 
Share this answer
 
v3
Comments
Anusha Sridhar 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)



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