0
我正在使用VS 2010開發Web應用程序。「管理員」給予公司批准後,消息框必須顯示消息「供應商ID:lblPage2ID修改爲」已批准「(或「未批准」或「待定」)在由「Admin'.How選擇的單選按鈕辦呢?請參考下面的內嵌代碼,並告訴我如何把單選按鈕的直線。Messagebox無法正常工作
protected void rblTest_SelectedIndexChanged(object sender,EventArgs e)
{
_DAL.ExecuteSQL("UPDATE Company_Info SET
Approval_Status='"+rblTest.SelectedValue+"' WHERE Vendor_ID= '" +lblPage2ID.Text +"'");
ClientScript.RegisterStartupScript(this.GetType(),"callfunction",
"alert('Approval Status modified in database');", true);
// Page.ClientScript.RegisterClientScriptBlock (typeof(Page),"SCRIPT",
string.Format("alert(Approval Status modified as '" +rblTest.SelectedValue+"')"), true);
// HttpContext.Current.Response.Write("<script>alert (Approval Status modified as
'" + rblTest.SelectedValue +"');</script>");
// ClientScript.RegisterStartupScript (this.GetType), "callfunction",
"alert('Approval Status modified as '"+rblTest.SelectedValue+"');",true);
}
<asp:RadioButtonList ID="rblTest" align = "center" runat="server" AutoPostBack="true" Width="152px" onselectedindexchanged="rblTest_SelectedIndexChanged" style="margin-left: 0px">
<asp:ListItem Text="Approved" Value="YES"></asp:ListItem>
<asp:ListItem Text="Not Approved" Value="NO"></asp:ListItem>
<asp:ListItem Text="Pending" Value="PEN"></asp:ListItem>
</asp:RadioButtonList>
protip:串聯SQL參數不是要走的路,它會讓你開放t o SQL注入攻擊。與你的問題無關,但你應該知道。 – Arran