2 Answers, 1 is accepted
0
Accepted
Hi Zed,
Please find below a sample code snippet that shows the needed approach.
ASPX:
Code-behind:
Regards,
Paul
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Please find below a sample code snippet that shows the needed approach.
ASPX:
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<asp:ScriptManager ID="ScriptManager1" runat="server"> |
</asp:ScriptManager> |
</div> |
<telerik:RadCodeBlock runat="server"> |
<script type="text/javascript"> |
function ToggleVisibility(sender, eventArgs) |
{ |
var item = eventArgs.get_item(); |
var tb = $get('<%= TextBox1.ClientID %>'); |
if(item.get_value() == "RadComboBoxItem2") |
{ |
tb.style.display = "none"; |
} |
else |
{ |
tb.style.display = "block"; |
} |
} |
</script> |
</telerik:RadCodeBlock> |
<telerik:RadComboBox ID="RadComboBox1" runat="server"> |
<Items> |
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="RadComboBoxItem1" /> |
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="RadComboBoxItem2" /> |
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" Value="RadComboBoxItem3" /> |
</Items> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
</telerik:RadComboBox> |
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> |
</form> |
</body> |
</html> |
Code-behind:
using System; |
using System.Data; |
using System.Configuration; |
using System.Collections; |
using System.Web; |
using System.Web.Security; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Web.UI.HtmlControls; |
public partial class _Default : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
RadComboBox1.OnClientSelectedIndexChanged = "ToggleVisibility"; |
} |
} |
Regards,
Paul
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Zed
Top achievements
Rank 1
answered on 05 Aug 2008, 03:00 PM
Beautiful!!!