<
telerik:RadGrid
ID
=
"ContactsGrid"
runat
=
"server"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
Culture
=
"de-DE"
DataSourceID
=
"contacts"
GridLines
=
"None"
Height
=
"100%"
OnItemCreated
=
"ContactsGrid_ItemCreated"
OnItemInserted
=
"ContactsGrid_ItemInserted"
OnPreRender
=
"ContactsGrid_PreRender"
onneeddatasource
=
"ContactsGrid_NeedDataSource"
onitemdatabound
=
"ContactsGrid_ItemDataBound"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
CommandItemDisplay
=
"Top"
DataKeyNames
=
"ContactsID"
DataSourceID
=
"contacts"
InsertItemPageIndexAction
=
"ShowItemOnCurrentPage"
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
DataField
=
"ContactsID"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter ContactsID column"
HeaderText
=
"ContactsID"
SortExpression
=
"ContactsID"
UniqueName
=
"ContactsID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CustomerID"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter CustomerID column"
HeaderText
=
"CustomerID"
SortExpression
=
"CustomerID"
UniqueName
=
"CustomerID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Name"
DataFormatString="<nobr>{0}</
nobr
>"
FilterControlAltText="Filter Name column" HeaderText="Name"
SortExpression="Name" UniqueName="Name">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Lastname"
DataFormatString="<nobr>{0}</
nobr
>"
FilterControlAltText="Filter Lastname column" HeaderText="Lastname"
SortExpression="Lastname" UniqueName="Lastname">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Telephone"
DataFormatString="<nobr>{0}</
nobr
>"
FilterControlAltText="Filter Telephone column" HeaderText="Telephone"
SortExpression="Telephone" UniqueName="Telephone">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Mobile"
DataFormatString="<nobr>{0}</
nobr
>"
FilterControlAltText="Filter Mobile column" HeaderText="Mobile"
SortExpression="Mobile" UniqueName="Mobile" AutoPostBackOnFilter="False">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"E_Mail"
DataFormatString="<nobr>{0}</
nobr
>"
FilterControlAltText="Filter E_Mail column" HeaderText="E_Mail"
SortExpression="E_Mail" UniqueName="E_Mail">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Fax"
DataFormatString="<nobr>{0}</
nobr
>"
FilterControlAltText="Filter Fax column" HeaderText="Fax" SortExpression="Fax"
UniqueName="Fax">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Department"
DataFormatString="<nobr>{0}</
nobr
>"
FilterControlAltText="Filter Department column" HeaderText="Department"
SortExpression="Department" UniqueName="Department">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Notification"
DataFormatString="<nobr>{0}</
nobr
>"
FilterControlAltText="Filter Notification column" HeaderText="Notification"
SortExpression="Notification" UniqueName="Notification">
</
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
/>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
ButtonType
=
"ImageButton"
/>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
></
Selecting
>
</
ClientSettings
>
</
telerik:RadGrid
>
ContactsGrid.MasterTableView.FilterExpression =
"it.CustomerID = "
+ e.Index;
ContactsGrid.MasterTableView.Rebind();
// Create a RadPnaleItem and set the Text to SelectionTitle.
RadPanelItem radPanelItemSelection =
new
RadPanelItem();
radPanelItemSelection.Text = row[
"SelectionTitle"
].ToString();
// Expand only the first selection.
if
(selectionNumber == 1)
{
radPanelItemSelection.Expanded =
true
;
}
else
{
radPanelItemSelection.Expanded =
false
;
}
// Create anothet RadPanelItem and add the CheckBoxList.
RadPanelItem radPanelItemCheckBoxList =
new
RadPanelItem();
radPanelItemCheckBoxList.Controls.Add(checkBoxList);
radPanelItemSelection.Items.Add(radPanelItemCheckBoxList);
// Add the RadPanelItem to the RadPanelBar.
rpbFilters.Items.Add(radPanelItemSelection);
RadPanelItem radPanelItem = rpbFilters.Items[0];
CheckBoxList checkBoxList = (CheckBoxList)radPanelItem.FindControl(
"cblSelect1"
);
var radPanelItems = rpbFilters.GetAllItems();
foreach
(RadPanelItem item
in
radPanelItems)
{
RadPanelItem radPanelItem = item.Items[0];
CheckBoxList checkBoxList = (CheckBoxList)radPanelItem.FindControl(
"cblSelect1"
);
}
I'm getting an error "Conversion from type 'DBNull' to type 'Boolean' is not valid." upon displaying an insert form inside a RadGrid that has two RadButton controls with the ToggleType="Checkbox" that have the Checked property being bound from a database.
<telerik:RadButton ID="RXRequired" runat="server" ForeColor="White"
AutoPostBack="false" ButtonType="ToggleButton" Checked='<%# Bind("RXRequired")%>'
ToggleType="CheckBox" EnableViewState="true" >
<ToggleStates>
<telerik:RadButtonToggleState PrimaryIconCssClass="rbRemove" />
<telerik:RadButtonToggleState PrimaryIconCssClass="rbOk" Selected="true" />
</ToggleStates>
</telerik:RadButton>
I have seen numerous posts all over the web regarding DBNull values and checkboxes upon initiating a form insert with the Bind statement. This apparently has been going on for many, many years. This is truly amazing that this is still an issue today, many years later! When the hell is Telerik going to fix this issue with their controls? Come on guys, fix this already!!! This is a real simple thing to do, why should this still be an issue?
This is insane already. FIX IT!!!!!!!!!!!!!!!!!!!!!!