2017-04-05 16 views
0

基本的に私はLab4.aspxという名前のWebページフォームを持っていますが、毎回私はボタンを押して、常にスクリプトrunat = "server"とaspx.csではなく、私はBtnSubmitaspxページはaspx.csファイルに接続できませんでした

aspx.csについては
<script runat="server"> 

    Protected Sub Button1_Click(sender As Object, e As EventArgs) 

    End Sub 
</script> 

にそれを変更したときに、ボタンが戻っButton_1に変更され、私はすでに公共部分クラスのLAB4に公共の部分クラスを変更:aspx.csでSystem.Web.UI.Pageまた、ファイル名をLab4.aspx.csに設定してください。

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 

public partial class Lab4 : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 

    } 
    protected void BtnSubmit_Click(object sender, EventArgs e) 

このミステリーを解決することができれば素晴らしいと思います私はどこにでも

このソリューションの検索を試してみましたので、ここでaspxページ上のボタンコントロールのコードは

<asp:Button ID="BtnSubmit" runat="server" onclick="Button1_Click" Text="Submit" 
         Width="85px" /> 

だと、これはすべてのaspxがありますaspxページの完全なコード

<script runat="server"> 

    Protected Sub Button1_Click(sender As Object, e As EventArgs) 

    End Sub 
</script> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
    <style type="text/css"> 
     .style1 
     { 
      font-size: xx-large; 
      font-family: "Tw Cen MT"; 
      height: 1161px; 
     } 
     .style2 
     { 
      text-decoration: underline; 
     } 
     .style3 
     { 
      font-size: x-large; 
      background-color: #9933FF; 
     } 
     .style4 
     { 
      width: 100%; 
     } 
     .style5 
     { 
      width: 243px; 
     } 
     .style6 
     { 
      width: 609px; 
     } 
     .style7 
     { 
      width: 243px; 
      height: 32px; 
     } 
     .style8 
     { 
      width: 609px; 
      height: 32px; 
      background-color: #FFFFFF; 
     } 
     .style9 
     { 
      height: 32px; 
     } 
     .style10 
     { 
      background-color: #9966FF; 
     } 
     .style11 
     { 
      width: 243px; 
      height: 31px; 
     } 
     .style12 
     { 
      width: 609px; 
      height: 31px; 
     } 
     .style13 
     { 
      height: 31px; 
     } 
     .style14 
     { 
      width: 303px; 
      font-size: x-large; 
     } 
     .style15 
     { 
      width: 303px; 
      height: 41px; 
     } 
     .style16 
     { 
      height: 41px; 
     } 
     .style17 
     { 
      font-size: x-large; 
     } 
     .style20 
     { 
      width: 254px; 
     } 
     .style21 
     { 
      width: 254px; 
      height: 41px; 
     } 
     .style22 
     { 
      width: 243px; 
      height: 45px; 
     } 
     .style23 
     { 
      width: 609px; 
      height: 45px; 
     } 
     .style24 
     { 
      height: 45px; 
     } 
     .style25 
     { 
      width: 303px; 
      font-size: x-large; 
      height: 32px; 
     } 
     .style26 
     { 
      width: 254px; 
      height: 32px; 
     } 
    </style> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div class="style1"> 

     Nasi Tapau O<span class="style2">nline Order&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
     </span> 
     <br /> 
     <br /> 
     <span class="style3"><span class="style10">Customer&#39;s Details&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
     </span> 
     <br /> 
     <table class="style4"> 
      <tr> 
       <td class="style5"> 
        Name : 
       </td> 
       <td class="style6"> 
        <span class="style3"> 
        <asp:TextBox ID="TxtName" runat="server" Width="545px"></asp:TextBox> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style7"> 
       </td> 
       <td class="style8"> 
       </td> 
       <td class="style9"> 
       </td> 
       <td class="style9"> 
       </td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        Contact Number :</td> 
       <td class="style6"> 
        <span class="style3"> 
        <asp:TextBox ID="TxtContactNo" runat="server" Width="165px"></asp:TextBox> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        &nbsp;</td> 
       <td class="style6"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        Email :</td> 
       <td class="style6"> 
        <span class="style3"> 
        <asp:TextBox ID="TxtEmail" runat="server" Width="165px"></asp:TextBox> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style7"> 
       </td> 
       <td class="style8"> 
       </td> 
       <td class="style9"> 
       </td> 
       <td class="style9"> 
       </td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        Order Details :</td> 
       <td class="style6"> 
        &nbsp;</td> 
       <td> 
        Quantity : 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        &nbsp;</td> 
       <td class="style6"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        Rice :</td> 
       <td class="style6"> 
        <asp:RadioButton ID="RBYes" runat="server" Text="Yes" /> 
