You can try like this
<telerik:radtoolbar id="radToolBarID" runat="server" cssclass="toolbar">
<items>
<telerik:radtoolbarbutton navigateurl="~/default.aspx" postback="false" text="Goto Default Page" causesvalidation="false">
<telerik:radtoolbarbutton navigateurl="~/HomePage.aspx" postback="false" text="Goto Home Page" causesvalidation="false">
</items>
</telerik:radtoolbar>
If you want to use the INLINE code in NavigateURl from codebehind file..it wont work ..see this example for asp:Hyperlink
<asp:HyperLink runat="server" ID="hmURL" NavigateUrl='<%#this.homePageURL%>' Text="Home"></asp:HyperLink>
In codebehind.cs
protected void Page_Load(object sender, EventArgs e)
{
homePageURL = "~/projectFolder/homePage.aspx";
}
<%#this.homePageURL%> this is the inline code used to get the value from the codebehind but samething cant be used in Telerik RadToolBar's radtoolbarbutton->NavigateURL
So we have to use it in the codebehind like this and in the aspx file remove the navigateURL
<telerik:radtoolbar id="radToolBarID" runat="server" cssclass="toolbar">
<items>
<telerik:radtoolbarbutton navigateurl="~/default.aspx" postback="false" text="Goto Default Page" causesvalidation="false">
<telerik:radtoolbarbutton postback="false" text="Goto Home Page" causesvalidation="false">
</telerik:radtoolbarbutton>
</telerik:radtoolbarbutton>
codeBehind.cs
public string homePageURL;
protected void Page_Load(object sender, EventArgs e)
{
homePageURL = "~/projectFolder/homePage.aspx";
Telerik.Web.UI.RadToolBarButton radToolBarBtn = (Telerik.Web.UI.RadToolBarButton)radToolBarID.FindItemByText("Goto Home Page");
radToolBarBtn.NavigateUrl = homePageURL;
}
THanks for this - solved a problem of dynamically updating URL Navigate links.
ReplyDelete