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

How to get RadWindow to display and close in a procedure

1 Answer 31 Views
Window
This is a migrated thread and some comments may be shown as answers.
M Patrick
Top achievements
Rank 1
M Patrick asked on 19 Jul 2012, 02:33 AM
I want to open a RadWindow when a button is clicked. I placed the code in the Button Click event on the server side. However, when the button is clicked the entire Click event is processed before the RadWIndow is displayed and the user input from that RadWIndow is captured. I want to use the User's input from the RadWindow within the Button Click event. Is this possible?
Protected Sub RadButtonBudgetSettingsEdit_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
        Dim script As String = "function f(){$find(""" + RadWindowBudgetIDNo.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, True)
'
'Based on the User's input in the RadWindow displayed above, I want to execute some code before leaving this procedure
'The user's input is captured in a Session variable.
'
'e.g.
NewSubRoutineToBeExecutedBeforeLeavingThisClickEvent(Session("UserSelectedIDNo")
 
End Sub

Currently, this button click procedure executes all the way to the End Sub before the RadWIndow is displayed.

Here is the ASPX code.
<telerik:RadWindow runat="server" ID="RadWindowBudgetIDNo" NavigateUrl="SelectBudget.aspx" Modal="true" ></telerik:RadWindow>

Thanks,
pat

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 23 Jul 2012, 09:44 AM
Hi Pat,

The user input can only be collected on the client-side, which means that all of the server-side code has already ran, the page has been processed and sent to the client. There isn't a way to get the user response during the processing of the page, you need a postback for this.

What you can do is to have a button in the RadWindow that will trigger this postback and you can handle its server-side click event to execute your custom logic instead of in the first button's click handler (RadButtonBudgetSettingsEdit_Command).

An alternative is to open the RadWindow on the client and avoid the postback originally, then you can invoke the postback via JavaScript (for a RadButton you can call the click() method from its instance, for regular buttons you can use the __doPostBack() function). More details and example about initiating a postback from buttons can be seen in this online demo and in this one.



Regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
M Patrick
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or