selecting a row programatically via Button
-
Hi! I guess this is quite simple for some of you guys out there, but I am stuck whole morning with this issue. I do have a gridview control, and I have a button which will select the row where the checkbox is existing. After the gridview is selected, when the button is selected I want to put all the data in a strings, and play with that. Any help? Thx ahead, Laziale
-
Hi! I guess this is quite simple for some of you guys out there, but I am stuck whole morning with this issue. I do have a gridview control, and I have a button which will select the row where the checkbox is existing. After the gridview is selected, when the button is selected I want to put all the data in a strings, and play with that. Any help? Thx ahead, Laziale
-
I haven't do any coding for the ButtonEdit_Click event, cause there I am stuck and I don't know how to get the selected row with checkbox. Thx for helping me out...
-
Every Row has a checkbox Right?Can you provide your requirement in detail. Are you hiding checkbox sometimes based on some conditions? or anything else?
Cheers!! Brij
ok...here is where I am stuck now. I declared a gridviewClass.AutoGenerateSelectButton = true in the Page_Load method, now how I can get the text from each field from the selectedrow and put them in a string? I tried with string test = ((TextBox)gridviewClass.SelectedRow.FindControl("Type")).Text; where 'Type' is the datafield what is attached to the asp:BoundField from the gridview control, but I am getting a NullReferenceException: Object reference not set to an instance of an object. Please someone out there help me. Thx ahead, Laziale :confused:
-
ok...here is where I am stuck now. I declared a gridviewClass.AutoGenerateSelectButton = true in the Page_Load method, now how I can get the text from each field from the selectedrow and put them in a string? I tried with string test = ((TextBox)gridviewClass.SelectedRow.FindControl("Type")).Text; where 'Type' is the datafield what is attached to the asp:BoundField from the gridview control, but I am getting a NullReferenceException: Object reference not set to an instance of an object. Please someone out there help me. Thx ahead, Laziale :confused:
-
I solved!!!! for someone else who might get this problem: I used this: string test = gridview1.SelectedRow.Cells[i].Text; have a nice day!!!!
You might want to write it something like this String test += gridview1.SelectedRow.Cells[i].Text; Otherwise you will only up with the text from the last selected row. Good job on solving the problem and thank you for solving the problem :), Prateek