How can i get selected rows in code behind ?
It give selected rows>0 but when i try to access
SelectedRows[0].Index then it give Input string is not in valid format.
please reply soon why this happen.
Is there another way to get selected rows if above does not work?
Hello Mypost,
I am not sure why this does not work. The code looks correct to me. Are you sure that you have the Selection Behavior enabled. Does SelectedRows[0] exist if you put a breakpoint on that line of code? Is the grid having a problem getting the index? You will need to debug the code to see what does not exist of what property is failing in that line of code. I have put together a little code snippet for you to try. Add a button to the page and handle the click event. Then past this code in there.
if (this.WebDataGrid1.Behaviors.Selection.SelectedRows.Count > 0) { if (this.WebDataGrid1.Behaviors.Selection.SelectedRows[0].Index == 0) {
} }
Then run the app and select the first row. After selecting the first row, click the button. It should stop at your break point. Step through the code and see if it makes it into the inner if statement. If it does not, then that means that the count is not greater then 0 or the index of the row is not 0. Hopefully this will help you analyze what is going on.
If this still has an issue, then I would then need to know what version of NetAdvantage you are using. There might have been a bug in the version that you are using. I tried this using the release build of 10.3.
Please let me know the outcome.
Hi Steve,
I'm getting the same problem and I think this is related to the way we the grid binds I'm binding the grid with the dataset I'm not binding it on each post back as my submit button causes the postback is it possible the gridslectionrows collection clears on postback will the count property of that collection returns correct numberbut when i try to access the row thru the indes it gives me null rowplease suggest me the right way of doing it.(my problem is that at the load time i do not have the information of Dataset as it is built on the runtime)