NB. I am posting this self-answered post because I could not find a solution in the forum. Hopefully it will be useful to someone else.
I spent *way* too many hours trying to debug this scenario: I have a GridTemplateColumn with a RadButton as a toggle button. I could not get the toggle button state back from the edit form for the insert and update commands for the life of me. The longer it took to solve, the simpler I knew my error had to be. Unfortunately, I could not find any examples in the demos--they all use simple column binding.
My problem ended up being in my SQL data source: I had declared my "boolean" field as an "int" instead of a "bit". By fixing this, the two way binding worked as desired.
Here is a snippet of my code, with just the RadButton in the template column (there are other controls in my actual application).
In the SQL data source, the column "isOpen" is declared like this, even though it is a "bit" in the SQL database:
I spent *way* too many hours trying to debug this scenario: I have a GridTemplateColumn with a RadButton as a toggle button. I could not get the toggle button state back from the edit form for the insert and update commands for the life of me. The longer it took to solve, the simpler I knew my error had to be. Unfortunately, I could not find any examples in the demos--they all use simple column binding.
My problem ended up being in my SQL data source: I had declared my "boolean" field as an "int" instead of a "bit". By fixing this, the two way binding worked as desired.
Here is a snippet of my code, with just the RadButton in the template column (there are other controls in my actual application).
<
telerik:GridTemplateColumn
UniqueName
=
"gtcName"
HeaderText
=
"Title"
>
<
ItemTemplate
>
<
telerik:RadButton
ID
=
"rbOpen"
runat
=
"server"
ButtonType
=
"ToggleButton"
ToggleType
=
"CheckBox"
Checked='<%#Bind("isOpen")%>' Height="24" Width="48" ReadOnly="true">
<
ToggleStates
>
<
telerik:RadButtonToggleState
ImageUrl
=
"iOpen.png"
IsBackgroundImage
=
"false"
Value
=
"1"
Selected
=
"true"
/>
<
telerik:RadButtonToggleState
ImageUrl
=
"iClosed.png"
IsBackgroundImage
=
"false"
Value
=
"0"
/>
</
ToggleStates
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadButton
ID
=
"erbOpen"
runat
=
"server"
ButtonType
=
"ToggleButton"
ToggleType
=
"CheckBox"
Checked='<%#Bind("isOpen")%>'
Height="24" Width="48">
<
ToggleStates
>
<
telerik:RadButtonToggleState
ImageUrl
=
"iOpen.png"
IsBackgroundImage
=
"false"
Value
=
"1"
Selected
=
"true"
/>
<
telerik:RadButtonToggleState
ImageUrl
=
"iClosed.png"
IsBackgroundImage
=
"false"
Value
=
"0"
/>
</
ToggleStates
>
</
telerik:RadButton
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
In the SQL data source, the column "isOpen" is declared like this, even though it is a "bit" in the SQL database:
<
asp:Parameter
Name
=
"isOpen"
Type
=
"Boolean"
/>