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

How create control designer from custom radmenu?

1 Answer 43 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Christina
Top achievements
Rank 1
Christina asked on 31 May 2013, 09:08 PM
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!

1 Answer, 1 is accepted

Sort by
0
Pavel Benov
Telerik team
answered on 04 Jun 2013, 01:30 PM
Hello Christina,

Try using Sitefinity Thunder in order to create Designer for already existing widget.

Regards,
Pavel Benov
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Menu
Asked by
Christina
Top achievements
Rank 1
Answers by
Pavel Benov
Telerik team
Share this question
or