public ActionResult Load() { JavaScriptSerializer serializer = new JavaScriptSerializer(); try { List <string> dd = RenderingSets.GetList(); return(Json(new { success = true, data = serializer.Serialize(dd.ToArray()) }, "json/application")); } catch (Exception ex) { Log.Write(TraceEventType.Stop, "Rendering Set Controller, Load | Exception {0}", ex); return(Json(new { success = false, message = ex.Message }, "json/application")); } }
public IEnumerable <SelectListItem> GetRenderingSets(HttpRequest request) { List <SelectListItem> list = new List <SelectListItem>(); try { foreach (string file in RenderingSets.GetList()) { list.Add(new SelectListItem() { Text = Path.GetFileNameWithoutExtension(file), Value = file }); } } catch (Exception) { list.Add(new SelectListItem() { Text = "No rendering Set", Value = "" }); } return(list); }