0

私はプロジェクトに取り組んでいて、それに苦労しています。明日までに終わらせる必要があるので、よろしくお願いします。問題は、Webサイトに[編集]というボタンがあることです。ユーザーはボタンをクリックして、1つは[保存]、もう1つは[キャンセル]という2つのボタンを表示する必要があります。また、Webページに[椅子に時間を送信]という別のボタンがあります。ユーザーは最初に時間を入力して保存してから、[送信]ボタンを押す必要があります。ユーザーが保存せずに[送信]ボタンを押した場合、ポップアップメッセージは、時間を入れて最初に保存する必要があることをユーザーに通知します。これがコードです

このコードは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);
        }

} `

  1. これがEditaspxの <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

ModalPopupを使用できます。エラーが発生した場合は、コードビハインドを設定してポップアップを表示します。それ以外の場合は、送信してください。

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

于 2012-08-09T19:11:39.680 に答える
0

Session("isSaved")= true のようなセッション変数を設定するのはどうですか

ユーザーが [保存] をクリックしたとき。送信ボタンは次のようになります

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