| 
                         SqlDataAdapter da = new SqlDataAdapter();     da.SelectCommand=cmd;     DataSet ds=new DataSet();     da.Fill(ds,"vCO");     Count.Text="ヒット:"+ds.Tables["vCO"].Rows.Count.ToString()+"件";     return ds;    } }    /// <summary>   ///从DataSet中除一   /// </summary>   /// <param></param>   /// <param></param>   protected void MyDataGrid_Delete(Object sender, DataGridCommandEventArgs E)   {      String strID=MyDataGrid.DataKeys[(int)E.Item.ItemIndex].ToString();     //删除操作   }   /// <summary>   /// 分页操作   /// </summary>   /// <param></param>   /// <param></param>   protected void MyDataGrid_PageIndexChanged(object source, DataGridPageChangedEventArgs e)   {    MyDataGrid.CurrentPageIndex=e.NewPageIndex;    BindGrid();   }   /// <summary>   /// 排序   /// </summary>   /// <param></param>   /// <param></param>   protected void Sort_Grid(object sender, DataGridSortCommandEventArgs e)    {    DataView dv= new DataView(GetData().Tables["vCO"]);    dv.Sort= e.SortExpression.ToString();    MyDataGrid.DataSource=dv;    MyDataGrid.DataBind();    } #region Web   override protected void OnInit(EventArgs e)   {    //   //    InitializeComponent();    base.OnInit(e);   }
    /// <summary>  /// </summary>   private void InitializeComponent()   {        this.ddlWk.SelectedIndexChanged += new System.EventHandler(this.ddlWk_SelectedIndexChanged);    this.Load += new System.EventHandler(this.Page_Load); }   #endregion private void ddlWk_SelectedIndexChanged(object sender, System.EventArgs e)   {    Session["WP"]=ddlWk.SelectedValue;    MyDataGrid.CurrentPageIndex=0;//没有这一句,当该页码超出其他数据源的范围时会出错    BindGrid();     Response.Write( "<script language='javascript'>parent.menuframe.location.reload();</script>");
    }                         (编辑:临夏站长网) 
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! 
                     |