I've just upgraded my project to 11.1 with 4.0 framework, and I have a column that I am trying to use the new UnboundCheckBoxField. I add the column using the properties menu in VS2010, with a key "Assign". The grid displays correctly in VS2010 but errors when I try to run the page. Below is the grid, and the 3 errors I recieve...
<ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="100%" DataKeyFields="Row_ID"> <Columns> <ig:UnboundCheckBoxField DataType="System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" HeaderChecked="False" Key="Assign"> <Header Text="Assign" /> </ig:UnboundCheckBoxField> <ig:BoundDataField DataFieldName="Row_ID" Key="Row_ID" Hidden="true"> <Header Text="Row_ID" /><Header Text="Row_ID"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Prospect_ID" Key="Prospect_ID" Hidden="true"> <Header Text="Prospect_ID" /><Header Text="Prospect_ID"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Biz_ID" Key="Biz_ID" Hidden="true"> <Header Text="Biz_ID" /><Header Text="Biz_ID"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Call_Type_ID" Key="Call_Type_ID" Hidden="true"> <Header Text="Call_Type_ID" /><Header Text="Call_Type_ID"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Full_Name" Key="Full_Name"> <Header Text="Client" /><Header Text="Client"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Internal_Sys_Name" Key="Internal_Sys_Name"> <Header Text="Call Type" /><Header Text="Call Type"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Call_Back_Date" Key="Call_Back_Date" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy hh:mm tt}"> <Header Text="Call Back Date" /><Header Text="Call Back Date"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Assigned_MA" Key="Assigned_MA"> <Header Text="Assigned MA" /><Header Text="Assigned MA"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Current_MA" Key="Current_MA"> <Header Text="Original MA" /><Header Text="Original MA"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Prospect_Full_Name" Key="Prospect_Full_Name"> <Header Text="Prospect" /><Header Text="Prospect"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Company_Name" Key="Company_Name"> <Header Text="Company" /><Header Text="Company"></Header> </ig:BoundDataField> </Columns>
<ClientEvents Initialize="intializeGrid"></ClientEvents> <Behaviors> <ig:Paging PageSize="100"> </ig:Paging> <ig:Filtering> <ColumnSettings> <ig:ColumnFilteringSetting ColumnKey="Assigned_MA" Enabled="false" /> <ig:ColumnFilteringSetting ColumnKey="Current_MA" Enabled="false" /> </ColumnSettings> </ig:Filtering> <ig:Sorting> </ig:Sorting> <ig:ColumnResizing> </ig:ColumnResizing> <ig:EditingCore AutoCRUD="False"> <Behaviors> <ig:CellEditing Enabled="true"> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="Assigned_MA" EditorID="WebDataGrid1_DropDownProvider1" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="Current_MA" EditorID="WebDataGrid1_DropDownProvider1" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="Full_Name" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="Internal_Sys_Name" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="Call_Back_Date" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="Prospect_Full_Name" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="Company_Name" ReadOnly="true" /> </ColumnSettings> </ig:CellEditing> <ig:RowDeleting /> </Behaviors> </ig:EditingCore> </Behaviors> <EditorProviders> <ig:DropDownProvider ID="WebDataGrid1_DropDownProvider1"> <EditorControl ID="EditorControl1" DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False" runat="server" DataSourceID="SqlDataSource3" TextField="Full_Name" ValueField="Employee_ID"><DropDownItemBinding TextField="Full_Name" ValueField="Employee_ID"></DropDownItemBinding> </EditorControl> </ig:DropDownProvider> </EditorProviders> <ClientEvents Initialize="intializeGrid" /> <EmptyRowsTemplate> <div style="text-align:center; "><br/><br/> <img src="../../images/WebDataGrid/attention.png" align="absmiddle"/> No records returned. </div> </EmptyRowsTemplate> <ErrorTemplate><div style="text-align:center;width:800px;"> <img src="../../images/WebDataGrid/error.png" align="absmiddle"/> An error has occurred! Please contact support. </ErrorTemplate> </ig:WebDataGrid>
If I try to remove the DataType attribute, the grid will then not display in VS.
Also, in code behind, how do I now determine if the row is checked if I am looping through the rows of the grid?
Hi NervousRex,
Thanks for being one of the first to try out this new column type. For the UnboundCheckBox, it is unnecessary to set the DataType (so delete it on the aspx). The type will always be of nullable boolean, allowing values of true, false, and null. There actually is a bug for the DataType outputting like that in VS at design time. It should be available in the first SR. Its number is 77620. It looks like you used the grid designer to add the columns, so for some reason it added extra stuff. Not sure why. Delete all the lines in the columns that are <header></header> Leave just the self-closing ones. I think that should get it to compile.
As for accessing the checked rows. When you loop through the rows, just access the item for the UnboundCheckBox column and check its value. It will be true/false/null. And you've already got EditingCore on, so it is not read-only. If you feel there is anything missing from this column type, feel free to let me know.
regards,David Young
That fixed it, I had to restart Visual Studio for it to display in design view after deleteing the datatype.
Thanks, I couldn't wait for this feature to be released, so had to be one of the first. Now to check out the other updates.