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

Radmenu NavigateUrlField issue

1 Answer 80 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 09 Mar 2016, 09:12 PM

I have a menu that is bound to a data table. The data table is linked to database.The data table holds two values; RequestID and Company Name.  

What I want is to populate the menu with the company names, and pass the RequestID through the URL to a generic 'details.aspx?id=RequestID'

So what I did was set the DataNavigateUrlField equal to 'RequestID' from the datatable. 

The problem is that it makes the link to JUST the RequestID 

protected void Page_Load(object sender, EventArgs e)
{
 
    //Create datatable to populate menu
    DataTable menu = Utils.sqlutils.GetDataTable("DATABASE", "SELECT [RequestID], [CompanyName] FROM CauseMarketer_Requests WHERE Approved = '0'");
     
 
    updatingMenu.DataSource = menu;
    updatingMenu.DataNavigateUrlField = "RequestID";
    updatingMenu.DataTextField = "CompanyName";
    updatingMenu.DataBind();
 
 
}

So the DOM ends up looking like this

<a class="rmLink rmRootLink" href="19"><span class="rmText">COMPANY NAME</span></a>

What i want is the href to be "details.aspx?id=19"

 

What I've tried

updatingMenu.DataNavigateUrlField = "~details.aspx" + "RequestID";

But this causes a problem with my my databind and won't build. 

 

1 Answer, 1 is accepted

Sort by
0
Joshua
Top achievements
Rank 1
answered on 10 Mar 2016, 01:26 PM

Hi all. After searching the forums some more, I found my answer

 

protected void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e)
{
  DataRowView row = (DataRowView)e.Item.DataItem;
  e.Item.NavigateUrl = "~/Default.aspx?Menuid=" + row["menuID"].ToString();
}

Tags
Menu
Asked by
Joshua
Top achievements
Rank 1
Answers by
Joshua
Top achievements
Rank 1
Share this question
or