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
230
TemplateDataField Header Controls
posted

I have a TemplateDataField in a WebDataGrid that I am using as a selection checkbox to select multiple rows. I have as the header template an additional checkbox control that I want to use to support selection of all items for processing. I do not mean just items on the one currently visible page (which I am doing with a client-side script to loop through and mark the records' checkboxes) but all pages. In order to do this, I need to be able to access the header control in code-behind upon postback. I assumed this would be similar to accessing a TemplateDataField ItemTemplate control, but I am not having much luck.

Here is the column definition -
<ig:TemplateDataField Key="Select" Width="20">
<HeaderTemplate><asp:CheckBox ID="cbxSelectHeader" runat="server" /></HeaderTemplate>
<ItemTemplate><asp:CheckBox ID="cbxSelect" runat="server" /></ItemTemplate>
</ig:TemplateDataField>

I then try to access the header control like this -
CheckBox cbxHeaderSelect = (CheckBox)wdgHeaderControl.Columns[0].Header.FindControl("cbxSelectHeader");
CheckBox cbxSelect = (CheckBox)wdgHeaderControl.Rows[0].Items[0].FindControl("cbxSelect");

However, cbxHeaderSelect is null after that. cbxSelect is found and assigned properly.

I read in a post somewhere that the latest hot-fix may fix an issue with .FindControl() but when I tried to install it it failed. The installation log mentions failures to create/update IIS virtual directories.

Is this the correct way to go about accessing a template field header control? Can somebody confirm that this works with the hotfix? If so, I might be able to wait for the next release version. (Anybody know when that may be?) I have a sample solution that reproduces the issue that I can post if it is any help.


Also, I noticed that when you check a CheckBox in the ItemTemplate of a TemplateDataField, its state is not persisted across sorts, pages, or filters since the grid gets re-bound to the underlying data source. Based on what I read here (http://community.infragistics.com/forums/p/16885/61389.aspx), in order to support this scenario, the checkbox would need to be an editor provider and be bound to a data source field, correct? Is there any planned support for this feature coming? I would think that a checkbox would be a fairly simple and useful editor provider (especially compared to the complexity of the drop-down!). As that post above mentioned, I will email the product manager to request escalation of this feature (and possibly another one or two things we need here).

Our goal for this is to be able to support a user that wants to mark checkboxes for all the grid items, filter for a few records, unselect those, and then submit the form for processing.