page_load的时候可以绑丁2个DataSource??

解决方案 »

  1.   

    what do you mean?
    you can set several datasources to several data-controls,such as datagrids.
      

  2.   

    page_load的时候可以绑丁2个DataSource??不明白!
      

  3.   

    可以的,我试过了。 this.DataGrid1.DataSource=ds;
    this.DataGrid1.DataBind(); this.WebGrid.DataSource=ds;
    this.WebGrid.DataBind();
      

  4.   

    public void Page_Load(Object sender, EventArgs e) {
    if (!IsPostBack) {
    sql = "Select * FROM productlist where inventory>0";
    People.DataSource = CreateDataSource();
    People.DataBind();
    sql = "Select * FROM productlist1 where inventory>0";
    People1.DataSource = CreateDataSource();
    People1.DataBind();}}
    就是这样写可以吗??
      

  5.   

    可以。
    不过最好分开写,比如:
    public void Page_Load(Object sender, EventArgs e) {
    if (!IsPostBack) {
    Binding1();
    Binding2();}}
    Binding1()
    {
    }
    Binding2()
    {
    }
      

  6.   

    呵呵,是这样啊,帮定100个都没问题,建议用Pinbor(来客心动)的方法。把帮定写成过程,因为可能要经常调用!