Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > PanelBar > Compiler Error Message: CS0136

Not answered Compiler Error Message: CS0136

Feed from this thread
  • Varghese avatar

    Posted on Dec 13, 2011 (permalink)

    I have the following panel bar. When I run this I get the following error at the line where it has subItem.Add().Text("CC").Content(

    Compiler Error Message: CS0136: A local variable named 'item' cannot be declared in this scope because it would give a different meaning to 'item', which is already used in a 'parent or current' scope to denote something else


    Here is the code I have:

    @(Html.Telerik().PanelBar().Name("PanelBar").HtmlAttributes(new { style = "border-radius: 5px;"}).Items(item =>
        {
            item.Add().Text("A").Items(subItem =>
                {
                    subItem.Add().Text("AA");
                });

            item.Add().Text("B").Items(subItem =>
                {
                    subItem.Add().Text("BB");
                });

            item.Add().Text("C").Items(subItem =>
                {
                    subItem.Add().Text("CC").Content(
                            @<text>
                                graph chart data
                            </text>).Action("...", ".");
                    subItem.Add().Text("CCC").Action("...", "...");
                });
        }
        ))

    Reply

  • Daniel Daniel admin's avatar

    Posted on Dec 16, 2011 (permalink)

    Hi Varghese,

    The local variable which is specified in the error is the Razor's item. It is added to the scope when you open the text tag. To avoid the error, you should rename the Lambda expression item parameter.

    Greetings,
    Daniel
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > PanelBar > Compiler Error Message: CS0136
Related resources for "Compiler Error Message: CS0136"

ASP.NET MVC PanelBar Features  |  Documentation  |  Demos  |  Telerik TV ]