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 to get selected rows?
posted

Hi,

     How can i get selected rows/

when i am accessing the Behaviours.Selection.SelectedRows.Count then it returns 1,

but when i am trying to access row (Behaviours.Selection.SelectedRows[0].Index)

then it return "Input string was not in correct format".

but some times it work fine.

please reply soon.

Below my code

<ig:WebDataGrid ID="webGrid" runat="server" EnableViewState="true" AutoGenerateColumns="False"
              OnColumnMoved="webTableGrid_ColumnMoved" OnColumnResized="webTableGrid_ColumnResized"
              OnColumnSorted="webTableGrid_Sorted">
              <ClientEvents />
              <Columns>
                <ig:TemplateDataField Key="select" VisibleIndex="0" Width="20px">
                
                  <HeaderTemplate>
                    <input type="checkbox" id="chkBoxHeader" enableviewstate="true" onclick="selectFirstColumn(event);" />
              
                  </HeaderTemplate>
                  <ItemTemplate>
                
                    <input type="checkbox" name="chkBox" id="chkBox" enableviewstate="true" onclick="OnCheckboxChange(this);" />
                  </ItemTemplate>
                </ig:TemplateDataField>
              </Columns>
              <Behaviors>
                <ig:ColumnFixing ShowFixButtons="false" ShowLeftSeparator="true" ShowRightSeparator="true"
                  AutoAdjustCells="true">
                  <ColumnSettings>
                    <ig:ColumnFixingSetting ColumnKey="selectionCol" EnableFixing="false" FixLocation="Left"
                      ShowFixButton="false" />
                  </ColumnSettings>
                </ig:ColumnFixing>
                <ig:ColumnResizing Enabled="true">
                  <ColumnSettings>
                    <ig:ColumnResizeSetting ColumnKey="selectionCol" EnableResize="false" />
                  </ColumnSettings>
                  <AutoPostBackFlags ColumnResized="true" />
                </ig:ColumnResizing>
                <ig:Activation Enabled="true">
                </ig:Activation>
                <ig:Selection Enabled="true" EnableHiddenSelection="true" CellClickAction="Row" RowSelectType="Single">
                </ig:Selection>
                <ig:Paging PageSize="25">
                </ig:Paging>
                <ig:Sorting SortingMode="Single">
                </ig:Sorting>
                <ig:ColumnMoving DragStyle="Follow">
                  <ColumnSettings>
                    <ig:ColumnMoveSetting ColumnKey="select" EnableMove="false" />
                  </ColumnSettings>
                </ig:ColumnMoving>
              </Behaviors>
            </ig:WebDataGrid>

 

Parents
  • 3115
    Offline posted

    Hi,

    are you sure you are using the right event.

    Because when I use RowSelectionChanged event with configuration similar to yours the following code works fine:

     

     

     

     

     

     

    WebDataGrid wdg = (WebDataGrid)sender;

     

     

     

    int coount = wdg.Behaviors.Selection.SelectedRows.Count;

     

     

     

    GridRecord gr = wdg.Behaviors.Selection.SelectedRows[0];

     

     

     

    int idx = gr.Index;

    If that's not your case plese give more specific information on your case.
    Thanks

Reply Children
No Data