Exemplo n.º 1
0
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="strWhere">条件</param>
        void LoadData(string strWhere)
        {
            MSCustomersDAL customerDal = new MSCustomersDAL();
            DataSet        ds          = customerDal.GetCustomersList(strWhere);
            DataView       dv          = ds.Tables[0].DefaultView;

            AspNetPager1.RecordCount = dv.Count;

            PagedDataSource pds = new PagedDataSource();

            pds.DataSource       = dv;
            pds.AllowPaging      = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize         = AspNetPager1.PageSize;
            Repeater1.DataSource = pds;
            Repeater1.DataBind();
        }
Exemplo n.º 2
0
 /// <summary>
 /// 页面加载事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
         {
             #region 初始化界面
             if (null != Common.Common.NoHtml(Request.QueryString["action"]))
             {
                 strAction = Common.Common.NoHtml(Request.QueryString["action"]);
             }
             if (null != Common.Common.NoHtml(Request.QueryString["id"]))
             {
                 strID = Common.Common.NoHtml(Request.QueryString["id"]);
             }
             ddlphonelist.Items.Clear();
             MSCustomersDAL phoneDal = new MSCustomersDAL();
             DataSet        ds       = new DataSet();
             ds = phoneDal.GetCustomersList("");
             DataTable dt = ds.Tables[0];
             DataRow   dr = ds.Tables[0].NewRow();
             dr["ID"]    = "";
             dr["Phone"] = "--请选择用户电话--";
             dt.Rows.InsertAt(dr, 0);
             ddlphonelist.DataSource     = ds.Tables[0].DefaultView;
             ddlphonelist.DataTextField  = "Phone";
             ddlphonelist.DataValueField = "ID";
             ddlphonelist.DataBind();
             #endregion
         }
         else
         {
             return;
         }
     }
 }