c# - Stored procedure in MVC application -
i have inherited mvc4 application using entity framework 5 , .net framework 4 , in c#. database sql server 2008 r2
here problem.
inside database have stored procedure. stored procedure takes in 2 varchar parameters run.
i believe, have stored procedure in .edmx.
i want fire off when 2 text boxes populated.
how go having partial view call stored procedure , return data appropriate text boxes?
sorry massive question @ loss @ work , appreciated!
if have forgot or more information needed please let me know , provide can.
thanks in advance help, dustin
i don't think goes in [httppost] controller should in one
public actionresult fillfs(afviewmodel viewmodel) { try { //execute sp var textboxlist = getlistoftextbox("somevar","somevar2"); //code populate //viewmodel.textbox1 && viewmodel.textbox2 } catch (exception ex) { response.write(ex.innerexception.message); } return partialview("_aftab"); } here wrapped function import.
public static list<spresult> getlistoftextbox(string varchar1, string, varchar2) { using (var db = new edmxentities()) { //gettextboxvalue name gave function import objectresult<spresult> results = db.gettextboxvalue(varchar1, varchar2); list<spresult> results = results.tolist(); return results; } } hopefully helps
Comments
Post a Comment