Radmenu NavigateUrlField issue

2 posts, 0 answers
  1. Joshua
    Joshua avatar
    6 posts
    Member since:
    Oct 2014

    Posted 09 Mar Link to this post

    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. 

     

  2. Joshua
    Joshua avatar
    6 posts
    Member since:
    Oct 2014

    Posted 10 Mar in reply to Joshua Link to this post

    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();
    }

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top