Messagebox无法正常工作

时间:2012-11-13 14:29:47

标签: c# asp.net .net

我正在使用VS 2010来开发Web应用程序。在“管理员”批准公司之后,消息框必须显示消息“供应商ID:lblPage2ID被修改为”已批准“(或”未批准“)或“待定”)在“管理员”选择的单选按钮上。如何操作?请参考下面的内联代码,告诉我如何将单选按钮放在直线上。

   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>

radiobutton

1 个答案:

答案 0 :(得分:0)

Set the RepeatDirection property of the RadioButtonList control to horizontal.

<asp:RadioButtonList ID="rblTest" align = "center" runat="server" RepeatDirection="Horizontal" 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>