我正在开展一个项目,我很难接受它。我需要在明天完成它,所以我需要你的帮助。 问题是我有一个网站有一个叫做编辑的按钮。用户必须单击按钮向他显示两个按钮,一个名为Save,另一个按钮取消,网页上还有另一个名为Submit Hours to chair的按钮。用户必须先输入小时并保存,然后按“提交”按钮。 如果用户没有保存并按下“提交”按钮,则弹出消息告诉他需要先放入小时并先保存。 这是代码
此代码适用于SUbmit按钮
<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(); UpdatePanel1.Update(); UpdatePaneloffcamp.Update(); UpdatePanel3.Update(); //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);
}
}`
<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>
在这里输入代码答案 0 :(得分:0)
您可以使用模态弹出窗口,只需设置后面的代码即可显示弹出窗口,否则请提交!
http://everymanprogrammer.com/index.php/using-the-ajax-modalpopup-a-beginners-guide/
答案 1 :(得分:0)
如何设置Session var之类的 会话(“isSaved”)= true
当用户点击“保存”时。 “提交”按钮看起来像
if not Session("isSaved")= true then
modalForm.Show
else
'DoSubmit
end if