Need help converting VB CTYPE to equivalent C# for toolbar navigateurl property

2 posts, 1 answers
  1. Tomica
    Tomica avatar
    147 posts
    Member since:
    Apr 2008

    Posted 27 Jul 2015 Link to this post

    I am converting a VB application to C#.

     As a novice in C#, I have a very basic question on how to deal with ToolBar settings.

    The first line works in VB.

     The second line is as close as I get but I am stumped with how to indicate the NavigateUrl portion.


    CType(Me.RadToolBar1.Items(toolbar_current), Telerik.Web.UI.RadToolBarButton).NavigateUrl = "lulavision.aspx?show=" & Show_Alias.ToString
    (Telerik.Web.UI.RadToolBarButton)RadToolBar1.Items[Toolbar_Current] = "lulavision.aspx?show=" + Show_Alias;

  2. Answer
    Aneliya Petkova
    Aneliya Petkova avatar
    207 posts

    Posted 30 Jul 2015 Link to this post

    Hello Tomica,

    If you put the RadToolBarButton in brackets, this should do the trick:
    ((Telerik.Web.UI.RadToolBarButton)RadToolBar1.Items[Toolbar_Current]).NavigateUrl = "lulavision.aspx?show=" + Show_Alias;

    Another way to cast the item to RadToolBarButton(because only RadToolBarButtons have NavigateUrl) is the following:
    var button = RadToolBar1.Items[0] as RadToolBarButton;
    button.NavigateUrl = "";

    Attached you may find a sample project.
    Hope this will be helpful.

    Aneliya Petkova
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top