I am Using, WebHierarchicalDataGrid having default paging. In the grid, I have first column in grid 'check box' in template field. When check box is check, and i click on button on top the programs works fine.
additionally, I have drop down on top of grid. Which has numbers for showing records to be shown in site grid. like 10, 20, 30, ....User can select any and that many records will be shown in grid.
The code for Selected_Index change in that drop down is as follows:
if (!IsRefresh) { // Set the size of records per page. int unitpagesize = 0; unitpagesize = Convert.ToInt32(drppagesizeunitlist.SelectedValue.ToString()); this.whdgUnits.Behaviors.Paging.PageIndex = 0; this.whdgUnits.Behaviors.Paging.PageSize = unitpagesize; ViewState["UnitPageSize"] = unitpagesize; this.whdgUnits.RefreshBehaviors(); updatePanelUnitsGrid.Update(); }
Once i done with this, the grid shows number of records properly page.
after that if i check any check box and click on above button, I found that all check boxes are uncheck.
The properties for WebHierarchicalDataGrid are as follows:
<ig:WebHierarchicalDataGrid runat="server" ID="whdgUnits" Width="99.5%" EnableViewState="true" EnableDataViewState="true" AutoGenerateColumns="False" DataMember="sqldsUnits_DefaultView" DataSourceID="whdsUnits" InitialDataBindDepth="0" DataKeyFields="UnitID" Key="sqldsUnits_DefaultView" EnableAjax="False" ViewStateMode="Enabled">
<Columns> <ig:TemplateDataField Key="chkgrid"> <ItemTemplate> <asp:CheckBox Id="chkgrid" runat="server" /> </ItemTemplate> </ig:TemplateDataField> <ig:BoundDataField DataFieldName="UnitID" Key="UnitID" Hidden="true"> <Header Text="UnitID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="DisplayID" Key="DisplayID"> <Header Text="Unit ID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="UnitTypeID" Key="UnitTypeID" Hidden="true"> <Header Text="UnitTypeID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="UnitTypeName" Key="UnitTypeName"> <Header Text="Unit Type" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="UnitName" Key="UnitName"> <Header Text="Unit" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="ProjectID" Key="ProjectID" Hidden="true"> <Header Text="ProjectID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="project_name" Key="project_name"> <Header Text="ProjectName" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="SiteID" Key="SiteID" Hidden="true"> <Header Text="SiteID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="SiteName" Key="SiteName"> <Header Text="Site" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="project_owner_id" Key="project_owner_id" Hidden="true"> <Header Text="ProjectOwnerID" /> </ig:BoundDataField> </Columns> <EmptyRowsTemplate> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:DropDownList ID="DropDownList1" runat="server" style="margin-left: 14px"> </asp:DropDownList> <asp:Button ID="Button2" runat="server" style="margin-left: 0px" Text="Button" /> </EmptyRowsTemplate> <Behaviors> <ig:Selection CellClickAction="Row" RowSelectType="Single" > <SelectionClientEvents RowSelectionChanged="UnitRowSelectionChangedHandler" /> <AutoPostBackFlags RowSelectionChanged="false" /> </ig:Selection> <ig:Sorting> </ig:Sorting> <ig:Paging Enabled="true" PageSize="20">
</ig:Paging> <ig:Filtering> </ig:Filtering> <ig:Activation> </ig:Activation> </Behaviors> </ig:WebHierarchicalDataGrid>
hoping that anyone could help me, and if not understood the problem ready to explain it again.
Hello,
Based on the details you have provided, I would recommend you to use UnboundCheckBoxField or boundcheckboxfield since template columns data is not stored in grid view state. Review the sample from our website that demonstrates how to persist check box state across post back using UnboundCheckBoxField:
<http://samples.infragistics.com/aspnet/Samples/WebDataGrid/Data/Unbound-Checkbox-Column/Default.aspx?cn=data-grid&sid=2b5c08e1-23a8-43c6-a28c-7dc4aa1d8c43> I hope this helps.
I am just following up to see if you need any further assistance with using unboundcheckboxfield.
Update me if you have any further questions with this matter.