page_load的时候可以绑丁2个DataSource?? page_load的时候可以绑丁2个DataSource?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 what do you mean?you can set several datasources to several data-controls,such as datagrids. page_load的时候可以绑丁2个DataSource??不明白! 可以的,我试过了。 this.DataGrid1.DataSource=ds; this.DataGrid1.DataBind(); this.WebGrid.DataSource=ds; this.WebGrid.DataBind(); 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();}}就是这样写可以吗?? 可以。不过最好分开写,比如:public void Page_Load(Object sender, EventArgs e) {if (!IsPostBack) {Binding1();Binding2();}}Binding1(){}Binding2(){} 呵呵,是这样啊,帮定100个都没问题,建议用Pinbor(来客心动)的方法。把帮定写成过程,因为可能要经常调用! 急,多条sql绑定到GridView中。。。 VS2010 aspx 顶部 添加注释,怎么弄啊 路径的问题,用"\\" 还是"//" css的效果问题,怎么实现不了啊 请高手指点关于TextBox动态绑定数据的问题 散分﹗对 ASP.NET 应用程序启动调试应如何设置(包括远程调试) 很少有讲.net+access的书,大家帮忙 根据星期1怎么算出属于哪一周? 找后台编辑功能代码 C#写的自定义控件用于网页上 大家过来看看,比较棘手的问题(xml和mime) textbox 宽度怎么设置??
you can set several datasources to several data-controls,such as datagrids.
this.DataGrid1.DataBind(); this.WebGrid.DataSource=ds;
this.WebGrid.DataBind();
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();}}
就是这样写可以吗??
不过最好分开写,比如:
public void Page_Load(Object sender, EventArgs e) {
if (!IsPostBack) {
Binding1();
Binding2();}}
Binding1()
{
}
Binding2()
{
}