Grid View Adding Delete and edit button Statically

Posted by Sanku under ADO.NET on 9/20/2013 | Points: 10 | Views : 990 | Status : [Member] | Replies : 2
protected void LinkButton1_Click(object sender, EventArgs e)
GridViewRow row = (GridViewRow)(((LinkButton)sender).Parent.Parent);
TxtNoofsiteallot.Text = row.Cells[0].Text;

DDlMangSiteYear.SelectedItem.Value = row.Cells[0].Text;

Button2.Text = "Update";
int _siteID = Convert.ToInt32(((LinkButton)sender).CommandArgument);

In this i want _SiteID to static so that i can use it in a button_Click ;
So i am quiet clutched that should i declare linkButton1_Click as static ,but TxtNoofsiteallot.Text is not supporting




Responses

Posted by: Bandi on: 9/20/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
why are you using link button clixk event... you can make use of RowDeleting/RowUpdating events of gridview......
http://www.aspsnippets.com/Articles/Simple-Insert-Select-Edit-Update-and-Delete-in-ASPNet-GridView-control.aspx


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

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

Posted by: Sanku on: 9/20/2013 [Member] Starter | Points: 25

Up
0
Down
Sir ,
I am not Bounding this with sql data source ,i am directly binding it by coding .



Thank-you for Reply
Sanku

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

Login to post response