Hi,
I am new to Telerik and Sitefinity. I created a custom navigation widget below:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CresNavigation.ascx.cs" Inherits="SitefinityWebApp.Widgets.CresNavigation" %>
<telerik:RadMenu ID="cresRadMenu" runat="server" Skin="CrescentTopNav" EnableEmbeddedSkins="false">
<DefaultGroupSettings RepeatColumns="7" RepeatDirection="Horizontal"/>
<Items>
<telerik:RadMenuItem Text="Operate" NavigateUrl="../operate">
<Items>
<telerik:RadMenuItem>
<ItemTemplate>
<table width="100%">
<tr>
<td valign="top" rowspan="2">
<asp:Panel ID="panelInfo" runat="server" Width="300">
<asp:Label ID="litInvestInfo" runat="server" Text="We have high-quality products."></asp:Label>
<br />
<br />
<asp:ImageButton ID="imgInvestInfo" runat="server" ImageUrl="Images/icon_read_more.jpg" />
</asp:Panel>
</td>
<td valign="top">
<table width="100px">
<tr>
<td align="center">
<asp:ImageButton ID="imgBtnNews" runat="server" ImageUrl="~/Widgets/Images/icon_areas.jpg" onmouseover="this.src='Widgets/Images/icon_areas_hover.jpg'" onmouseout="this.src='Widgets/Images/icon_areas.jpg'" />
</td>
</tr>
<tr>
<td align="center">
<asp:HyperLink ID="HyperLink2" runat="server" Text="Areas" CssClass="itemTitle"></asp:HyperLink>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
</Items>
</telerik:RadMenu>
I've added this widget to Sitefinity and I am able to use it inside a page. I would to add the ability to change the text and image from within Sitefinity. I understand I need to create control designer but I am having difficulty implementing it.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Sitefinity.Web.UI.ControlDesign;
using Telerik.Web.UI;
namespace SitefinityWebApp.Widgets
{
[ControlDesigner(typeof(CresNavigationDesigner))]
public partial class CresNavigation : System.Web.UI.UserControl
{
public string CorporateInfo { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(CorporateInfo))
{
// do nothing;
}
else
{
RadMenuItem rmi = cresRadMenu.FindItemByText("Corporate");
if (rmi != null)
{
Response.Write("YEEEESSSS!!!!");
Label lCorporateInfo = rmi.FindControl("lCorporateInfo") as Label;
if (lCorporateInfo != null)
{
Response.Write("Found it!");
}
}
}
}
}
}
I can't seem to find the Label control from the code behind. I think I am approaching this wrong. Could you please help??
Thank you!
I am new to Telerik and Sitefinity. I created a custom navigation widget below:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CresNavigation.ascx.cs" Inherits="SitefinityWebApp.Widgets.CresNavigation" %>
<telerik:RadMenu ID="cresRadMenu" runat="server" Skin="CrescentTopNav" EnableEmbeddedSkins="false">
<DefaultGroupSettings RepeatColumns="7" RepeatDirection="Horizontal"/>
<Items>
<telerik:RadMenuItem Text="Operate" NavigateUrl="../operate">
<Items>
<telerik:RadMenuItem>
<ItemTemplate>
<table width="100%">
<tr>
<td valign="top" rowspan="2">
<asp:Panel ID="panelInfo" runat="server" Width="300">
<asp:Label ID="litInvestInfo" runat="server" Text="We have high-quality products."></asp:Label>
<br />
<br />
<asp:ImageButton ID="imgInvestInfo" runat="server" ImageUrl="Images/icon_read_more.jpg" />
</asp:Panel>
</td>
<td valign="top">
<table width="100px">
<tr>
<td align="center">
<asp:ImageButton ID="imgBtnNews" runat="server" ImageUrl="~/Widgets/Images/icon_areas.jpg" onmouseover="this.src='Widgets/Images/icon_areas_hover.jpg'" onmouseout="this.src='Widgets/Images/icon_areas.jpg'" />
</td>
</tr>
<tr>
<td align="center">
<asp:HyperLink ID="HyperLink2" runat="server" Text="Areas" CssClass="itemTitle"></asp:HyperLink>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
</Items>
</telerik:RadMenu>
I've added this widget to Sitefinity and I am able to use it inside a page. I would to add the ability to change the text and image from within Sitefinity. I understand I need to create control designer but I am having difficulty implementing it.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Sitefinity.Web.UI.ControlDesign;
using Telerik.Web.UI;
namespace SitefinityWebApp.Widgets
{
[ControlDesigner(typeof(CresNavigationDesigner))]
public partial class CresNavigation : System.Web.UI.UserControl
{
public string CorporateInfo { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(CorporateInfo))
{
// do nothing;
}
else
{
RadMenuItem rmi = cresRadMenu.FindItemByText("Corporate");
if (rmi != null)
{
Response.Write("YEEEESSSS!!!!");
Label lCorporateInfo = rmi.FindControl("lCorporateInfo") as Label;
if (lCorporateInfo != null)
{
Response.Write("Found it!");
}
}
}
}
}
}
I can't seem to find the Label control from the code behind. I think I am approaching this wrong. Could you please help??
Thank you!