Persist Checked Rows Across Multiple Pages

4 replies. Last post: November 15, 2010 12:08 AM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Rob SmithMember

Hello

We are using WebGrid version 6 and want to find out how to persist checked rows across postbacks.

problem 1:
When we use the Ctrl key to multiselect rows, it will only select the second row the second time around. For example, select a first row by left clicking with the mouse, then hold the ctrl key down and left click another row. Only one row will be selected where I would expect 2 rows to be selected by now. Repeat the procedure and it works.

problem 2:
At present, when we use the Ctrl key to multi select rows, they turn the colour we expect (disregarding problem 1). However, when we move to page 2 of the grid and then move back to page one, the checked row colours have disappeared from the first page. We need to find out how to persist checked rows irrespective of which page numbers we visit. We have set PersistRowChecker="true"which I assumed would do the trick.


Below is a snippet of the main code

Many thanks in advance


<iswebgrid:webgrid 
id="WebGridMain"
runat="server"
allowautodatacaching="false"
onexport="WebGridMain_Export"
onupdaterow="WebGridMain_UpdateRow"
OnInitializeDataSource="WebGridMain_InitializeDataSource"
OnPrepareDataBinding="WebGridMain_PrepareDataBinding" >

<LayoutSettings
AllowColumnFreezing="Yes"
AllowMultipleSelection="Yes"
AllowContextMenu="true"
PersistRowChecker="true"

AllowDelete="Yes"
AllowEdit="Yes"
AllowExport="Yes"
AllowFilter="Yes"
AllowSorting="Yes"
AlwaysShowHelpButton="False"
HeaderClickAction="SortMulti"
AutoHeight="true"
FocusNewRowOnLastCell="True"
GridLineColor="#DCB0C8"
GridLines="Vertical"
CellPaddingDefault="5"
PagingMode="ClassicPaging"
PagingExportMode ="ExportAllData"
PagingSize="25"
PagingLoadMode="Automatic"
PagingStyleUI="FirstPrevNextLast">

<FreezePaneSettings AbsoluteScrolling="true" ShowInContextMenu="True" />

<SelectedRowStyle BackColor="Blue" ForeColor="White" />

<CheckedRowStyle BackColor="Red" ForeColor="White"></CheckedRowStyle>

<various styles etc..............>

</LayoutSettings>

</iswebgrid:webgrid>


/// <summary>
/// Populate the grid with the correct data
/// </summary>
protected void WebGridMain_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
{
// Fill in the grid datasource
e.DataSource = GridManager.PopulateGridData(...);

// Set gridcolumn width, types, captions etc
GridManager.PopulateGridColumns(...);
}

protected void WebGridMain_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)
{
if (!IsPostBack)
{
WebGridMain.RetrieveStructure();
}
}


All times are GMT -5. The time now is 4:26 PM.
Previous Next