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

Radbutton Requires two clicks to open RadWindow

2 Answers 217 Views
Button
This is a migrated thread and some comments may be shown as answers.
GP
Top achievements
Rank 1
GP asked on 06 Apr 2011, 04:31 PM
Hi, I have a RadButton that is supposed to open a radwindow when the "OnClientClicked" is fired.  However, the first time this gets fired, nothing happens.  The second time I click on the button...the radwindow opens up.  Am I missing some code?  I am basing this on your demo: http://demos.telerik.com/aspnet-ajax/button/examples/slideshow/defaultcs.aspx.

Here is the code that I have:
    <telerik:RadCodeBlock ID="rcb1" runat="server">
    <script type="text/javascript">
        function ShowInsertForm() {
            var combo = $find("<%= RadComboBox1.ClientID %>");
            var comboItem = combo.get_selectedItem();
            if (!comboItem) {
                window.radopen("AddComment.aspx", "UserListDialog");
            }
            else {
                var string = comboItem.get_text();
                window.radopen("AddComment.aspx?ID=" + comboItem.get_value(), "UserListDialog");
            }
            return false;
        }
    </script>
</telerik:RadCodeBlock>
 
<telerik:RadButton ID="AddComment" runat="server"
                        AutoPostBack="false" Text="Add Comment" CommandName="Right" OnClientClicked="ShowInsertForm">
                    </telerik:RadButton>
    <telerik:RadButton runat="server" ID="btnUpdate" Skin="WebBlue" Text="Update Recipient"></telerik:RadButton>
    </div>
    </telerik:RadAjaxPanel>
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true" Skin="WebBlue">
                <Windows>
                    <telerik:RadWindow ID="UserListDialog" runat="server" Title="Add Comment" Width="755px" Height="460px"
                        ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" />
                </Windows>
        </telerik:RadWindowManager>


I can use a plain old button, and it fires off without a second click, but I would really like to use the radbutton since that will keep my styling the same.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 06 Apr 2011, 05:58 PM
ShowInsertForm should have the definition of ShowInsertForm(sender, args) I believe is the first thing...

You also don't need to return anything if AutoPostBack is false, and I would recommended doing it in the ClickING event (not ClickED)as you can cancel the click event if the combo doesnt have an item in it (or whatever else...)

If both of those fail, startup Firefox\Firebug and check the console tab for script errors.
0
GP
Top achievements
Rank 1
answered on 06 Apr 2011, 06:00 PM
Yep...I found that right as you were replying.  Thank you.  I changed ShowInsertForm to ShowInsertForm(), and it worked just fine.

It's the little things that always get ya.

Thanks!
Tags
Button
Asked by
GP
Top achievements
Rank 1
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
GP
Top achievements
Rank 1
Share this question
or