62,046
社区成员
发帖
与我相关
我的任务
分享
protected void Button2_Click(object sender, EventArgs e)
{
this.etime.Text = Convert.ToDateTime(this.btime.Text).AddMinutes(45).ToString();
}
protected void band_nj()
{
SqlConnection conn = Sqlcon.openDatabase();
string cmdtext = "select * from T_grade ";
SqlDataAdapter da = new SqlDataAdapter(cmdtext, conn);
DataSet ds = new DataSet();
da.Fill(ds);
this.gradeid.DataSource = ds;
this.gradeid.DataTextField = "gradename";
this.gradeid.DataValueField = "id";
this.gradeid.DataBind();//
ListItem item = new ListItem();
item.Text = "---请选择年级---";
item.Value = "-1";
this.gradeid.Items.Insert(0, item);
conn.Close();
conn.Dispose();
}
protected void band_bj1(string gradeid)
{
SqlConnection conn = Sqlcon.openDatabase();
string cmdtext = "select * from T_class where gradeid='" + gradeid + "'";
SqlDataAdapter da = new SqlDataAdapter(cmdtext, conn);
DataSet ds = new DataSet();
da.Fill(ds);
this.classid.DataSource = ds;
this.classid.DataTextField = "classname";
this.classid.DataValueField = "id";
this.classid.DataBind();//
ListItem item = new ListItem();
item.Text = "---请选择年级---";
item.Value = "-1";
this.gradeid.Items.Insert(0, item);
conn.Close();
conn.Dispose();
}
protected void Dradeid_SelectedIndexChanged(object sender, EventArgs e)
{
string bigid = this.gradeid.SelectedValue.Trim();
band_bj1(bigid);
}
}
当班投票的班级和年级:
</td>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="gradeid" runat="server"
OnSelectedIndexChanged="Dradeid_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>
<asp:DropDownList ID="classid" runat="server">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td>