Using the codeless method for opening a RadWindow (A confirmation window), I was surprised to learn that even when my OpenerElementID (an asp:LinkButton) is disabled, a click still opens the confirmation window.
Consider a wizard where the finish button is not enabled until several steps have been done, and then I want to confirm submission. Yet while the finish button is disabled, and won't postback, it still will open the radwindow, which does postback the disabled button.
What is the proper way to change this? I tried LinkButton.Attributes["onclick"]="return false;" but that doesn't change the behavior. If it matters, this control is a user control (ascx).
Thanks,
Tim
Consider a wizard where the finish button is not enabled until several steps have been done, and then I want to confirm submission. Yet while the finish button is disabled, and won't postback, it still will open the radwindow, which does postback the disabled button.
What is the proper way to change this? I tried LinkButton.Attributes["onclick"]="return false;" but that doesn't change the behavior. If it matters, this control is a user control (ascx).
Thanks,
Tim
<telerik:RadWindowManager ID="RadWindowManager" runat="server"> |
<Windows> |
<telerik:RadWindow OpenerElementID="<%# WizardCancelButton.ClientID %>" OffsetElementID="<%# WizardCancelButton.ClientID %>" |
Top="-350px" Left="-400px" Width="400px" Height="300px" NavigateUrl="~/WizardConfirmCancel.aspx" |
KeepInScreenBounds="true" Modal="true" Behaviors="Close" OnClientClose="OnClientClose" |
VisibleStatusbar="false" runat="server" ID="RadWindowConfirmCancel"> |
</telerik:RadWindow> |
<telerik:RadWindow OpenerElementID="<%# WizardFinishButton.ClientID %>" OffsetElementID="<%# WizardFinishButton.ClientID %>" |
Top="-350px" Left="-400px" Width="400px" Height="300px" NavigateUrl="~/WizardConfirmFinish.aspx" |
KeepInScreenBounds="true" Modal="true" Behaviors="Close" OnClientClose="OnClientClose" |
VisibleStatusbar="false" runat="server" ID="RadWindowConfirmFinish"> |
</telerik:RadWindow> |
</Windows> |
</telerik:RadWindowManager> |
<div class="WizardNextPreviousFinishCancel"> |
<asp:LinkButton ID="WizardCancelButton" runat="server" OnCommand="WizardCommand" |
CommandName="Cancel" CommandArgument="<%# SourceWizard %>" Visible="true"><img style="border:0px;vertical-align:middle;" alt="" src="images/wizard/cancel.png" /> Cancel</asp:LinkButton> |
<asp:LinkButton ID="WizardFinishButton" runat="server" OnCommand="WizardCommand" |
CommandName="Finish" CommandArgument="<%# SourceWizard %>" Visible="true"><img style="border:0px;vertical-align:middle;" alt="" src="images/wizard/finish.png" /> Finish</asp:LinkButton> |
</div> |
9 Answers, 1 is accepted
0
Hello Tim,
I strongly recommend not to use the OpenerElementId property in such scenario - it is intended to be used in simple scenarios only - for example when you want to open a RadWindow popup by clicking on some element.
In cases where there is a complex logic, AJAX involved, etc., I strongly recommend to use either the Client-Side (radopen(), show()) or the Server-Side API (VisibleOnPageLoad=true) for opening the RadWindow.
All the best,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I strongly recommend not to use the OpenerElementId property in such scenario - it is intended to be used in simple scenarios only - for example when you want to open a RadWindow popup by clicking on some element.
In cases where there is a complex logic, AJAX involved, etc., I strongly recommend to use either the Client-Side (radopen(), show()) or the Server-Side API (VisibleOnPageLoad=true) for opening the RadWindow.
All the best,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tim
Top achievements
Rank 1
answered on 16 Sep 2008, 04:20 PM
For some unknown reason, none of these other options work. I wonder if perhaps it is because the showing of the window comes from a user control (.ascx)? I always get some sort of javascript error - either the window has no properties:
this._windows has no properties
Tim
this._windows has no properties
this._windows[this._windows.length]=wnd;
something like that. Following one of the help examplesI got something like "_27 has no properties" while looking at some array of windows.
How do I fix this? I'm trying hard to polish up the app by the end of the month and I'm running into a bunch of little gotchas now...
Thanks,something like that. Following one of the help examplesI got something like "_27 has no properties" while looking at some array of windows.
How do I fix this? I'm trying hard to polish up the app by the end of the month and I'm running into a bunch of little gotchas now...
<script language="javascript"> |
function OnClientClose(oWnd) |
{ |
//get the transferred arguments |
var arg = oWnd.argument; |
if (arg && arg.value) { |
// alert("You said '" + arg.value + "'"); |
if (arg.value == "DISCARD") { |
__doPostBack("<%= WizardCancelButton.UniqueID %>", ""); |
} |
else if (arg.value == "SAVE") { |
__doPostBack("<%= WizardFinishButton.UniqueID %>", ""); |
} |
else if (arg.value == "RUN") { |
__doPostBack("<%= WizardRunButton.UniqueID %>", ""); |
} |
} |
oWnd.argument = null; |
} |
function ShowConfirmWindow() { |
var oManager = GetRadWindowManager(); |
alert("oManager = {" + oManager + "}"); |
oManager.open(null, "<%= RadWindowConfirmFinish.ID %>"); |
return false; |
} |
</script> |
<telerik:RadWindowManager ID="RadWindowManager" runat="server"> |
<Windows> |
<telerik:RadWindow OpenerElementID="<%# WizardCancelButton.ClientID %>" OffsetElementID="<%# WizardCancelButton.ClientID %>" |
Top="-350px" Left="-400px" Width="400px" Height="300px" NavigateUrl="~/WizardConfirmCancel.aspx" |
KeepInScreenBounds="true" Modal="true" Behaviors="Close" OnClientClose="OnClientClose" |
VisibleStatusbar="false" runat="server" ID="RadWindowConfirmCancel"> |
</telerik:RadWindow> |
<telerik:RadWindow OffsetElementID="<%# WizardFinishButton.ClientID %>" |
Top="-350px" Left="-400px" Width="400px" Height="300px" NavigateUrl="~/WizardConfirmFinish.aspx" |
KeepInScreenBounds="true" Modal="true" Behaviors="Close" OnClientClose="OnClientClose" |
VisibleStatusbar="false" runat="server" ID="RadWindowConfirmFinish"> |
</telerik:RadWindow> |
</Windows> |
</telerik:RadWindowManager> |
Tim
0
Tim
Top achievements
Rank 1
answered on 16 Sep 2008, 05:04 PM
UPDATE: Making this code standalone (aspx) makes it work as desired and expected, so it must be related to the .ascx usage.
Tim
Tim
0
Accepted
Hello Tim,
I assume that you are using Ajax for showing this user control, am I right? There is a known problem (discussed in several threads in this forum) when radopen/radalert/radconfirm/radprompt are called after the RadWindowManager is being ajaxified or shown with Ajax. The reason for the problem is that these functions search for the original RadWindowManager and cannot work with the ajaxified one.
To resolve this, you can use the following approaches:
All the best,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I assume that you are using Ajax for showing this user control, am I right? There is a known problem (discussed in several threads in this forum) when radopen/radalert/radconfirm/radprompt are called after the RadWindowManager is being ajaxified or shown with Ajax. The reason for the problem is that these functions search for the original RadWindowManager and cannot work with the ajaxified one.
To resolve this, you can use the following approaches:
- Put the RadWindowManager in the parent page - if it is used only on the client, there is no need for it to be ajaxified.
OR - Use VisibleOnPageLoad=true for showing the windows - you should not have problems in this scenario.
All the best,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tim
Top achievements
Rank 1
answered on 17 Sep 2008, 02:11 PM
Ajax is used to show the control (RadMultiPage) which includes the user control. The user control is the Previous Next Finish buttons of a wizard, and the RadTabStrip are the wizard steps. The Next button asks "what tab am I on, and sets the next one active", etc.
The finish button is conditionally disabled/enabled on postback so that when the mandatory questions are answered the finish button is enabled. Unfortunately, even while disabled, the RadWindow opens when done in the declarative (codeless manner.)
To your two points:
1. Putting the RadWindowManager on the parent page breaks encapsulation - I want to keep the control self-contained. Parent pages implement an interface IWizard which gives the ascx control all the access it needs to figure out when to enable finish, among other things.
2. Visible on page load does not make sense from a business logic perspective - the RadWindow would open before the user presses finished.
I will work on a standalone example and post it here later today.
Tim
The finish button is conditionally disabled/enabled on postback so that when the mandatory questions are answered the finish button is enabled. Unfortunately, even while disabled, the RadWindow opens when done in the declarative (codeless manner.)
To your two points:
1. Putting the RadWindowManager on the parent page breaks encapsulation - I want to keep the control self-contained. Parent pages implement an interface IWizard which gives the ascx control all the access it needs to figure out when to enable finish, among other things.
2. Visible on page load does not make sense from a business logic perspective - the RadWindow would open before the user presses finished.
I will work on a standalone example and post it here later today.
Tim
0
OK Tim,
I will expect your project - please send it as a support ticket as you cannot attach files in the forums. We will examine it and try to find a solution for you.
Best wishes,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I will expect your project - please send it as a support ticket as you cannot attach files in the forums. We will examine it and try to find a solution for you.
Best wishes,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tim
Top achievements
Rank 1
answered on 17 Sep 2008, 07:21 PM
Ticket #162575 has been generated.
Tim
Tim
0
OK Tim,
I will check it today and get back to you.
Sincerely yours,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I will check it today and get back to you.
Sincerely yours,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tim
Top achievements
Rank 1
answered on 18 Sep 2008, 05:42 PM
I was able to resolve this as you suggest, by having the finish button postback and then set VisibleOnPageLoad true on the RadWindow.
It's not ideal, but it works.
Tim
It's not ideal, but it works.
Tim