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


    I need help...

    this is my code in aspx:

            <telerik:RadMenu ID="RadMenu1" runat="server">
                            <telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Hay" ShowChooser="True">

    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
    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

    <telerik:RadMenu ID="RadMenu1" runat="server"
                <telerik:RadMenuItem Value="templateHolder"
                        <telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Hay" ShowChooser="True"

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

    Kind regards,
    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