ObjectDataSourc用法之七(新增)

  • Post author:
  • Post category:其他
1.  准備條件

參數:ObjectDataSource用法之一(SelectMethod來進行簡單的邦定)

2.  在業務處理類中添加如下方法

public void InsertItem(string UID, string PWD, string Email)
{
    HttpContext.Current.Response.Write(“UID = ” + UID + “<br/>”);
    HttpContext.Current.Response.Write(“PWD = ” + PWD + “<br/>”);
    HttpContext.Current.Response.Write(“Email = ” + Email + “<br/>”);
}

3. aspx頁面內容為

<asp:ObjectDataSource ID=”ObjectDataSource1″ runat=”server”
    SelectMethod=”AllItems” InsertMethod=”InsertItem” TypeName=”Member”>
</asp:ObjectDataSource>
<asp:DetailsView ID=”GridView1″ runat=”server” DataSourceID=”ObjectDataSource1″ AutoGenerateInsertButton=”true”>
</asp:DetailsView>

說明:好像沒什么好說的……

转载于:https://www.cnblogs.com/OpenCoder/archive/2009/09/16/1567728.html