asp.net C# 如何封装后台控件事件,然后在Page_Load下调用?急求,谢谢
想封装的事件代码如下,我也不知道是不是叫封装,反正就是要在page_load里调用,想让它独立出来protectedvoiddrpListUnit_SelectedInd...
想封装的事件代码如下,我也不知道是不是叫封装,反正就是要在page_load里调用,想让它独立出来
protected void drpListUnit_SelectedIndexChanged(object sender, EventArgs e)
{
datatime = Calendar2.SelectedDate;
SqlDataSource1.SelectCommand = "SELECT station.station_name,tbl_waterDushu.t_id,tbl_waterDushu.station_id,tbl_waterDushu."
+ " ctime,tbl_waterDushu.W1,tbl_waterDushu.W2,tbl_waterDushu.W3,tbl_waterDushu.W4,tbl_waterDushu.W5,"
+ " tbl_waterDushu.W6,tbl_waterDushu.W7,tbl_waterDushu.W8,tbl_waterDushu.W9,tbl_waterDushu.W10,tbl_waterDushu.W11,"
+ " tbl_waterDushu.W12,tbl_waterDushu.QTotal,tbl_waterDushu.WTotal,tbl_waterDushu.Type,tbl_waterDushu.inserttime"
+ " FROM tbl_waterDushu ,station WHERE tbl_waterDushu.station_id=station.station_id and"
+ " (ctime between '" + datatime.ToString() + "' and '" + datatime.AddHours(24).ToString() + "') and unit_id="+drpListUnit.SelectedValue+" ORDER BY ctime DESC";
SqlDataSource1.DataBind();
} 展开
protected void drpListUnit_SelectedIndexChanged(object sender, EventArgs e)
{
datatime = Calendar2.SelectedDate;
SqlDataSource1.SelectCommand = "SELECT station.station_name,tbl_waterDushu.t_id,tbl_waterDushu.station_id,tbl_waterDushu."
+ " ctime,tbl_waterDushu.W1,tbl_waterDushu.W2,tbl_waterDushu.W3,tbl_waterDushu.W4,tbl_waterDushu.W5,"
+ " tbl_waterDushu.W6,tbl_waterDushu.W7,tbl_waterDushu.W8,tbl_waterDushu.W9,tbl_waterDushu.W10,tbl_waterDushu.W11,"
+ " tbl_waterDushu.W12,tbl_waterDushu.QTotal,tbl_waterDushu.WTotal,tbl_waterDushu.Type,tbl_waterDushu.inserttime"
+ " FROM tbl_waterDushu ,station WHERE tbl_waterDushu.station_id=station.station_id and"
+ " (ctime between '" + datatime.ToString() + "' and '" + datatime.AddHours(24).ToString() + "') and unit_id="+drpListUnit.SelectedValue+" ORDER BY ctime DESC";
SqlDataSource1.DataBind();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询