Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • bob baty-barr 1180 posts 1294 karma points MVP
    Aug 15, 2012 @ 23:09
    bob baty-barr
    0

    get a specific item in a dynamic variable

    There has to be a better way to do this...

    @foreach (var item in @Model.Children.Take(1)) 
                  {
                     
                       dynamic thing = item.attributeLevels;
                
                foreach (var thang in thing)
                {
                var thangID = @thang.id;
                var theID = HttpContext.Current.Request.QueryString["id"];
                if(@thangID == @theID){
                    @thang.levelTitle.InnerText.ToString()
                }
                }      
                      
                   }

    how would i make this 'smarter'?

  • bob baty-barr 1180 posts 1294 karma points MVP
    Aug 15, 2012 @ 23:12
    bob baty-barr
    0

    i got an error trying to edit above... but basically, i am trying to get at a specific item in the embedded content object of attributeLevels

    anyone got any thoughts?

Please Sign in or register to post replies

Write your reply to:

Draft