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

RadButton will not Open RadWindow

3 Answers 131 Views
Window
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 17 Aug 2012, 07:53 PM
I’m not sure if I should be posting this issue on the Button forum or the Window forum. So if I need to post this issue somewhere else, please let me know. The following is my issue.

I have Main.aspx that has the following RadWindowManager configuration:

<
telerik:RadWindowManager ID="radWinMgr" runat="server" AutoSize="true" Behaviors="Move" BorderStyle="Solid" EnableEmbeddedBaseStylesheet="false" Modal="true" ReloadOnShow="true" ShowContentDuringLoad="false" VisibleStatusbar="false" VisibleTitlebar="true" OnClientClose="fncClientClose">
    <Windows
       <telerik:RadWindow ID="Parent1Win" runat="server" NavigateUrl="Page1.aspx"></telerik:RadWindow>
       <telerik:RadWindow ID="Parent2Win" runat="server" NavigateUrl="Page2.aspx"></telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

Main.aspx
also has 2 standard ASP buttons that will open either RadWindow defined above just fine with no problems at all. Here is one of my ASP buttons:

<
asp:Button ID="Button1" runat="server" Text="Page 1" OnClientClick="fncOpenPopup('Page1.aspx', 'Parent1Win'); return false;" />

The JavaScript function that is being called by the ASP button is as follows (notice that the function below references the RadWindowManager above):

function
fncOpenPopup(oPage, oParent) {
    alert("Click OK to open the popup window.")
    var winNew = $find("<%=radWinMgr.ClientID%>").open(oPage, oParent);
}

When the ASP button is clicked, it successfully opens the Page1 RadWindow with no problems at all.

But now I want to change the 2 standard ASP buttons and replace each of them with a RadButton. Here is what I have so far:

<
telerik:RadButton ID="NewButton1" runat="server" Text="Page 1" OnClientClicked="onClientClicked"></telerik:RadButton>

The function that this RadButton calls is as follows (notice that it simply, in turn, calls the JavaScript function defined above):

function
onClientClicked(sender, eventArgs) {
    fncOpenPopup('Page1.aspx', 'Parent1Win');
    return false;
}

When the RadButton is clicked, the alert box within fncOpenPopup() appears, and when you click OK on the alert, Main.aspx flickers once or twice, like it is trying to open the Page1 RadWindow, but then nothing happens; you are just left sitting there staring at Main.aspx.

What do I need to change to get the RadButton to successfully open the RadWindow?

Thank you,
Steven

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 20 Aug 2012, 09:51 AM
Hi,

Try setting AutoPostBack to false for the RadButton.
aspx:
<telerik:RadButton ID="NewButton1" runat="server" Text="Page 1" AutoPostBack="false"  OnClientClicked="onClientClicked"></telerik:RadButton>

Thanks,
Shinu.
0
Brian
Top achievements
Rank 1
answered on 20 Aug 2012, 12:21 PM
Thank you Shinu

Although I am not sure what to think, b/c an excluded reference to the AutoPostback property typically implies a default of False. I haven't found any documentation that would have me believe otherwise; not even in RadControls for ASP.NET AJAX Q3 2011 SP1 Documentation. However, explicitly adding AutoPostback to my RadButton with a value of false resolves my issue.

Thank you,
Steven
0
Marin Bratanov
Telerik team
answered on 21 Aug 2012, 07:34 AM
Hello Steven,

The regular ASP:Button will also perform a postback if you do not take measures to prevent it. This is why the RadButton has the same behavior. Put simply, the equivalent of the return false; statement is the AutoPostBack property. I believe the following blog post will shed more light on working with client-side events: http://blogs.telerik.com/aspnet-ajax/posts/12-08-10/migrating-onclientclick-handlers-from-asp-button-to-telerik-s-asp-net-ajax-button.aspx.


Greetings,
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
Brian
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Brian
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or