0

我正在做一个项目,但我很难做到。我需要在明天之前完成它,所以我需要你的帮助。问题是我有一个网站有一个名为编辑的按钮。用户必须单击该按钮才能向他显示两个按钮,一个称为“保存”,另一个称为“取消”,网页上还有另一个按钮,称为“提交时间到主席”。用户必须先输入小时数并保存,然后按提交按钮。如果用户没有保存并按下提交按钮,弹出消息会告诉他需要先输入小时并保存。这是代码

此代码用于提交按钮

<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);
        }

}`

  1. 这是编辑 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>&nbsp;<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>&nbsp;<asp:LinkButton ID="LinkButtoncancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton></InsertItemTemplate></asp:TemplateField> 在此处输入代码
4

2 回答 2

0

如何设置像 Session("isSaved")= true 这样的 Session 变量

当用户点击保存时。提交按钮看起来像

if not Session("isSaved")= true then 
    modalForm.Show
else
    'DoSubmit
end if
于 2012-08-09T21:29:40.937 回答
0

您可以使用 ModalPopup,只需设置代码隐藏,如果有错误则显示 Popup,否则,提交!

http://everymanprogrammer.com/index.php/using-the-ajax-modalpopup-a-beginners-guide/

于 2012-08-09T19:11:39.680 回答