This is a migrated thread and some comments may be shown as answers.

How can i fire Cleint-Side events in WebUserCotnrol

1 Answer 46 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Hakan Tüzün
Top achievements
Rank 1
Hakan Tüzün asked on 04 Jul 2008, 12:40 PM
Hi,

I'm using RadComboBox in a Web User Control. When I drop the Web UserControl on a page, I can not use Client-Side RadComboBox events such as "OnClientDropDownClosing".

I know that I must handle this event within the UserControl, but how can I triger a custom event for the page then?

With Server-Side events, I do not have problem,

Kind Regards,

Hakan

1 Answer, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 07 Jul 2008, 08:14 AM
Hi Hakan,

Please find below a sample code snippet that shows the needed approach.

Default.aspx:
<form runat="server" id="mainForm" method="post">  
    <asp:ScriptManager ID="ScriptManager" runat="server" /> 
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
    <uc1:WebUserControl ID="WebUserControl1" runat="server" /> 
</form> 

WebUserControl.ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<script type="text/javascript">  
function ChangeText(sender, eventArgs)  
{  
    var item = eventArgs.get_item();  
    var myTxtBox = $get('<%= ((TextBox)Page.FindControl("TextBox1")).ClientID %>');  
    myTxtBox.value = item.get_text();  
}  
</script> 
 
<telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientSelectedIndexChanged="ChangeText">  
    <CollapseAnimation Duration="200" Type="OutQuint" /> 
    <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" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4" Value="RadComboBoxItem4" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem5" Value="RadComboBoxItem5" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem6" Value="RadComboBoxItem6" /> 
    </Items> 
</telerik:RadComboBox> 
 


All the best,
Paul
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox
Asked by
Hakan Tüzün
Top achievements
Rank 1
Answers by
Paul
Telerik team
Share this question
or