Hi,
I want to have a checkbox that binds to a field which stores 'Y' or 'N' instead of boolean value. Is there an event which I can put the codes to alter true/false back to 'Y'/'N' before saving back to the database? Is this even possible?
In the ItemTemplate I am using label to display the content of the field, so it has no problem displaying. In the EditItemTemplate, here's what I'm doing:
aspx:
<
asp:CheckBox
runat
=
"server"
Text
=
"Vendor"
ID
=
"ThirdPartyVendorCheckbox"
/>
<
asp:HiddenField
runat
=
"server"
ID
=
"hiddenThirdPartyVendor"
Value='<%# Eval("thirdparty_vendor") %>' />
Code-Behind:
protected
void
RadListView1_ItemDataBound(
object
sender, RadListViewItemEventArgs e)
{
if
(e.Item
is
RadListViewEditableItem && e.Item.IsInEditMode)
{
CheckBox chkbox = e.Item.FindControl(
"ThirdPartyVendorCheckbox"
)
as
CheckBox;
HiddenField hf = e.Item.FindControl(
"hiddenThirdPartyVendor"
)
as
HiddenField;
string
txtVal = hf.Value;
if
(txtVal !=
"Y"
)
chkbox.Checked =
true
;
else
chkbox.Checked =
false
;
}
}
Thank you,
Helen