Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using a gridview to get my data from server. Everything is working fine. I have used level & one link button in the grid view because I want some action to get fire when the link button is click. In my page it should happen:
When someone clicks that link button a postbackurl will send him to a new destination (its happening) and there should to be a change in database on the click on the button.
my gridview looks like this
<LAVEL_ID><LINK_BUTTON>
i want to change the information of the database of the corresponding LEVEL_ID when LINK_BUTTON is clicked. So my task is to fetch the selected LEVEL_ID and to do some changes when the particular LINK_BUTTON is clicked. Please help me out.
You all are really Genius. I have many codes from code-project.
Thanks!!
Posted

1 solution

In the OnClick event of the button do the next steps:
Button btn = (Button)sender;
GridViewRow row = (GridViewRow)btn.NamingContainer;
GridView.SelectedIndex = row.RowIndex;

Now you can find the
level_ID = row.Cells[0].Text;
 
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