Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Webdatagrid column button clickevent
posted

Hi everyone,

I hope you can help me with this, I am super new with web developing (I'm a VB.net developer) new to JavaScript and ASP.net, here is my issue, I have a WebDataGrid with four columns:

1- Reference No (Bounded Field from SqlDataSource)

2- Status (Bounded Field from SqlDataSource)

3- TemplateField with a buttom called (Approve)

4- TemplateField with a buttom called (Reject)

so what I want is when I click one of the buttons an SQL command will be fired to update the database, the problem that I couldn't get the column(Reference No) value of the clicked row to execute the query, so I need something like this:

"update Table set status="Approved" where ref_no=(ClickedRowIndex.Cell(Reference No).value)"

thanks in advance,

UPDTAE:

I managed to find a way to get the selected row index and it value, but the problem that I am facing now is when I click the button the selected row doesn't change (doesn't get focused), I have to click on any cell except the button to get a selected row and then I have to click the button, is there any way to set the selected row when the button is clicked?