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
560
RowSelectionChanged - eventargs is nothing
posted

I have a WebDataGrid that is bound to a DataSet. It populates with data and hits the "RowSelectionChanged" event, but I cant get back any data. It says there is value of nothing in the code:

Dim myGridRecord As GridRecord = e.CurrentSelectedRows(0)
Dim myDataItem As DataRowView = DirectCast(myGridRecord.DataItem, DataRowView)
Dim myDataRow As DataRow = myDataItem.Row
Dim myArray() As Object = myDataRow.ItemArray()
Dim myColumnIndex As Integer = Me.WebDataGridReports.Columns("sharpreportsid").Index
Dim myValue As String = myGridRecord.Items(myColumnIndex).Value.ToString()

e.CurrentSelectedRows(0) is always "nothing"

Odd thing is that it does show all the data and gets fired when the row is selected, so the markup must be fine.
<Behaviors>
                        <ig:EditingCore>
                            <Behaviors>
                                <ig:CellEditing Enabled="true" >
                                    <EditModeActions EnableF2="true" EnableOnActive="true" MouseClick="Single" />
                                    <ColumnSettings>
                                        <ig:EditingColumnSetting ColumnKey="name" ReadOnly="true" />
                                    </ColumnSettings>
                                </ig:CellEditing>
                            </Behaviors>
                        </ig:EditingCore>
                        <ig:Activation Enabled="true" />                                                
                        <ig:Selection RowSelectType="Single" Enabled="true" CellClickAction="Row">
                            <AutoPostBackFlags RowSelectionChanged="True" />
                        </ig:Selection>
                        <ig:RowSelectors Enabled="true" RowNumbering="false"/>
                        <ig:Sorting Enabled="true" />
                    </Behaviors>

Anyone seen this behavior before, or maybe I am missing another setting. Your examples are nice, but they fail to
show any code-behind for helping the UI. Unless I am missing something more...
Thanks
SDI

 

 

 

  • 49378
    posted

    Hi SharpDataInc,

    It has been some time since your post, however in case you still need assistance I would be glad to help.

    Note that e.CurrentSelectedRows[0] returns a ContainerGridRecord object which can be used to directly access the values of the newly selected row. For instance:


    ContainerGridRecord row = e.CurrentSelectedRows[0];

    //output the value of the first row field
    Debug.WriteLine(row.Items[0].Value)

    Please feel free to contact me if you have any questions.