Hey Guys

I need to be able to select or hightlight datagrid row when a user place a mouse on certain record then, he/she can be able to click delete or edit button to delete the selected row or edit the selected row, can anyone tell me how to do that coz I cant select rows on my datagrid, in there anycode or property I need to set

Thanks in advance

9 Years
Discussion Span
Last Post by nicky.23in

why dont you add check boxes in the datagrid? for the rows whose checkboxes are checked, highlight the row


>I cant select rows on my datagrid..
Your data source might be empty or you disabled the datagrid or you haven't place select button.

Which version of .net framework are you using? If you code then show us.


Its VS 2008, what I am doing is I am binding a table from Oracle to a datagrid and I wana be able to select/highlight a row from a datagrid and transfer the data from the selected row to another form where I can be able to edit the record and save and it is updated to the database again

for example on my datagrid, I have Name, Surname, DOB, City, etc and then I have a editwebform that is editing those attributes, in this editwebform I have NameTextbox, surnameTextbox, etc and I want to select the row on the datagrid and click edit button and edit button should open my editwebform with the data of the selected record then I can edit the record and save it and bind the datagrid again, I hope thats clear


Yah ur right why I didnt think about that, I actually am, but I can write a code to edit and get the data from database what Im struggling to do is to make sure that the row is selected from the datagrid and only the values from the datagrid are brought foward to the edit form


Well my code is in my laptop at home and at work w r using sql server whereas I used oracle for my project, coz I know in SQL is much easier than it is in Oracle, i could do it in SQL but in Oracle its quite a mission n the only reason I used oracle for my project is bcoz it was the only software I cud get hold of without any complications

What Im thinking is Im gona have a selectbutton on my DataGrid and then have a selectbuttoncommand which is gona be uploading the selected record on my edit form, but my problem is, I havent tried it, is it possible for a editcommandbutton in datagrid, or selectcommandbutton to open another form, I think it it but I will get back to u if I have trouble doing that

Thanks hey



You can place an edit button or link button in grid.
Pass data of the row to your edit page on click of the button.

Read the row data in properties of object and transfer those to Edit page using HttpContext.Current.Items.Add("CTX_O", objServiceCharges); Get these on your Edit Page in viewState

if (ViewState["CTX_O"] != null)
             Get the values from viewstate into your controls
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.