private void bindSettingEdit(ContentSection section, Service service) { StringBuilder builder = new StringBuilder(); IList parms = service.GetParams(); for (int i = 0; i < parms.Count; i++) { ParamControl control = parms[i] as ParamControl; control.Value = control.ChangeType(section.GetServiceParamValue("param" + i)).ToString(); builder.Append("<div>"); builder.Append(control.Html); builder.Append("</div>"); } set("settingList", builder.ToString()); }
public static void updateParamValues(ContentSection section, IContentSectionService sectionService, MvcContext ctx) { IList parms = ServiceContext.Get(section.ServiceId).GetParams(); int count = parms.Count; StringBuilder builder = new StringBuilder(); for (int i = 0; i < count; i++) { ParamControl control = parms[i] as ParamControl; builder.Append("param"); builder.Append(i); builder.Append("="); String strVal = ctx.Post("param" + i); object val = control.ChangeType(strVal); builder.Append(val); if (i < (count - 1)) { builder.Append(";"); } } section.ServiceParams = builder.ToString(); sectionService.Update(section); }