我正在一個項目上工作,我很難與它。我需要明天完成,所以我需要你的幫助。 問題是我有一個網站有一個名爲Edit的按鈕。用戶必須點擊按鈕向他顯示兩個按鈕,一個稱爲保存,另一個按鈕取消,網頁上還有另一個按鈕,稱爲「提交時間」以便主持。用戶必須先輸入小時並保存,然後按提交按鈕。 如果用戶沒有保存並按提交按鈕,彈出的消息告訴他需要先放置小時並保存。 這裏是代碼我需要顯示一個彈出消息,當我按下按鈕時,在aspx中啓用特定的按鈕
該代碼可用於提交按鈕
<asp:Button ID="ButtonSubmitChair" runat="server" Text="Submit Schedule to Chair" SkinID="AspButton" onclick="ButtonSubmitChair_Click"/>
保護無效ButtonSubmitChair_Click(對象發件人,EventArgs的) { objMs.UpdateStatus( 「SC」,Convert.ToInt32(會話[「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);
}
}`
- 這裏是這裏的編輯 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>
輸入代碼
非常感謝您的回覆。我認爲如果保存按鈕可見,則使用If語句,然後顯示消息。我很難過如何做到這一點。有任何想法嗎 – Sam 2012-08-09 19:38:40