ISSUE
I am new to infragistics, I am using the webdatagrid in my page. My grid has a check box as one of the fields. The header field is also a check box .
In the server side event( i need this in the server event no client side events:) ) of the header check box . I need to bind the grid .
If header check box is checked i need to display only active records and if its unchecked i need to display all records .
I am implementing this logic in the server function of the header check box and the grid is not binding( ie the values are not changed) in this event .
I am working on this fix for over a week now . Please help
Please see the code below ...........
ASPX
<ig:WebDataGrid ID="WebDataGrid1" runat="server" EnableDataViewState="true" ViewStateMode="Enabled" Height="100%" Width="100%" AutoGenerateColumns="False" OnColumnSorted="WebDataGrid1_ColumnSorted" DataKeyFields="Id">
<Columns>
<ig:BoundDataField DataFieldName="Id" Hidden="True" Key="Id">
<Header Text="BoundColumn_0" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Name" Key="Name">
<Header Text="Name"></Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="ShortName" Key="ShortName">
<Header Text="ShortName"></Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="IsoCode" Key="IsoCode">
<Header Text="IsoCode"></Header>
</ig:BoundDataField>
<ig:TemplateDataField Key="IsActive" Header-Text="IsActive">
<HeaderTemplate>
<asp:CheckBox ID="chkChildIsActive" runat="server" Checked="true"
Text="IsActive" AutoPostBack="True"
oncheckedchanged="chkChildIsActive_CheckedChanged">
</asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkHIsActive" runat="server" Checked='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "IsActive") %>'>
</asp:CheckBox>
</ItemTemplate>
<Header Text="IsActive" />
</ig:TemplateDataField>
</Columns>
<ClientEvents Click="WebDataGrid1_SingleClick" DoubleClick="WebDataGrid1_DoubleClick" />
<Behaviors>
<ig:Paging PageSize="15" QuickPages="9">
<PagerTemplate>
<uc1:CustomerPagerControl ID="CustomerPager" runat="server" />
</PagerTemplate>
</ig:Paging>
<ig:Sorting>
</ig:Sorting>
<ig:RowSelectors>
</ig:RowSelectors>
<ig:Selection RowSelectType="Single" CellClickAction="Row" CellSelectType="None">
</ig:Selection>
</Behaviors>
</ig:WebDataGrid>
ASPX.cs
// Page load binding data to grid
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<Port> port = PortManager.PortListTestPaging(true);
WebDataGrid1.DataSource = port;
WebDataGrid1.DataBind();
}
}
//Checkbox Event
protected void chkChildIsActive_CheckedChanged(object sender, EventArgs e)
{
CheckBox chkChildIsActive = (CheckBox)sender;
List<Port> port = PortManager.PortListTestPaging(chkChildIsActive.Checked);
WebDataGrid1.DataSource = port;
WebDataGrid1.DataBind();
}
Fixes that i tried from the Infragistics forum:
EnableDataViewState = false : If we give this property to grid then on the checkbox event the grids all data is cleared ( and the check box event is not fired) .
EnableDataViewState = true and WebDataGrid1.ClearDataSource(): Then I had the following error occurred on check box event "Multiple controls with the same ID 'xyz0_4' were found" I have gone through the below link for a fix but failed . http://www.infragistics.com/community/forums/p/65065/329361.aspx
WebDataGrid1.Rows.Clear() & //WebDataGrid1.Columns.Clear() : Both not worked .
I wanted to know what the issue was so itried the same code for a button event with button outside the grid and it worked . So i think its some problem with some of the properties in the webdatagrid that i may have wrongly given . I have gone through all possible work around that were available .
Thanks , Sankardeep V