RadMenu Click event always triggered on Page Refresh

5 posts, 0 answers
  1. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 16 Jan 2012 Link to this post

    Hi All,

    i am using a RadMenu on my page and i am handling its click event from server side...

    when i click on of the item i open another page in rad window ...

    all is ok and the window is opened successfully.... i do what i need there and close it...

    BUT

    i noticed when i refresh the page that holds the radmenu, the click event is called again and the RadWindow is opened again!!!

    how can i avoid this from happening!!!

    Best Regards
    Asa'ad
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Jan 2012 Link to this post

    Hello Asaad,

    The following forum link explains the same scenario.
    Stop RadWindow from always loading on page postback.

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 16 Jan 2012 Link to this post

    Hi princy...

    it is not the problem of calling the rad window...
    my point is if i do anything in the menu item click event, it will be done again since the click event is always called on the post back???

    hope i cleared the problem!!!
  5. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 18 Jan 2012 Link to this post

    can anyone help me please...
  6. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 19 Jan 2012 Link to this post

    Hi Asa'ad,

    I tested you scenario with the following code and when I refresh the page none of the two server-side events is triggered:
    protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
    {
        Label1.Text = "MenuItem is clicked";
    }
    protected void button1_Click(object sender, EventArgs e)
    {
        Label1.Text = "Button1 is clicked";
    }

    markup
    <telerik:RadMenu ID="RadMenu1" runat="server" OnItemClick="RadMenu1_ItemClick">
            <Items>
                <telerik:RadMenuItem Text="item0" />
                <telerik:RadMenuItem Text="item1" />
                <telerik:RadMenuItem Text="item2" />
                <telerik:RadMenuItem Text="item3">
                    <Items>
                        <telerik:RadMenuItem Text="item0" />
                        <telerik:RadMenuItem Text="item1" />
                        <telerik:RadMenuItem Text="item2" />
                        <telerik:RadMenuItem Text="item3" />
                    </Items>
                </telerik:RadMenuItem>
            </Items>
        </telerik:RadMenu>
        <br />
        <br />
        <asp:Label runat="server" ID="Label1" Text="label1"></asp:Label>
        <br />
        <telerik:RadButton runat="server" ID="button1" Text="Button1" OnClick="button1_Click">
        </telerik:RadButton>

    However, I could suggest that you try calling the RadWindow control using the client-side and the OnClientItemClicking event of the RadMenu.

    Regards,
    Kate
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017