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

RadMenu Click event always triggered on Page Refresh

4 Answers 236 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Asa'ad
Top achievements
Rank 1
Asa'ad asked on 16 Jan 2012, 01:51 PM
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

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Jan 2012, 02:34 PM
Hello Asaad,

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

Thanks,
Princy.
0
Asa'ad
Top achievements
Rank 1
answered on 16 Jan 2012, 02:43 PM
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!!!
0
Asa'ad
Top achievements
Rank 1
answered on 18 Jan 2012, 08:15 AM
can anyone help me please...
0
Kate
Telerik team
answered on 19 Jan 2012, 11:38 AM
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
Tags
Menu
Asked by
Asa'ad
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Asa'ad
Top achievements
Rank 1
Kate
Telerik team
Share this question
or