I am not sure if this is the correct place to post this so I will.
I using MVC 2.5 .
I need to repopulate a custom html help control in a view on an ajax call back,
The custom control is an item in unordered list.
I am trying to recreate the view for the list item in the ajax call back but am happing trouble with how to code this.
Below is the c# code for the custom control, the view code that contains the custom html control ,and the method the ajax call back would call to recreate the list item html.
If anyone has any ides are solution please email me directly at stevensrf1@inbox.com with your suggestons.
- c# code for the custom control
/// <summary> /// Text Box control which sets the name of the text box to combination of the /// name of the container type and the name of thebinding property /// </summary> /// <typeparam name="TModel"></typeparam> /// <typeparam name="TValue"></typeparam> /// <param name="html"></param> /// <param name="expression"></param> /// <param name="htmlAttributes"></param> /// <returns></returns> public static MvcHtmlString TextBoxCustomNameFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, object htmlAttributes) { var dict = new RouteValueDictionary(htmlAttributes); return html.TextBoxCustomNameFor(expression, dict); }
- view code that contains the custom html control '
<ul id="current_meter"><li > <%= Html.LabelFor(o => o.MeterNumber)%> <br /><% = Html.TextBoxCustomNameFor(o => o.MeterNumber, new { style = "width: 100% !important" })%></li>-the method the ajax call back would call to recreate the list item html.
model.MeterNumber would contain the value the would be displayed in the control
function updateUnitCurrentMeter(model) { $('#current_meter li').eq(0).html(?????????????????????/
}