我正在做一个项目,但我很难做到。我需要在明天之前完成它,所以我需要你的帮助。问题是我有一个网站有一个名为编辑的按钮。用户必须单击该按钮才能向他显示两个按钮,一个称为“保存”,另一个称为“取消”,网页上还有另一个按钮,称为“提交时间到主席”。用户必须先输入小时数并保存,然后按提交按钮。如果用户没有保存并按下提交按钮,弹出消息会告诉他需要先输入小时并保存。这是代码
此代码用于提交按钮
<asp:Button ID="ButtonSubmitChair" runat="server" Text="Submit Schedule to Chair"
SkinID="AspButton" onclick="ButtonSubmitChair_Click"/>
protected void ButtonSubmitChair_Click(object sender, EventArgs e) { objMs.UpdateStatus("SC", Convert.ToInt32(Session["FacId"]), Convert.ToInt32(Session["TermId"])); DetailsViewMainSchedule.DataBind(); GvTeachingSchedule.DataBind(); GvResearchSchedule.DataBind(); OfficeHoursGridView.DataBind(); GridViewOffCampus.DataBind(); 更新面板1.更新();UpdatePaneloffcamp.Update(); 更新面板3.更新();//ButtonSubmitChair.Enabled = GetSubmitButtonStatus(); ButtonSubmitChair.Enabled = false; //RZL 添加禁用按钮
string facmail = "";
string facname = "";
DataTable dt1 = objF.GetFacultyEmailId(Convert.ToInt32(Session["FacId"]));
if (dt1.Rows.Count > 0)
{
facmail = dt1.Rows[0]["Email"].ToString();
facname = dt1.Rows[0]["name"].ToString();
}
DataTable dt = objF.GetChairEmail(Convert.ToInt32(Session["DeptID"]));
string chairname = "";
string chairmail = "";
if (dt.Rows.Count > 0)
{
chairname = dt.Rows[0]["name"].ToString();
chairmail = dt.Rows[0]["Email"].ToString();
}
string FacultyComments = ((TextBox)(DetailsViewMainSchedule.FindControl("TextBoxFCItem"))).Text;
string ChairComments = ((TextBox)(DetailsViewMainSchedule.FindControl("TextBoxCCItem"))).Text;
string DeanComments = ((TextBox)(DetailsViewMainSchedule.FindControl("TextBoxDCItem"))).Text;
if (FacultyComments == "")
FacultyComments = "No Comments";
if (ChairComments == "")
ChairComments = "No Comments";
if (DeanComments == "")
DeanComments = "No Comments";
try
{
objM.message(facname, chairname, FacultyComments, ChairComments, DeanComments, chairmail, facmail, "sc");
}
catch (Exception ex)
{
Response.Redirect("schedule.aspx?" + pageQueryString);
}
}`
- 这是编辑 aspx
<asp:TemplateField ShowHeader="False"> <ItemTemplate> <asp:LinkButton ID="LinkButtonEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" Visible="<%# GetEditStatus() %>"></asp:LinkButton></ItemTemplate><EditItemTemplate> <asp:LinkButton ID="LinkButtonSave" runat="server" CausesValidation="True" CommandName="Update" Text="Save"></asp:LinkButton> <asp:LinkButton ID="LinkButtonCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton></EditItemTemplate><InsertItemTemplate> <asp:LinkButton ID="LinkButtonInsert" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" onclick="LinkButtonInsert_Click"></asp:LinkButton> <asp:LinkButton ID="LinkButtoncancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton></InsertItemTemplate></asp:TemplateField>
在此处输入代码