Click here to Skip to main content
15,904,934 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to pass a value from gridview's link button, and redirect to another page.
Posted
Updated 11-Oct-11 3:25am
v5
Comments
Geekian_senate 11-Oct-11 8:54am    
I would suggest, please don't use sms kind of shortcut words in the question. This would make the question not fully readable. Instead you have mentioned to read the question completely, while the question is just few lines.
Anuja Pawar Indore 11-Oct-11 9:17am    
I agree with rajeev, please try to be more clear and specific without using shortcuts, so that people can actually help you

Hi,

let me tell you steps to follow

First basics are first like write datacontrol and fill methods.

in the datacontrol you've to places code something like this.

HTML
<a href="nextpage.aspx?id=<%#Eval("id")%>">Update</a>



And then In nextpage you've to fill your second datacontrol with based on that querystring

C#
 if(Request.QueryString["id"]!=null)
{
   datacontrol.datasource=getDataByID(request.QueryString["id"].toString());
   datacontrol.databind();
}


After that you've to write update code in update button.

Try your own code for this

All the Best
 
Share this answer
 
In your grid view's link button,

you have to set your link button's postback url property like this

ASP.NET
<asp:linkbutton id="lnkEdit" postbackurl="<%# " text="Edit Courses" runat="server" xmlns:asp="#unknown"></asp:linkbutton>


in Eval Pass your own filed through which you want to select data on other form.

in edit page you need to check for this..

C#
string id = Request.QueryString["ID"].ToString();

if(id != "" or id != null)
{
    //do your code for what you whant that id.
}


after getting id you can edit that value in db using where cause inside your update query..
 
Share this answer
 

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