model view controller - is there a way to set the HideSurroundingHtml value in ASP.MVC 2 -


I am creating a table of data like this

  & lt;% foreach Person in var model. People) {%> & Lt; TR & gt; & Lt; Td> & Lt;% = Html .nationlink (helper name, "editing editor")% & gt; & Lt; / Td> & Lt; Td> & Lt;% = Html.DisplayFor (c = & gt; person .name)% & gt; & Lt; / Td> & Lt; Td> & Lt;% = Html.DisplayFor (C => person.ege)%> & Lt; / Td> & Lt; Td> & Lt;% = Html.DisplayFor (C => person.backet)% & gt; & Lt; / Td> & Lt; / TR & gt; & Lt;%}% & gt;  

I created templates to override the following errors:

  & lt;% @ master language = "c #" inherited = "system. Web.mvc.ViewMasterPage "%> & Lt; Script runat = "server" & gt; Safe Override Zero OnInit (EventArgs e) {base.OnInit (E); If (ViewData.ModelMetadata.HideSurroundingHtml) {TablePlaceholder.Visible = false; } and control. Remove (data); DataPlaceholder.Controls.Add (data); }} & Lt; / Script & gt; & Lt; Asp: ContentPlaceHolder runat = "server" id = "data" /> & Lt; ASP: Place Holder Runat = "Server" ID = "Table Placeholder" & gt; & Lt; Table cellpadding = "0" cellspacing = "0" range = "0" width = "100%" & gt; & Lt; TR & gt; & Lt; Td style = "width: 10m;" & Gt; & Lt; Div class = "display-label" style = "text-align: right;" & Gt; & Lt; Asp: ContentPlaceHolder runat = "server" id = "label" & gt; & Lt;% = ViewData.ModelMetadata.GetDisplayName ()%> & Lt; / ASP: ContentPlaceHolder & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Div class = "display-field" & gt; & Lt; Asp: placeholder runat = "server" id = "data placeholder" /> & Lt; / Div & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / ASP: Placeholder & gt;  

While rendering the table, I do not want to display the surrounding HTML, but I do not have the clue how to set the HideSurroundingHtml value?

A cleaner and more obvious way to do this would be:

  Public class MyModel {[Extra Matadata ("Hide SourroundingHtml", true)] {Received some public string; Set; }}  

and in your opinion:

  bool hideSurroundingHtml = (this.ViewData.ModelMetadata.AdditionalValues.ContainsKey ("HideHaroundingHtml")? (Bool) This.ViewData.ModelMetadata.AdditionalValues ​​["HideSurroundingHtml"]: Incorrect); If (HideSurroundingHtml) {@: & lt; Div & gt; }  //material. If (HideSurroundingHtml) {@: & lt; / Div & gt; }  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -