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

Server Side Event

4 Answers 158 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jivan
Top achievements
Rank 1
Jivan asked on 29 Jul 2008, 09:36 PM
I have gone through the documentation and I think I am missing a key piece of knowledge to deal with this product.

I have a form that has two radio buttons ... if a user selects the second radio button I want a window to fire.

I have a AjaxManager running to handle the postback but I don't know how to fire the window from the selectedindex changed event.

Any help would be appreciated.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 30 Jul 2008, 07:43 AM
You should set VisibleOnPageLoad=true when ajax call occurs, or you can handle RadAjaxManager ClientEvents-OnResponseEnd client-side event and show the window via JavaScript, e.g.
ASPX:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>Untitled Page</title> 
    <script type="text/javascript">  
    function ResponseEnd(obj,args)  
    {  
         $find("RadWindow1").show();  
    }  
    </script> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
    <div> 
    <asp:RadioButtonList ID="RadioButtonList1" runat="server" 
    AutoPostBack="true" 
    OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">  
        <asp:ListItem Text="Item1" Selected="True"></asp:ListItem> 
        <asp:ListItem Text="Item2"></asp:ListItem> 
        <asp:ListItem Text="Item3"></asp:ListItem> 
        <asp:ListItem Text="Item4"></asp:ListItem> 
    </asp:RadioButtonList> 
    <asp:Label ID="Label1" runat="server"></asp:Label> 
  <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"   
  ClientEvents-OnResponseEnd="ResponseEnd">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadioButtonList1" EventName="SelectedIndexChanged">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="Label1" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadWindow2" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="http://www.google.com" 
    VisibleOnPageLoad="false" Left="100"></telerik:RadWindow> 
    <telerik:RadWindow ID="RadWindow2" runat="server" NavigateUrl="http://www.yahoo.com" 
    VisibleOnPageLoad="false" Left="300">  
    </telerik:RadWindow> 
    </div> 
    </form> 
</body> 
</html> 
C#:
 protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)  
    {  
        Label1.Text = System.DateTime.Now.ToString();  
        RadWindow2.VisibleOnPageLoad = true;  
    } 
Hope this helps
0
Jivan
Top achievements
Rank 1
answered on 30 Jul 2008, 08:26 AM
Thanks Obi-Wan,

The example worked great.  However I only want to fire the popup window when the select a particular item in the radio button list.

Should I simply set VisibleonPageload = True for the radio button item I want and false for all other events?

Thanks.

0
Accepted
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 30 Jul 2008, 08:42 AM
I created a simple example which illustrates how to show RadWindow only when the selected item is with text = "Item2"
ASPX:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
    <div> 
    <asp:RadioButtonList ID="RadioButtonList1" runat="server" 
    AutoPostBack="true" 
    OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">  
        <asp:ListItem Text="Item1" Selected="True"></asp:ListItem> 
        <asp:ListItem Text="Item2"></asp:ListItem> 
        <asp:ListItem Text="Item3"></asp:ListItem> 
        <asp:ListItem Text="Item4"></asp:ListItem> 
    </asp:RadioButtonList> 
    <asp:Label ID="Label1" runat="server"></asp:Label> 
  <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadioButtonList1" EventName="SelectedIndexChanged">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="Label1" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadWindow2" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <telerik:RadWindow ID="RadWindow2" runat="server" NavigateUrl="http://www.yahoo.com" 
    VisibleOnPageLoad="false" Left="300">  
    </telerik:RadWindow> 
    </div> 
    </form> 
</body> 
</html> 
 
C#:
 protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)  
    {  
        Label1.Text = System.DateTime.Now.ToString();  
        RadWindow2.VisibleOnPageLoad = false;  
        if (RadioButtonList1.SelectedItem.Text == "Item2")  
        {  
            RadWindow2.VisibleOnPageLoad = true;  
        }  
    } 
Hope this helps!
0
Jivan
Top achievements
Rank 1
answered on 30 Jul 2008, 08:45 AM
Thanks ... I guess I asked before I tried ...

Everything works now ... I apprecaite your help.


Tags
Window
Asked by
Jivan
Top achievements
Rank 1
Answers by
Obi-Wan Kenobi
Top achievements
Rank 1
Jivan
Top achievements
Rank 1
Share this question
or