c# - Using a stored procedure in a dynamic data web site -


this homework assignment isn't covered in our books , instructed use internet and/or other resources figure out assignment. information i'm finding on web little on head , hoping more laymen explanation!!

i have existing asp.net web site using c#, without issue able add dynamic data capabilities site creating dummy site, hooked adventureworks db, , adding appropriate files , assemblies existing site.

this getting lost. need use 1 of stored procedures in adventure works db display data on page. attempting use uspgetemployeemanagers associating listview on aspx page. pretty far can get. blogs i've read little on head , i've become more confused when started.

can please explain me, possible, need display data using stored procedure in dynamic data web site?

thank you!

code:

    protected void getemployeemanagers(int employeeid) {     adventureworksltdatacontext aventureworksdatacontext = new adventureworksltdatacontext();      var dynamicdata = aventureworksdatacontext.uspgetemployeemanagers(employeeid);      lvwgetemployeemanager.datasource = dynamicdata;     lvwgetemployeemanager.databind(); } 

you can use data source want part. need hook data listview correctly. here example:

markup

    <div id= "test1a" class="fieldgroup" runat="server">     <asp:panel id="panelwithhistorycontrol" runat="server">                     <asp:listview id="test1" runat="server" onload="test1_onload">             <layouttemplate>                 <asp:placeholder runat="server" id="test1placeholder"></asp:placeholder>             </layouttemplate>             <itemtemplate>                 <table>                         <tr>                             <td><%# eval("column1")%></td>                             <td><%# eval("column2")%></td>                         </tr>                     </table>             </itemtemplate>         </asp:listview>                </asp:panel></div> 

column1 , column2 table columns or interface property names etc.

code behind

public void test1_onload(object sender, eventargs e) {          var list = // data database.  return ilist<t> or                   //similar.      test1.datasource = list;     test1.itemplaceholderid = "test1placeholder";     test1.databind(); } 

references http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.itemtemplate.aspx

http://www.4guysfromrolla.com/articles/122607-1.aspx

finally, executing stored procedures c# straight forward. there many sources see: how execute stored procedure within c# program

http://msdn.microsoft.com/en-us/library/bb399407(v=vs.110).aspx

http://msdn.microsoft.com/en-us/library/d7125bke.aspx


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -