asp.net mvc - Partial view inside main view + save to DB -
i making site entering metadata. on first tab (css tabs) have few dropdowns , after make choices, second tab unlocked.
right second tab empty, , contend supposed go there, have put in view. looks this.
now, want achieve - when open second tab view in second picture should shown, loaded @html.partial. so, after make choices in first tab, select 1 of items in list in second tab, , written text in editor, of should saved db.
here controller action list in second tab:
public actionresult asdf() { list<sims_test> = new list<sims_test>(); using (userscontext dc = new userscontext()) { var languageid = thread.currentthread.currentuiculture.name; if (languageid == "en-us") { = dc.sims_test.where(s => s.languageid == "en-us").orderby(a => a.id).tolist(); } else { = dc.sims_test.where(s => s.languageid == "mk-mk").orderby(a => a.id).tolist(); } } return view(all); }
the problem partial view cannot loaded inside main view because use different models in views:
@model mvcapplication20.models.metapodatocimodel
and
@model list<mvcapplication20.models.sims_test>
can done way, also, can take values of partial view, give them controller action of main view can saved in db?
edit: here models:
public class metapodatocimodel { [required(allowemptystrings = false, errormessageresourcetype = typeof(resources.home), errormessageresourcename = "stringdd1empty")] public string domen { get; set; } [required(allowemptystrings = false, errormessageresourcetype = typeof(resources.home), errormessageresourcename = "stringdd2empty")] public string istrazuvanje { get; set; } [required(allowemptystrings = false, errormessageresourcetype = typeof(resources.home), errormessageresourcename = "stringdd3empty")] public string frekvencija { get; set; } [required(allowemptystrings = false, errormessageresourcetype = typeof(resources.home), errormessageresourcename = "stringdd4empty")] public string period { get; set; } [required(allowemptystrings = false, errormessageresourcetype = typeof(resources.home), errormessageresourcename = "stringdd5empty")] public string godina { get; set; } [allowhtml] [uihint("tinymce_full")] public string testpole { get; set; } } [table("sims_test", schema = "sims")] public class sims_test { [key, column(order = 0)] public int id { get; set; } public string simscode { get; set; } public string inheritance { get; set; } [key, column(order = 1)] public string languageid { get; set; } public int levelid { get; set; } public int qualityid { get; set; } public string conceptname { get; set; } public string conceptcode { get; set; } public string descriptions { get; set; } public string representation { get; set; } public string essguidelines { get; set; } public int? orderid { get; set; } }
Comments
Post a Comment