How create control designer from custom radmenu?

2 posts, 0 answers
  1. Christina
    Christina avatar
    1 posts
    Member since:
    May 2013

    Posted 31 May 2013 Link to this post

    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!
  2. Pavel Benov
    Admin
    Pavel Benov avatar
    2 posts

    Posted 04 Jun 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top