12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using System.Web.UI.WebControls;
- using System.Web.UI;
- using System.Data;
- using System.Data.SqlClient;
- namespace Ant.Service.Utilities
- {
-
-
-
- public class BindDataControl
- {
- #region 绑定服务器数据控件 简单绑定DataList
-
-
-
-
-
- public static void BindDataList(System.Web.UI.Control ctrl, DataView mydv)
- {
- ((DataList)ctrl).DataSourceID = null;
- ((DataList)ctrl).DataSource = mydv;
- ((DataList)ctrl).DataBind();
- }
- #endregion
- #region 绑定服务器数据控件 SqlDataReader简单绑定DataList
-
-
-
-
-
- public static void BindDataReaderList(System.Web.UI.Control ctrl, SqlDataReader mydv)
- {
- ((DataList)ctrl).DataSourceID = null;
- ((DataList)ctrl).DataSource = mydv;
- ((DataList)ctrl).DataBind();
- }
- #endregion
- #region 绑定服务器数据控件 简单绑定GridView
-
-
-
-
-
- public static void BindGridView(System.Web.UI.Control ctrl, DataView mydv)
- {
- ((GridView)ctrl).DataSourceID = null;
- ((GridView)ctrl).DataSource = mydv;
- ((GridView)ctrl).DataBind();
- }
- #endregion
-
-
-
-
-
- public static void BindRepeater(System.Web.UI.Control ctrl, DataView mydv)
- {
- ((Repeater)ctrl).DataSourceID = null;
- ((Repeater)ctrl).DataSource = mydv;
- ((Repeater)ctrl).DataBind();
- }
- }
- }
|