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

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

1 Answer 83 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Tomica
Top achievements
Rank 2
Tomica asked on 28 Jul 2015, 12:41 AM

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;

1 Answer, 1 is accepted

Sort by
0
Accepted
Aneliya Petkova
Telerik team
answered on 30 Jul 2015, 07:01 AM
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 = "http://www.telerik.com/community";

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

Regards,
Aneliya Petkova
Telerik
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
Tags
ToolBar
Asked by
Tomica
Top achievements
Rank 2
Answers by
Aneliya Petkova
Telerik team
Share this question
or