Asp.net 清除复选框列表
在我的“保存”按钮上,我想清除表单中的所有值,我对CheckBoxList执行了以下操作 但它不起作用。为什么呢,它没有明确复选框列表的值 分支是这样填充的:Asp.net 清除复选框列表,asp.net,Asp.net,在我的“保存”按钮上,我想清除表单中的所有值,我对CheckBoxList执行了以下操作 但它不起作用。为什么呢,它没有明确复选框列表的值 分支是这样填充的: protected void course_SelectedIndexChanged(object sender, EventArgs e) { try { int courseId = Convert.ToInt32(course.SelectedValue); DataTable dt;
protected void course_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
int courseId = Convert.ToInt32(course.SelectedValue);
DataTable dt;
dt = placementManager.GetBranchList(courseId);
if (dt.Rows.Count != 0)
{
Branch.DataSource = dt;
Branch.DataTextField = "branch_name";
Branch.DataValueField = "branch_id";
Branch.DataBind();
}
Btnsave.Visible = false;
GridView1.Visible = false;
}
catch (Exception ex)
{
COMMON.logger.Error("Error on course_SelectedIndexChanged:CompanySelected.aspx.cs", ex);
}
if (b)
{
gridNotExist.Text = "Records Successfully inserted for the displayed table, To insert new records select new entries";
this.ViewState.Remove("selectedList");
this.ViewState.Remove("dt");
Session.Abandon();
passout.SelectedIndex = 0;
company.SelectedIndex = 0;
txtpackage.Text = "";
course.SelectedIndex = 0;
Branch.DataSource = null;
Branch.DataBind();
vistDate.Text = "";
txtvenue.Text = "";
//GridView1.Visible = true;
}
}
当然,aspx页面有如下分支:
<asp:UpdatePanel id="update" runat="server">
<contenttemplate>
<td>
<asp:DropDownList ID="course" runat="server" AutoPostBack="True" OnSelectedIndexChanged="course_SelectedIndexChanged" />
<asp:CustomValidator ID="coursenecessaryForSaveButton" runat="server" ControlToValidate="course" ErrorMessage="Select A Course" OnServerValidate="coursenecessaryForSaveButton_ServerValidate" ValidationGroup="save" />
</td>
<td>
<asp:CustomValidator ID="courseNecessary" runat="server" ErrorMessage="Select A Course" OnServerValidate="courseNecessary_ServerValidate" ValidationGroup="verify" />
</td>
<td style="width: 101px">
Branch Name*
</td>
<td style="width: 126px">
<asp:CheckBoxList id="Branch" runat="server" />
</td>
</contenttemplate>
</asp:UpdatePanel>
分支机构名称*
b的定义在哪里
Branch.DataSource = null
Branch.DataBind()
您绑定的是什么???给我们更多的代码,您在问题上投入的精力越多,您从我们那里得到的答复就越快,质量也就越好。我像那样编辑了上面的aspx代码,但现在正在发帖。我在更新面板概念方面很差,请对上述代码进行说明。请Bolean b=placedStudentManager.SaveSelectdStudent(gridviewTbl);b只是在真值和假值的代码上面定义的。cs filedoes update panel不识别td,tr更新panel有问题您问的问题太多了。建议您仔细阅读ASP.NET更新面板-
if (b == true)
Branch.DataSource = null
Branch.DataBind()