Telerik Radbutton click event

4 posts, 0 answers
  1. sho
    sho avatar
    24 posts
    Member since:
    Mar 2007

    Posted 17 Aug 2011 Link to this post

    Hi,

    In my aspx page i have  a function and a asp button

    function OpenForm(testId) {
                        window.radopen("TestPage.aspx?TestId=" + testId, "UsersListDialog");
                        return false;
    }


    <asp:Button ID="TestButton" runat="server" Text="Open Text Page"/>

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true" Skin="Black">
                <Windows>
                    <telerik:RadWindow ID="UsersListDialog" runat="server" Title="Test Screen" Height="490px" Width="520px" Left="150px" ReloadOnShow="false" ShowContentDuringLoad="false"
                        Modal="true" Behaviors="Close" Animation="Resize" VisibleStatusbar="false"/>
                </Windows>
            </telerik:RadWindowManager>


    In the code behing  which opens TextPage.aspx

    TestButton.OnClientClick = "return OpenForm(" + TestId + ");";


    How can I achieve the same using radbutton?

    Thanks,
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 17 Aug 2011 Link to this post

    Hello,

    Try below code.

    .......................
    protected void Button1_OnClick(object sender, EventArgs e)
            {
                RadAjaxManager1.ResponseScripts.Add("openRadWindow()");
            }

     function openRadWindow()
            {
                 var firstName = $("#<%= Button1.ClientID %>").val();
               
                 var oWnd = radopen("SetPasswordDialog.aspx?EmployeeName=" + firstName , "PasswordWindow");
           
            }
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
            <Windows>
    <telerik:RadWindow Modal="true" Width="400px" Height="200px" Behaviors="Move, Close"
                    ReloadOnShow="true" ID="PasswordWindow" runat="server" VisibleStatusbar="true"
                    NavigateUrl="SetPasswordDialog.aspx" OnClientClose="OnClientCloseSetPassword" />
            </Windows>
    </telerik:RadWindowManager>
    .................................

    Thanks,
    Jayesh Goyani
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Aug 2011 Link to this post

    Hello Sho,

    Try the following code snippet to achieve your scenario.
    C#:
    protected void btn_Click(object sender, EventArgs e)
     {
       RadButton btn = (RadButton)sender;
       btn.Attributes.Add("onclick", "window.radopen(\"Window1.aspx?userId=" + ID + "\",\"NewWindow\"); return false;");
     }

    Thanks,
    Shinu.
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3599 posts

    Posted 17 Aug 2011 Link to this post

    Hello guys,

    The correct way to attach a function to the RadButton's client-side click is to declare its name in the OnClientClicked or OnCilentClicking events. Please examine the linked articles, as they also have some examples, one of which is for opening a RadWindow as well.


    Greetings,
    Marin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top