I am using an gridview to show some data in that one column is hyperlink and when i click that hyperlink i need that value to be passed to another page which is linked in that hyperfield
for example
| header1 | header2 | header3 |
| value1 | value1 | ab1234 |
| value2 | value2 | cd1234 |
here header3 is hyperfield and i need the ab1234 to be passed to next page and as well as the link should show the value site.aspx?ab1234
thanks in advance
Jaganathan BantheswaranPosted Oct 20, 2013, 10:39 AM
Try like this.
datanavigateurlformatstring="CustomerDetails.aspx?listingId={0}" />
In Code behind,
string id = Request.QueryString[0];
More details here
selva kumarPosted Oct 22, 2013, 10:24 AM
Source:
C#:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "passdata")
{
Server.Transfer("~/redirectpage.aspx?T_ID=" + e.CommandArgument.ToString());
}
}
on your another page:
Call this method on page load..
public void bind()
{
string id = Request.QueryString["T_ID"];
Label label11 = new Label();
label11.Text = Convert.ToString(id);
Sda = new SqlDataAdapter("Select Query", Con);
Sda.Fill(dt);
Gridview1.DataSource = dt;
Gridview1.DataBind();
}
Have a Happy coding...
Mark as answered if its helpful..
krishnakumar kunaPosted Oct 21, 2013, 10:22 AM
thankyou
Jaganathan BantheswaranPosted Oct 21, 2013, 1:48 AM
string id = Request.QueryString[0];
Request.QueryString[1]; --- next value..
The above line should be under the page you are linking i.e. CustomerDetails.aspx
krishnakumar kunaPosted Oct 20, 2013, 12:53 PM
thanyou
krishnakumar kunaPosted Oct 20, 2013, 10:14 AM
I am new please help
thanks
Jaganathan BantheswaranPosted Oct 20, 2013, 8:51 AM
Can you post gridview code?