I have a RadCombox bound to sql datasource with some dropdown items. There is one column called "Other". I want when users select the other, it enable a corresponding RadTextbox so they can input an item and on save button click the item get save to the other column in the database. Any example?
4 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 14 Mar 2013, 03:57 AM
Hello,
Please have a look into the following sample code.
ASPX:
JavaScript:
Then on the server side click event of a RadButton you can save the text in database and hide the RadTextBox.
Thanks,
Princy.
Please have a look into the following sample code.
ASPX:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
OnClientSelectedIndexChanged
=
"OnClientSelectedIndexChanged"
DataTextField
=
"ContactName"
>
<
DefaultItem
runat
=
"server"
Text
=
"Select"
/>
</
telerik:RadComboBox
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="select ContactName from [Customers]"></
asp:SqlDataSource
>
<
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
Style
=
"margin-left:50px; visibility:hidden;"
>
</
telerik:RadTextBox
>
JavaScript:
<script type=
"text/javascript"
>
function
OnClientSelectedIndexChanged(sender, args) {
var
textbox = $find(
"<%= RadTextBox1.ClientID %>"
);
if
(args._item._text ==
"Other"
) {
textbox._element.style.visibility =
"visible"
;
}
else
{
textbox._element.style.visibility =
"hidden"
;
}
}
</script>
Then on the server side click event of a RadButton you can save the text in database and hide the RadTextBox.
Thanks,
Princy.
0

Ebenezer
Top achievements
Rank 1
answered on 14 Mar 2013, 02:27 PM
Hi Princy
Thanks. But at the same time I am getting 'Telerik.Web.UI.RadComboBox' does not have a public proprty named 'DefaultItem'
Thanks. But at the same time I am getting 'Telerik.Web.UI.RadComboBox' does not have a public proprty named 'DefaultItem'
0
Accepted

Princy
Top achievements
Rank 2
answered on 15 Mar 2013, 05:10 AM
Hello,
The DefaultItem property of RadComboBox was introduced in the Q3 2012 release (version 2012.3.1016). Since you are getting Telerik.Web.UI.RadComboBox' does not have a public proprty named 'DefaultItem' error message, I think you are having a older version of DLL which does not have this feature. Check the version and try upgrading to the latest release of RadControls.
Thanks,
Princy.
The DefaultItem property of RadComboBox was introduced in the Q3 2012 release (version 2012.3.1016). Since you are getting Telerik.Web.UI.RadComboBox' does not have a public proprty named 'DefaultItem' error message, I think you are having a older version of DLL which does not have this feature. Check the version and try upgrading to the latest release of RadControls.
Thanks,
Princy.
0

Ebenezer
Top achievements
Rank 1
answered on 15 Mar 2013, 02:27 PM
Thanks very much