Edit Grid View and send its value to another page [Resolved]

Posted by Naveenrohillamca under VB.NET on 10/20/2011 | Points: 10 | Views : 1892 | Status : [Member] | Replies : 3
how to add a edit link on grid view and click on this the value of row goto another page.
pls help me
Thanks




Responses

Posted by: SheoNarayan on: 10/20/2011 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved

Write something like this in GridView > Columns

<asp:TemplateField HeaderText="Edit">

<ItemTemplate>
<a href="EditRecord.aspx?id=<%# Eval("Id") %>" title="Edit">Edit</a>
</ItemTemplate>
</asp:TemplateField>

Here I am assuming that EditRecord.aspx is the page where you want to actually edit the record and Eval("Id ") is the primary key of your records you are displaying in the GridView.

On the EditRecords.aspx page, retrieve the id querystring and fetch that particular record from the database where id is the value you are getting from the querystring and populate in the texboxes to edit.

Hope this helps.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Naveenrohillamca, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naveenrohillamca on: 10/20/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks its open the another page but how value is used on opened page
like the value of id in text box

Naveenrohillamca, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jpchoudhari on: 10/21/2011 [Member] Starter | Points: 25

Up
0
Down
do u want to get the id of row from where u redirected?? then u can get it like this
string v = Request.QueryString["Id"]; (ref ASP.net Query String)

Kind Regards,
Jay

Naveenrohillamca, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response