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

Telerik Radbutton click event

3 Answers 696 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sho
Top achievements
Rank 1
sho asked on 17 Aug 2011, 05:41 AM
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,

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Aug 2011, 05:52 AM
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
0
Shinu
Top achievements
Rank 2
answered on 17 Aug 2011, 08:01 AM
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.
0
Marin Bratanov
Telerik team
answered on 17 Aug 2011, 11:29 AM
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.

Tags
General Discussions
Asked by
sho
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Marin Bratanov
Telerik team
Share this question
or