您的位置:首页 > 编程语言 > ASP

DataList编辑、更新、取消、删除、分页(分页控件AspNetPager.dll)

2008-09-20 17:18 836 查看
1.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>DataList编辑、更新、取消、删除、分页</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<table width="100%" border="0" cellpadding="0" cellspacing="0">

<tr>

<td>

<asp:DataList ID="DataList1" runat="server" Font-Size="12px" Width="100%" DataKeyField="ProductID"

OnCancelCommand="DataList1_CancelCommand" OnDeleteCommand="DataList1_DeleteCommand"

OnEditCommand="DataList1_EditCommand" OnUpdateCommand="DataList1_UpdateCommand">

<HeaderTemplate>

<td>

au_id</td>

<td>

au_lname</td>

<td>

au_fname</td>

<td>

phone</td>

<td>

address</td>

<td>

编辑</td>

<td>

删除</td>

</HeaderTemplate>

<ItemTemplate>

<td>

<asp:Label ID="Lbl_au_id" Text='<%#Eval("au_id")%>' runat="server"></asp:Label>

</td>

<td>

<asp:Label ID="Lbl_au_lname" Text='<%#Eval("au_lname")%>' runat="server"></asp:Label>

</td>

<td>

<asp:Label ID="Lbl_au_fname" Text='<%#Eval("au_fname")%>' runat="server"></asp:Label>

</td>

<td>

<asp:Label ID="Lbl_phone" Text='<%#Eval("phone")%>' runat="server"></asp:Label>

</td>

<td>

<asp:Label ID="Lbl_address" Text='<%#Eval("address")%>' runat="server"></asp:Label>

</td>

<td>

<asp:LinkButton ID="LinkButton1" Text="编辑" CommandName="Edit" runat="server"></asp:LinkButton>

</td>

<td>

<asp:LinkButton ID="LinkButton3" Text="删除" CommandName="Delete" runat="server"></asp:LinkButton>

</td>

</ItemTemplate>

<EditItemTemplate>

<td>

<asp:Label ID="Lbl_au_id" Text='<%#Eval("au_id")%>' runat="server"></asp:Label>

</td>

<td>

<asp:TextBox ID="Txt_au_lname" Text='<%#Eval("au_lname")%>' runat="server"></asp:TextBox>

</td>

<td>

<asp:TextBox ID="Txt_au_fname" Text='<%#Eval("au_fname")%>' runat="server"></asp:TextBox>

</td>

<td>

<asp:TextBox ID="Txt_phone" Text='<%#Eval("phone")%>' runat="server"></asp:TextBox>

</td>

<td>

<asp:TextBox ID="Txt_address" Text='<%#Eval("address")%>' runat="server"></asp:TextBox>

</td>

<td>

<asp:LinkButton ID="LinkButton1" Text="更新" CommandName="Update" runat="server"></asp:LinkButton>

<asp:LinkButton ID="LinkButton2" Text="取消" CommandName="Cancel" runat="server"></asp:LinkButton>

</td>

<td>

<asp:LinkButton ID="LinkButton3" Text="删除" CommandName="Delete" runat="server"></asp:LinkButton>

</td>

</EditItemTemplate>

<FooterTemplate>

</FooterTemplate>

</asp:DataList>

</td>

</tr>

<tr>

<td align="center">

<webdiyer:AspNetPager ID="pager1" runat="server" Font-Size="12px" ShowCustomInfoSection="Left"

OnPageChanged="ChangePage" ShowInputBox="Always" CustomInfoSectionWidth="80%"

SubmitButtonText="go">

</webdiyer:AspNetPager>

</td>

</tr>

</table>

</div>

</form>

</body>

</html>
2.cs

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using Wuqi.Webdiyer;

public partial class DataList_DataList_DeleteUpdate1 : System.Web.UI.Page

public DataSet Minutepage(string tblName,string fldName,int PageSize,int PageIndex,int IsReCount,int OrderType,string strWhere)

{

SqlParameter[] parameters = {

new SqlParameter("@tblName", SqlDbType.VarChar,255),

new SqlParameter("@fldName",SqlDbType.VarChar,255),

new SqlParameter("@PageSize", SqlDbType.Int),

new SqlParameter("@PageIndex", SqlDbType.Int),

new SqlParameter("@IsReCount",SqlDbType.Bit),

new SqlParameter("@OrderType",SqlDbType.Bit),

new SqlParameter("@strWhere",SqlDbType.VarChar,1000)

};

parameters[0].Value = tblName;

parameters[1].Value = fldName;

parameters[2].Value = PageSize;

parameters[3].Value = PageIndex;

parameters[4].Value = IsReCount;

parameters[5].Value = OrderType;

parameters[6].Value = strWhere;

return DbHelperSQL.RunProcedure("PR_MinutePage", parameters, "ds");

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