I am trying to get the root menu items (i.e. Menu items like File, Edit, etc.) to support the navigateurl property. I am setting the navigateurl property, but the control does nothing when I click on it. Is there something special that I need to do?
BH
Bhuvana
Syncfusion Team
October 9, 2006 10:15 AM UTC
Hi Carlos,
Herewith attached is a sample that illustrates how to set navigate url for root items.
Menu Sample Regards,
Bhuvana
DI
do i have to
October 10, 2006 05:34 PM UTC
Thanks, that should do it. It would be nice if the control exposed a property for this so that one doesn''t have to resort to having to write client-side code to attach to the onclick event and change the url in a future version.
Thanks again,
Carlos
DI
do i have to
October 10, 2006 05:34 PM UTC
Thanks, that should do it. It would be nice if the control exposed a property for this so that one doesn''t have to resort to having to write client-side code to attach to the onclick event and change the url in a future version.
Thanks again,
Carlos
DI
do i have to
October 10, 2006 05:34 PM UTC
Thanks, that should do it. It would be nice if the control exposed a property for this so that one doesn''t have to resort to having to write client-side code to attach to the onclick event and change the url in a future version.
Thanks again,
Carlos
DI
do i have to
October 10, 2006 05:34 PM UTC
Thanks, that should do it. It would be nice if the control exposed a property for this so that one doesn''t have to resort to having to write client-side code to attach to the onclick event and change the url in a future version.
Thanks again,
Carlos
DI
do i have to
October 10, 2006 05:34 PM UTC
Thanks, that should do it. It would be nice if the control exposed a property for this so that one doesn''t have to resort to having to write client-side code to attach to the onclick event and change the url in a future version.
Thanks again,
Carlos
AD
Administrator
Syncfusion Team
October 10, 2006 09:44 PM UTC
Hi Bhuvana,
How do you recommend handling the scenario where the NavigateUrl for the MenuItem is dynamic? In your sample, you''ve hardcoded the string in the javascript; however, our url will depend on the environment the application is currently deployed at, so we can''t hardcode the url.
Thanks,
Carlos
BH
Bhuvana
Syncfusion Team
October 11, 2006 07:51 AM UTC
Hi Carlos,
We can dynamically assign the NavigateUrl for the root menu items by passing as paramater to the client. Please refer to the attached sample.
Menu SampleRegards,
Bhuvana
DI
do i have to
October 11, 2006 10:58 AM UTC
Hi Bhuvana,
Thanks for the sample; however, I don''t think it''ll work in our case. We have more than one root item. In your sample, there is only one, Product, and since the client side event handler is a property of the Menu, I can only provide one Url.
You have this in the sample (shortened).
Syncfusion.Web.UI.WebControls.Tools.Menu menu1 = new Syncfusion.Web.UI.WebControls.Tools.Menu();
menu1.ID = "menu1";
menu1.ClientSideOnItemMouseOver = "OnMenuMouseOver(this,''Default.aspx'')";
MenuItem product = new MenuItem();
product.Text = "Product";
product.ID = "Product";
menu1.Items.Add(product);
MenuItem grid = new MenuItem();
grid.Text = "Essential Grid";
product.Items.Add(grid);
What I need is something like this...
Syncfusion.Web.UI.WebControls.Tools.Menu menu1 = new Syncfusion.Web.UI.WebControls.Tools.Menu();
menu1.ID = "menu1";
// Because the event handler is set here
// I can only provide one url. In your sample
// It is Default.aspx; however, what if you
// have multiple root items?
menu1.ClientSideOnItemMouseOver = "OnMenuMouseOver(this,''Default.aspx'')";
MenuItem product = new MenuItem();
product.Text = "Product";
product.ID = "Product";
menu1.Items.Add(product);
MenuItem grid = new MenuItem();
grid.Text = "Essential Grid";
product.Items.Add(grid);
// Here''s my second root item. How do I provide
// a url for this guy?
MenuItem support = new MenuItem();
product.Text = "Support";
product.ID = "Support";
menu1.Items.Add(support);
MenuItem anotherGrid = new MenuItem();
anotherGrid.Text = "Essential Grid";
product.Items.Add(anotherGrid);
....
One thought is that I could do this:
menu1.ClientSideOnItemMouseOver = "OnMenuMouseOver(this,''Default.aspx'', ''Support.aspx'')";
But we have several root items and this is very brittel since it leads our client side script to be something like:
var bMouseClickAttached = false;
var bMouse2ClickAttached = false;
function OnMenuMouseOver( oData, url , url2 ) {
if (oData.ID == "Product" && !bMouseClickAttached) {
oData.Element.onclick=function(){ OnClick(url)};
bMouseClickAttached = true;
}
if (oData.ID == "Support" && !bMouse2ClickAttached) {
oData.Element.onclick=function(){ OnClick(url2)};
bMouseClickAttached = true;
}
// So on and so on for each root menu item...
}
This approach looks like it will be a maintenance nightmare for us. Is there a cleaner approach?
Thanks,
Carlos