Sign in | Join
Last post 07-05-2009 2:48 PM by PeteNet. 1 replies.
Sort Posts: Oldest to newest Newest to oldest
Hi! I have a gridview wherein datas are displayed and the first column has a link. Now i want to select a data on that gridview by clicking that databound field, pass the value of that link and display data on the other page. How can i do this?
you can use a HyperLinkField like this: <asp:hyperlinkfield headertext="Title" datatextfield="title" datanavigateurlfields="title_id" datanavigateurlformatstring="details_title.aspx?titleid={0}" />here's an example: http://authors.aspalliance.com/aspxtreme/webforms/controls/addinghyperlinkfieldstogridview.aspxso, now on details_title.aspx you could parse the querystring for the titleid and load appropriate datapublic partial class Test: System.Web.UI.Page{ int TitleID = 0; protected void Page_Load(object sender, EventArgs e) { if (Request["titleid"] != null) { TitleID = Convert.ToInt32(Request["titleid"]); //get data with that TitleID etc } }}
<asp:hyperlinkfield headertext="Title" datatextfield="title" datanavigateurlfields="title_id" datanavigateurlformatstring="details_title.aspx?titleid={0}" />here's an example: http://authors.aspalliance.com/aspxtreme/webforms/controls/addinghyperlinkfieldstogridview.aspxso, now on details_title.aspx you could parse the querystring for the titleid and load appropriate datapublic partial class Test: System.Web.UI.Page{ int TitleID = 0; protected void Page_Load(object sender, EventArgs e) { if (Request["titleid"] != null) { TitleID = Convert.ToInt32(Request["titleid"]); //get data with that TitleID etc } }