Dynamic DataNavigateUrlField and base url?

4 posts, 1 answers
  1. Jochem Bökkers
    Jochem Bökkers avatar
    11 posts
    Member since:
    Aug 2007

    Posted 20 May 2010 Link to this post

    Hi,

    I'm using a RadTreeView.DataNavigateUrlField to fetch not a full url from a database but a querystring value. Is it possible to set a 'base-url' instead of the RadTreeView automatically using the current location ?

    For Example:
    In the database the field 'CategoryId' has the value's 1,2,4,5 and 7.
    In the code I'm using  
    treeView.DataNavigateUrlField = "CategoryId" 

    to bind the database column. Now when I click a node, it shouldn't go to 'http://www.currentlocation.currentdoc.aspx/1' but 'http://www.differentlocation/differentdoc.aspx?CId=1'

    Thanks,
    Jochem.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 May 2010 Link to this post

    Hi Jochem,

    Try the following code in NodeDataBound event and see whether it helps.

    C#:
     
        protected void RadTreeView2_NodeDataBound(object sender, RadTreeNodeEventArgs e)  
        {  
            e.Node.NavigateUrl = "http://www.differentLocation/differentdoc.aspx?Cid="+ e.Node.NavigateUrl.ToString();  
        } 

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jochem Bökkers
    Jochem Bökkers avatar
    11 posts
    Member since:
    Aug 2007

    Posted 21 May 2010 Link to this post

    Hey Princy,

    It works like a charm, thanks. 
    I over looked the OnNodeDatabound and couldn't get the Node.NavigateUrl to work dynamically after rendering.
  5. Sandeep Gupta
    Sandeep Gupta avatar
    1 posts
    Member since:
    Apr 2009

    Posted 17 May 2012 Link to this post

    Hi,

    Thank you this solution.

    Thank,
    Sandeep Gupta
    Team Leader
    IDS Logic Pvt Ltd.
Back to Top