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

Can not get OnItemClick event to fire

4 Answers 103 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Antonio
Top achievements
Rank 1
Antonio asked on 01 Jun 2011, 01:22 AM
Hello,

I want to load item data in RadMenu by using a SQL query, when testing the below code I can stop at a break point in
RadMenu1_ItemDataBound but not stopping in RadMenu1_ItemClick, I'm wondering what to do in order to be able
to fire OnItemClick. I Don't know what is wrong, please help...

<
telerik:RadMenu ID="RadMenu1" runat="server" Width="100%" style="margin-bottom:2px"
             EnableRoundedCorners="True" EnableShadows="True"
             DataSourceID="SqlDataSource1" 
             DataFieldID="MenuID" DataFieldParentID="ParentID" 
             DataTextField="FieldText" DataValueField="Page" 
             OnItemClick="RadMenu1_ItemClick" onitemdatabound="RadMenu1_ItemDataBound">           
     </telerik:RadMenu>
  
 protected void RadMenu1_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e)
        {
            if (Request.IsAuthenticated)
            {
                string value=e.Item.Value.ToString();
                Telerik.Web.UI.RadPane topPane = (Telerik.Web.UI.RadPane)HeadLoginView.FindControl("topPane");
                string[] arreglo = value.Split('?');
                topPane.ContentUrl = arreglo[0];
                Telerik.Web.UI.RadPane paneContent = (Telerik.Web.UI.RadPane)HeadLoginView.FindControl("contentPane");
                paneContent.ContentUrl = "Blank.aspx";
                if (value.IndexOf('?') > 0)
                {
                    if (arreglo[1] == "clp=1")
                    {
                        paneContent.Collapsed = true;
                    }
                    else
                    {
                        paneContent.Collapsed = false;
                    }
                }
                else
                {
                    paneContent.Collapsed = false;
                }
                  
            }
  
  
        }
  
        protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
        {
            e.Item.Value = e.Item.NavigateUrl;
            e.Item.NavigateUrl = "";  
  
        }


Thanks
Antonio

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Jun 2011, 08:16 AM
Hello Antonio,

There are two reasons for not getting the server-side OnItemClick event fired:

  • You have not subscribed to the OnItemClick event.
  • You have set the NavigateUrl property of the menu item.
Also take a look at the following help document.
ItemClick event is not fired.
Thanks,
Shinu.
0
Antonio
Top achievements
Rank 1
answered on 01 Jun 2011, 06:38 PM
Hello Shinu,

Thank you for your reply, as you can see in my code both items covered. Previously each of the menu items were hardcoded and onclick event was working well ,now I read data from db and onclick is not working is there any issue you can see from my code?

Thanks
Antonio
0
Antonio
Top achievements
Rank 1
answered on 03 Jun 2011, 12:56 AM
Hello,

Any advice? Please help I've spent several hours trying to solve this.

Thanks
Antonio
0
Veronica
Telerik team
answered on 03 Jun 2011, 07:53 AM
Hi Antonio,

I've already answered you in this forum post. I suggest that we keep the conversation there to prevent confusement.

P.S: Please do not open more than one thread per issue. We are doing our best to asnwer all your questions.

Greetings,
Veronica Milcheva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Menu
Asked by
Antonio
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Antonio
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or