&nbsp;<span class="style3"><asp:RadioButton ID="RBNo" runat="server" 
         style="background-color: #FFFFFF" Text="No" /> 
        </span> 
       </td> 
       <td> 
        <span class="style3"> 
        <asp:TextBox ID="TxtQRice" runat="server" Width="165px"></asp:TextBox> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style22"> 
       </td> 
       <td class="style23"> 
       </td> 
       <td class="style24"> 
       </td> 
       <td class="style24"> 
       </td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        Side Dishes :</td> 
       <td class="style6"> 
        <asp:CheckBox ID="CBChicken" runat="server" style="background-color: #FFFFFF" Text="Chicken Curry - RM4.50" /> 
       </td> 
       <td> 
        <span class="style3"> 
        <asp:TextBox ID="TxtQChicken" runat="server" Width="165px"></asp:TextBox> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style7"> 
       </td> 
       <td class="style8"> 
     <span class="style3"> 
        <asp:CheckBox ID="CBMixed" runat="server" OnCheckedChanged="CBMixed_CheckedChanged" style="background-color: #FFFFFF" Text="Mixed Vegetables - RM2.50" /> 
     </span> 
       </td> 
       <td class="style9"> 
        <span class="style3"> 
        <asp:TextBox ID="TxtQMixed" runat="server" Width="165px"></asp:TextBox> 
        </span> 
       </td> 
       <td class="style9"> 
       </td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        &nbsp;</td> 
       <td class="style6"> 
     <span class="style3"> 
        <asp:CheckBox ID="CBGrilled" runat="server" style="background-color: #FFFFFF" Text="Grilled Fish - RM4.00" /> 
     </span> 
       </td> 
       <td> 
        <span class="style3"> 
        <asp:TextBox ID="TxtQGrilled" runat="server" Width="165px"></asp:TextBox> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style7"> 
       </td> 
       <td class="style8"> 
     <span class="style3"> 
        <asp:CheckBox ID="CBCondiment" runat="server" style="background-color: #FFFFFF" Text="Condiment - RM1.50" /> 
     </span> 
       </td> 
       <td class="style9"> 
        <span class="style3"> 
        <asp:TextBox ID="TxtQCondiment" runat="server" Width="165px"></asp:TextBox> 
        </span> 
       </td> 
       <td class="style9"> 
       </td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        Beverages :</td> 
       <td class="style6"> 
     <span class="style3"> 
        <asp:CheckBox ID="CBMangoJ" runat="server" style="background-color: #FFFFFF" Text="Mango Juice - RM3.00" /> 
     </span> 
       </td> 
       <td> 
        <span class="style3"> 
        <asp:TextBox ID="TxtMangoJuice" runat="server" Width="165px"></asp:TextBox> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        &nbsp;</td> 
       <td class="style6"> 
     <span class="style3"> 
        <asp:CheckBox ID="CBCendol" runat="server" style="background-color: #FFFFFF" Text="Cendol - RM3.00" /> 
     </span> 
       </td> 
       <td> 
        <span class="style3"> 
        <asp:TextBox ID="TxtCendol" runat="server" Width="165px"></asp:TextBox> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style5"> 
        &nbsp;</td> 
       <td class="style6"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style11"> 
        Delivery:</td> 
       <td class="style12"> 
        <asp:DropDownList ID="DdlDelivery" runat="server"> 
         <asp:ListItem Value="0">Self-pickup</asp:ListItem> 
         <asp:ListItem Value="1.50">Request For Delivery</asp:ListItem> 
        </asp:DropDownList> 
       </td> 
       <td class="style13"> 
       </td> 
       <td class="style13"> 
       </td> 
      </tr> 
      <tr> 
       <td class="style11"> 
        &nbsp;</td> 
       <td class="style12"> 
        &nbsp;</td> 
       <td class="style13"> 
        <asp:Button ID="BtnSubmit" runat="server" onclick="Button1_Click" Text="Submit" 
         Width="85px" /> 
       </td> 
       <td class="style13"> 
        &nbsp;</td> 
      </tr> 
     </table> 
     <br /> 
     <br /> 
     <asp:Label ID="Label1" runat="server" style="background-color: #9966FF" 
      Text="Thank you for choosing us! Here are you order details :"></asp:Label> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
     <br /> 
     <br /> 
     </span> 
     <table class="style4"> 
      <tr> 
       <td class="style14"> 
        <span class="style17">Name : 
       </td> 
       <td class="style20"> 
        <asp:Label ID="lblName" runat="server" Font-Size="X-Large"></asp:Label> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        Telephone :</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="LblTel" runat="server"></asp:Label> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        Email :</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="lblEmail" runat="server"></asp:Label> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td style="font-size: x-large"> 
        Quantity :</td> 
      </tr> 
      <tr> 
       <td class="style25"> 
        Rice :</td> 
       <td class="style26"> 
        <span class="style17"> 
        <asp:Label ID="lblRice" runat="server"></asp:Label> 
        </span> 
       </td> 
       <td class="style9"> 
        <span class="style17"> 
        <asp:Label ID="lblQRice" runat="server"></asp:Label> 
        </span> 
       </td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        Side Dishes :</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="Label6" runat="server" Visible="False"></asp:Label> 
        </span> 
       </td> 
       <td> 
        <span class="style17"> 
        <asp:Label ID="Label16" runat="server" Visible="False"></asp:Label> 
        </span> 
       </td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="Label7" runat="server" Visible="False"></asp:Label> 
        </span> 
       </td> 
       <td> 
        <span class="style17"> 
        <asp:Label ID="Label17" runat="server" Visible="False"></asp:Label> 
        </span> 
       </td> 
      </tr> 
      <tr> 
       <td class="style15"> 
       </td> 
       <td class="style21"> 
        <span class="style17"> 
        <asp:Label ID="Label8" runat="server" Visible="False"></asp:Label> 
        </span> 
       </td> 
       <td class="style16"> 
        <span class="style17"> 
        <asp:Label ID="Label18" runat="server" Visible="False"></asp:Label> 
        </span> 
       </td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="Label9" runat="server" Visible="False"></asp:Label> 
        </span> 
       </td> 
       <td> 
        <span class="style17"> 
        <asp:Label ID="Label19" runat="server" Visible="False"></asp:Label> 
        </span> 
       </td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        Beverages :</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="lblMangoJ" runat="server"></asp:Label> 
        </span> 
       </td> 
       <td> 
        <span class="style17"> 
        <asp:Label ID="lblQMangoJ" runat="server"></asp:Label> 
        </span> 
       </td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="lblCendol" runat="server"></asp:Label> 
        </span> 
       </td> 
       <td> 
        <span class="style17"> 
        <asp:Label ID="lblQCendol" runat="server"></asp:Label> 
        </span> 
       </td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        Delivery Method :</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="lblDelivery" runat="server"></asp:Label> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        Total :</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="lblTotal" runat="server"></asp:Label> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        Grand Total(Inclusive GST) :</td> 
       <td class="style20"> 
        <span class="style17"> 
        <asp:Label ID="lblTotalWGST" runat="server"></asp:Label> 
        </span> 
       </td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
      <tr> 
       <td class="style14"> 
        &nbsp;</td> 
       <td class="style20"> 
        &nbsp;</td> 
       <td> 
        &nbsp;</td> 
      </tr> 
     </table> 
     <br /> 
     <br /> 

    </div> 
    </form> 
</body> 
</html> 
+1

コードを使用し、ではない画像 –

+0

あなたはあなたのaspxページを表示することができ、私はあなたがpageディレクティブ – Krishna

+1

に何かが欠けていると確信してaspxページの完全なコード –

答えて

2

あなたのaspxページは実際には次のようなもので始まるはずです。

<%@ Page Title="" Language="C#" MasterPageFile="" AutoEventWireup="true" CodeBehind="Lab4.aspx.cs" Inherits="" %> 

CodeBehind = "Lab4.aspx.cs"は、C#のコードビハインドファイルを指定する場所です。

2

ですコンパイラにコード・ファイルを探す場所を指示するページ・ディレクティブ

<%@ Page CodeFile="Lab4.aspx.cs" %> 

documentation

関連する問題