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>
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
Thankx for reply,
i have got the solution.
Actually what i was doing, when my page postback then i am again binding the grid to
datatable, that generate the problem of input string was not in valid formate, if we try to
access wdg.Behaviors.Selection.SelectedRows[0], but if use wdg.Behaviors.Selection.SelectedRows.Count then
it return 1.
i have a another problem, when i remove the binding grid code on PagePostBack. my problem is
My grid has Checkbox template column,
and paging is enable, if i do not bind it on page post back and
clicked on second page to see Next records then it give the fallowing javascript Exeception
(In my grid only template column is fixed and every thing(columns) creating dynamically.)
Object reference not set to an instance of an objectat Infragistic.web.UI.GridControls.WebDataGrid.InstatiateTempaltes()at Infragistic.web.UI.GridControls.WebDataGrid.BaseGrid.EnsureTemplates()at Infragistic.web.UI.Framework.Data.FlatDataBoundControl.CreateChldControls()at Infragistic.web.UI.GridControls.EnsureChildCOntrols()at System.web.UI.Controls.PreRenderRecursiveInternal()