RadMenu Vs ItemTamplate

2 posts, 0 answers
  1. Jose Luiz Borges
    Jose Luiz Borges avatar
    10 posts
    Member since:
    Jun 2009

    Posted 10 Aug 2009 Link to this post

    Hi,

    I need help...

    this is my code in aspx:

            <telerik:RadMenu ID="RadMenu1" runat="server">
                <Items>
                    <telerik:RadMenuItem>
                        <ItemTemplate>
                            <b>Skin:</b>
                            <telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Hay" ShowChooser="True">
                            </telerik:RadSkinManager>
                        </ItemTemplate>
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadMenu>

    i need take the value into in RadSkinManager1.Skin...

    I try this code into CS;
            Session["skinid"] = ((RadSkinManager)RadMenu1.FindControl("RadSkinManager1")).Skin;

    Object reference not set to an instance of an object.


    But dont't work, if i run CTRL+F5 in my screen show...

    Line 13: 		{
    Line 14: 			RadSkinManager skin = (RadSkinManager)RadMenu1.Controls[0].FindControl("RadSkinManager1"); 		    
    Line 15: 			Session["skinid"] = skin.Skin;
    Line 16: 		}
    Line 17: 		void Page_PreRender(object sender, EventArgs e)



    My question is ?

    How get de value (Skin) the component RadSkinManager, but this component into in ITEMTAMPLATE for radmenu...


    tanks and best regards







  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 13 Aug 2009 Link to this post

    Hi Jose Luiz Borges,

    Here's your modified code snippet that works as expected

    ASPX:
    <telerik:RadMenu ID="RadMenu1" runat="server"
            <Items> 
                <telerik:RadMenuItem Value="templateHolder"
                    <ItemTemplate> 
                        <b>Skin:</b> 
                        <telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Hay" ShowChooser="True"
                        </telerik:RadSkinManager> 
                    </ItemTemplate> 
                </telerik:RadMenuItem> 
            </Items> 
        </telerik:RadMenu> 

            Session["skinid"] = ((RadSkinManager)RadMenu1.FindItemByValue("templateHolder").FindControl("RadSkinManager1")).Skin; 
        } 

    Kind regards,
    Paul
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top