c# - How to name textboxes in MVC when passing XElement -


I am passing an XElement in my editing scene and want to design and normalize the normal HTML controls created for me Are there. I have the code:

  ... div 
& Lt; / Div & gt; & Lt; Div class = "editor-field" & gt; & Lt;% = Html.TextBoxFor (model = & gt; Model.XPathSelectElement ("site [@id = 'customerName']"). Value)%> & Lt;% = Html Validity Message (Model = & gt; Model.XPathSelectElement ("Site [@id = 'Customer Name']"). Value)%> & Lt; / Div & gt; ...

but it produces the following:

  & lt; Div class = "editor-label" & gt; & Lt; Label = "value" & gt; Value & lt; / Label & gt; & Lt; / Div & gt; & Lt; Div class = "editor-field" & gt; & Lt; Input id = "value" name = "value" type = "text" value = "" /> & Lt; / Div & gt;  

Why is this and how can I create a smartly designated (for example) textbox?

Thanks,

Matt. Instead of giving it a complete XML element, you should create a view to capture your view data.

  public class customer model {public customer model (excelment xml) {this.Name = xml.XPathSelectElement ("site [@id = 'username' ] "). value; } Public string name {get; Set; }}  

And then just: HTML. Textbox (model => model name);

Edit: And also ... do not want your <% = Html.LabelFor (model => Models .XPathSelectElement (ho% = Html.LabelFor (model = > Models .XPathSelectElement (


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 -