2015-08-14 3 views
0

Я новичок в ASP.NET. Я взял Panel. Внутри Panel я взял столик. Внутри стола находятся TextBox, RadioButton и элементы управления Button.Как управлять кнопкой с панели

Я написал код в button_click события. Но ничего не происходит. button_click Событие не стреляет. Что теперь делать?

У меня есть и другие вещи в панели. Но событие click не работает.

код ниже:

<asp:Panel ID="Pnlproducts" runat="server" ScrollBars="Auto" Height="500px" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px"> 
    <asp:DataList ID="DLProducts" runat="server" RepeatColumns="3" Width="600px" OnSelectedIndexChanged="DLProducts_SelectedIndexChanged"> 
     <ItemTemplate > 
      <table align="left" class="auto-style6" style="border-color:#9900FF;border-left:1px;border-right:1px;border-top:1px;"> 
      <tr> 
       <td style="border-color: #000000; border-width: 1px; border-bottom-style: ridge" class="auto-style8"> 
        <asp:Label ID="lblProductName" runat="server" Text="<%# Bind('ProductName') %>" Font-Bold="True"></asp:Label> 
       </td> 
      </tr> 
      <tr> 
       <td class="auto-style9"> 
        <asp:Image ID="Image2" runat="server" Height="160px" ImageUrl="<%# Bind('ProductImage') %>" Width="173px" Style="border:ridge 1px black" /> 
       </td> 
      </tr> 
      <tr> 
       <td class="auto-style9"><strong>Price:</strong><asp:Label ID="lblPrice" runat="server" Text="<%# Bind('ProductPrice') %>" Font-Bold="True" ForeColor="Red"></asp:Label> 
       </td> 
      </tr> 
      <tr> 
       <td class="auto-style9"> 
        <asp:Button ID="Addtocartbtn" runat="server" BorderStyle="Solid" BorderWidth="1px" OnClick="Addtocartbtn_Click" Text="Add to Cart" Width="170px" BorderColor="Black" /> 
       </td> 
      </tr> 
      </table> 
     </ItemTemplate> 
    </asp:DataList>      
</asp:Panel> 
<asp:Panel ID="Panel111" runat="server" ScrollBars="Auto" Height="500px" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px"> 
    <table class="auto-style16"> 
     <tr> 
      <td>&nbsp;</td> 
      <td>&nbsp;</td> 
     </tr> 
     <tr> 
      <td>&nbsp;</td> 
      <td>&nbsp;</td> 
     </tr> 
    </table> 
</asp:Panel> 
</td> 

<td> 
    <asp:Panel ID="pnlCatagory" runat="server" Height="500px" ScrollBars="Auto" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px"> 

     <div class="auto-style7"> 
      <asp:DataList ID="dlCatagory" runat="server" BackColor="White" BorderColor="#CCCCCC" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Horizontal"> 
       <FooterStyle BackColor="#CCCC99" ForeColor="Black" /> 
       <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" /> 
       <ItemTemplate> 
        <asp:LinkButton ID="LBTNCatagoty" runat="server" CommandArgument="<%# Bind('CatagoryID') %>" Font-Bold="True" OnClick="LBTNCatagoty_Click" Text="<%# Bind('CatagoryName') %>"></asp:LinkButton> 
       </ItemTemplate> 
      </asp:DataList> 
     </div> 
    </asp:Panel> 
            <asp:Panel ID="Panel222" runat="server" Height="500px" ScrollBars="Auto" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px"> 
    <table class="auto-style10"> 
     <tr> 
      <td class="auto-style7" colspan="2"><strong>Please Type Your Details</strong></td> 
     </tr> 
     <tr> 
      <td class="auto-style12"></td> 
      <td class="auto-style11"></td> 
     </tr> 
     <tr> 
      <td class="auto-style15">Name :</td> 
      <td class="johnykbd8"> 
       <asp:TextBox ID="TextBoxUserName" runat="server" Width="180px"></asp:TextBox> 
      </td> 
     </tr> 
     <tr> 
      <td class="auto-style15">E-mail :</td> 
      <td class="johnykbd8"> 
       <asp:TextBox ID="TextBoxEmail" runat="server" Width="180px"></asp:TextBox> 
      </td> 
     </tr> 
     <tr> 
      <td class="auto-style15">Address:</td> 
      <td class="johnykbd8"> 
       <asp:TextBox ID="TextBoxAdress" runat="server" Height="90px" TextMode="MultiLine" Width="180px"></asp:TextBox> 
      </td> 
     </tr> 
     <tr> 
      <td class="auto-style15">Gender :</td> 
      <td> 
       <asp:RadioButton ID="RadioButton1" runat="server" GroupName="GenderGroup" Text="Male" /><br /> 
      &nbsp;<asp:RadioButton ID="RadioButton2" runat="server" GroupName="GenderGroup" Text="Female" /> 
      </td> 
     </tr> 
     <tr> 
      <td class="auto-style15">Mobile:</td> 
      <td class="johnykbd8"> 
       <asp:TextBox ID="TextBoxMobileNum" runat="server" Width="180px"></asp:TextBox> 
      </td> 
     </tr> 
     <tr> 
      <td class="auto-style15">Photo :</td> 
      <td class="johnykbd8"> 
       <asp:FileUpload ID="FileUploaduserphoto" runat="server" Width="180px" /> 
      </td> 
     </tr> 
     <tr> 
      <td class="auto-style15">Payment :</td> 
      <td> 
       <asp:RadioButton ID="RadioButton3" runat="server" GroupName="Paymentgroup" Text="Visa" /><br /> 
       <asp:RadioButton ID="RadioButton4" runat="server" GroupName="Paymentgroup" Text="MasterCard" /><br /> 
       <asp:RadioButton ID="RadioButton5" runat="server" GroupName="Paymentgroup" Text="Cash On Delivery" /> 
      </td> 
     </tr> 
     <tr> 
      <td class="auto-style15">Review :</td> 
      <td> 
       <asp:TextBox ID="TextBoxreview" runat="server" Width="180px"></asp:TextBox> 
      </td> 
     </tr> 
     <tr> 
      <td class="auto-style15">Total : </td> 
      <td>BDT :<asp:Label ID="Labelshopamount" runat="server"></asp:Label></td> 
     </tr> 
     <tr> 
      <td colspan="2"> 
       <asp:ImageButton ID="ImageButtonOrderNow" runat="server" ImageUrl="~/Images/Designing/order.jpg" OnClick="ImageButtonOrderNow_Click" Width="250px" /> 
      </td> 
     </tr> 
    </table> 
</asp:Panel> 
+3

Пожалуйста, разместите код и набросок со своей страницы. В настоящее время невозможно предоставить помощь. –

+0

Создайте минимальный пример, демонстрирующий вашу проблему, и не копируйте весь код. Желательно сделать что-то, что мы можем увидеть в таком инструменте, как https://jsfiddle.net/ – JensB

ответ

0

Если кнопка находится в DataList или GridView, например, установить свойство CommandName. Объект databound (datalist, gridview) имеет ItemCommand-event. Поместите код в это событие. Pseudo code:

if (e.CommandName.equals(your_command_name)){ label1.text = e.CommandArgument }; 
Смежные вопросы