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
3788
How can i get selected rows in code behind ?
posted

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?

Parents
  • 2677
    posted

    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.

Reply Children