Hi,
I find combobox little complex in its usage. This is what i wish to do while using it inside grid control , I am using form template (in grid)...
1. I want combo to display intital value as "select" (to force user to select dropdown)
2. if user does not select it should show error message.
3. Above should also be true when user resets this choice back to "select" (initial value)
4. Since this is multicolumn using template, it should display 1st row as "select" in all columns available in multicolumn
or atleast in 1st column.
I tried doing above but failed on point #2 and Point #4.
a. I also had to write above code, which i feel is unnecessary and there should be a better approach.
b. Form do get submitted, without doing any selection. validationcontrol should have stopped, but it did not.
c. first row in the multicolumn list remains blank. I want that it should display 'Select' and its value also should be "Select" so that validation can stop form submit.
I hope i was able to explain. Any advice?
Regards
I find combobox little complex in its usage. This is what i wish to do while using it inside grid control , I am using form template (in grid)...
1. I want combo to display intital value as "select" (to force user to select dropdown)
2. if user does not select it should show error message.
3. Above should also be true when user resets this choice back to "select" (initial value)
4. Since this is multicolumn using template, it should display 1st row as "select" in all columns available in multicolumn
or atleast in 1st column.
I tried doing above but failed on point #2 and Point #4.
<
telerik:RadComboBox
Width
=
"250px"
HighlightTemplatedItems
=
"true"
runat
=
"server"
ID
=
"cbCurrencyCode"
AppendDataBoundItems
=
"True"
DataSourceID
=
"EntityDataSource2"
SelectedValue='<%# Bind("FKCurrencyCode") %>'
onitemdatabound="cbCurrencyCode_ItemDataBound" >
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"- Select -"
Value
=
"- Select -"
/>
</
Items
>
<
HeaderTemplate
>
<
ul
>
<
li
class
=
"col1"
>Code</
li
>
<
li
class
=
"col2"
>Name</
li
>
</
ul
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
ul
>
<
li
class
=
"col1"
>
<%# DataBinder.Eval(Container.DataItem, "CurrencyCode")%></
li
>
<
li
class
=
"col2"
>
<%# DataBinder.Eval(Container.DataItem, "CurrencyName")%></
li
>
</
ul
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
<
br
/>
<
asp:RequiredFieldValidator
runat
=
"server"
ID
=
"RequiredFieldValidator2"
ControlToValidate
=
"cbCurrencyCode"
InitialValue
=
"- Select -"
ErrorMessage
=
"Please select."
ValidationGroup
=
"SearchFormValidationGroup"
CssClass
=
"validator"
/>
protected
void
cbCurrencyCode_ItemDataBound(
object
sender, Telerik.Web.UI.RadComboBoxItemEventArgs e)
{
e.Item.Text = ((DAL.MasterCurrency)e.Item.DataItem).CurrencyCode;
//((DataRowView)e.Item.DataItem)["CurrencyCode"].ToString();
e.Item.Value = ((DAL.MasterCurrency)e.Item.DataItem).CurrencyCode;
//((DataRowView)e.Item.DataItem)["CurrencyCode"].ToString();
}
a. I also had to write above code, which i feel is unnecessary and there should be a better approach.
b. Form do get submitted, without doing any selection. validationcontrol should have stopped, but it did not.
c. first row in the multicolumn list remains blank. I want that it should display 'Select' and its value also should be "Select" so that validation can stop form submit.
I hope i was able to explain. Any advice?
Regards