2012-11-13 3 views
0

웹 응용 프로그램을 개발하는 데 VS 2010을 사용하고 있습니다. 'Admin'이 회사 승인을받은 후 메시지 상자에 "공급 업체 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> 

radiobutton

+3

Protip : SQL 매개 변수의 연결은 이동하지 않아도됩니다. o SQL 주입 공격. 귀하의 질문과 관련이 없지만 그것에 대해 알고 있어야합니다. – Arran

답변

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> 
관련 문제