2013-10-03 2 views
0

В моем проекте есть количество страниц, наследующих одну и ту же главную страницу, и все отвечают за исключением 1 или 2 страницы, никаких изменений в коде не происходит. Я вставил точку останова на кнопку кнопки без эффекта. Как я могу проверить проблему. Пожалуйста, помогитеСтраница не обновляется при нажатии кнопки

Вот код моей страницы

<%@ Page Title="Product Stock" Language="C#" MasterPageFile="~/admin/AdminMaster.master" AutoEventWireup="true" CodeFile="ProductStock.aspx.cs" Inherits="admin_ProductStock" %> 

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> 
    <style type="text/css"> 
     .auto-style3 { 
      width: 259px; 
     } 
     .auto-style4 { 
      width: 479px; 
     } 
     .auto-style5 { 
      height: 65px; 
     } 
     .auto-style6 { 
      width: 479px; 
      height: 65px; 
     } 
     .auto-style7 { 
      height: 74px; 
     } 
     .auto-style8 { 
      width: 479px; 
      height: 74px; 
     } 
     .auto-style9 { 
      width: 69px; 
     } 
     .auto-style10 { 
      height: 74px; 
      width: 68px; 
     } 
     .auto-style11 { 
      height: 65px; 
      width: 68px; 
     } 
     .auto-style12 { 
      width: 68px; 
     } 
     .auto-style13 { 
      width: 451px; 
     } 
     .auto-style14 { 
      width: 451px; 
      height: 74px; 
     } 
     .auto-style15 { 
      width: 451px; 
      height: 65px; 
     } 
    </style> 
</asp:Content> 
<asp:Content ID="Content2" runat="server" contentplaceholderid="ContentPlaceHolder1"> 
    <table style="width:100%;"> 
     <tr> 
      <td> 
       <asp:Image ID="Image1" runat="server" Height="123px" ImageUrl="~/admin/images/insert.jpg" Width="158px" /> 
      </td> 
      <td class="auto-style4"> 
       <asp:Label ID="lblinsertion" runat="server" BackColor="#FFFF66" Font-Bold="True" Font-Italic="True" Font-Names="Euphemia" Font-Size="XX-Large" Font-Underline="True" ForeColor="#009900" Text="Insert Product Stock Information"></asp:Label> 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      </td> 
      <td class="auto-style12">&nbsp;</td> 
     </tr> 
     <tr> 
      <td class="auto-style5"> 
       <asp:Label ID="lblproductname" runat="server" Text="Product Name" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
      <td class="auto-style6"> 
       <asp:DropDownList ID="ddlprdctname" runat="server" Width="235px" ValidationGroup="vg1"></asp:DropDownList> 
      </td> 
      <td class="auto-style11"> 
       <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="ddlprdctname" ErrorMessage="Select Product Name" ValidationGroup="vg1"></asp:RequiredFieldValidator> 
      </td> 
     </tr> 

     <tr> 
      <td> 
       <asp:Label ID="lblquantity" runat="server" Text="Quantity" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
      <td class="auto-style4"> 
       <asp:TextBox ID="txtquantity" runat="server" Width="235px" ValidationGroup="vg1"></asp:TextBox> 
      </td> 
      <td class="auto-style12"> 
       <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="txtquantity" ErrorMessage="Enter Quantity" ValidationGroup="vg1"></asp:RequiredFieldValidator> 
      </td> 
     </tr> 

     <tr> 
      <td> 
       <asp:Label ID="lblstocktype" runat="server" Text="Stock Type" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
      <td class="auto-style4"> 
       <asp:DropDownList ID="ddlstocktype" runat="server" Width="235px" Height="42px" ValidationGroup="vg1"></asp:DropDownList> 
      </td> 
      <td class="auto-style12"> 
       <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="ddlstocktype" ErrorMessage="Please Enter Stock Type" ValidationGroup="vg1"></asp:RequiredFieldValidator> 
      </td> 
     </tr> 

     <tr> 
      <td> 
       <asp:Label ID="lblstockdate" runat="server" Text="Stock Date" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
      <td class="auto-style4"> 
       <asp:TextBox ID="txtstockdate" runat="server" ValidationGroup="vg1" Height="55px" Width="235px"></asp:TextBox> 
      </td> 
      <td class="auto-style12"> 
       <asp:Label ID="lbldateformat" runat="server" Text="dd/mm/yy"></asp:Label> 
       <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtstockdate" ErrorMessage="Please Enter Stock Date" ValidationGroup="vg1"></asp:RequiredFieldValidator> 
      </td> 
     </tr> 

     <tr> 
      <td class="auto-style3"></td> 
      <td class="auto-style4"> 
       <asp:Button ID="btnInsert" runat="server" Text="Insert" Width="125px" ValidationGroup="vg1" OnClick="btnInsert_Click" />    
      </td> 
      <td> 
       <asp:Button ID="check" runat="server" Text="Lets Check" /> 
      </td> 
      <td class="auto-style12">&nbsp;</td> 
     </tr> 
     <tr> 
      <td colspan="3"> 
       <asp:Label ID="lblmsg" runat="server" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
     </tr> 
    </table> 
</asp:Content> 

<asp:Content ID="Content3" runat="server" contentplaceholderid="ContentPlaceHolder2"> 
    <asp:Panel ID="ViewPanel" runat="server"> 
     <table style="width:100%;"> 
      <tr> 
       <td class="auto-style3"> 
        <asp:Image ID="Image2" runat="server" Height="100px" ImageUrl="~/admin/images/view.jpg" Width="133px" /> 
       </td> 
       <td> 
        <asp:Label ID="Label1" runat="server" BackColor="Yellow" Font-Bold="True" Font-Italic="True" Font-Names="Euphemia" Font-Size="XX-Large" Font-Underline="True" ForeColor="#009900" Text="View All Information"></asp:Label> 
       </td> 
       <td>&nbsp;</td> 
      </tr> 
     </table> 
    <asp:GridView ID="gridview" AutoGenerateColumns="false" runat="server" style="margin-left: 0px" AllowPaging="True" AllowSorting="True" CellPadding="3" Height="238px" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="Solid" BorderWidth="1px" CellSpacing="2" OnRowCommand="gridview_RowCommand" OnPageIndexChanging="gridview_PageIndexChanging"> 
     <Columns> 
      <asp:BoundField HeaderText="Stock ID" DataField="StockID" /> 
      <asp:BoundField HeaderText="Product Name" DataField="ProductID" /> 
      <asp:BoundField HeaderText="Quantity" DataField="Quantity" /> 
      <asp:BoundField HeaderText="Stock Type" DataField="StockType" /> 
      <asp:BoundField HeaderText="Stock Date" DataField="StockDate" /> 

      <asp:TemplateField HeaderText="Delete Record"> 
       <ItemTemplate> 
        <asp:Button ID="delete" OnClientClick="return confirm('Are You Sure To Delete The Record?')" Text="Delete This Record" CommandName="del" CommandArgument='<%# Eval("StockID") %>' runat="server" /> 
       </ItemTemplate> 
      </asp:TemplateField> 
      <asp:TemplateField HeaderText="Edit Record"> 
       <ItemTemplate> 
        <asp:Button ID="update" CommandName="upd" Text="Edit this Record" CommandArgument='<%# Eval("StockID") %>' runat="server" /> 
       </ItemTemplate> 
      </asp:TemplateField> 
     </Columns> 
     <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /> 
     <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /> 
     <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /> 
     <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /> 
     <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /> 
     <SortedAscendingCellStyle BackColor="#FFF1D4" /> 
     <SortedAscendingHeaderStyle BackColor="#B95C30" /> 
     <SortedDescendingCellStyle BackColor="#F1E5CE" /> 
     <SortedDescendingHeaderStyle BackColor="#93451F" /> 
     </asp:GridView> 

    <asp:Label ID="lblMessage" runat="server" Text=""></asp:Label> 
     </asp:Panel> 
    <br /> 

</asp:Content> 

<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3" Runat="Server"> 
<asp:Label ID="lblupdate" runat="server" Text="Select the record to be updated" Font-Names="Segoe Print" Font-Size=20></asp:Label> 

    <asp:Panel ID="UpdatePanel" runat="server"> 

<table style="width:100%;"> 
     <tr> 
      <td> 
       <asp:Image ID="Image3" runat="server" Height="123px" ImageUrl="~/admin/images/insert.jpg" Width="158px" /> 
      </td> 
      <td > 
       <asp:Label ID="lblupdupdation" runat="server" BackColor="#FFFF66" Font-Bold="True" Font-Italic="True" Font-Names="Euphemia" Font-Size="XX-Large" Font-Underline="True" ForeColor="#009900" Text="Update Product Stock Information"></asp:Label> 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
      </td> 
      <td >&nbsp;</td> 
     </tr> 
    <tr> 
      <td> 
       <asp:Label ID="lblupdstockid" runat="server" Text="Quantity" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
      <td> 
       <asp:TextBox ID="txtupdstockid" runat="server" ReadOnly="true" Width="235px"></asp:TextBox> 
      </td> 
      </tr> 
     <tr> 
      <td > 
       <asp:Label ID="lblupdproductname" runat="server" Text="Product Name" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
      <td > 
       <asp:DropDownList ID="ddlupdprdctname" runat="server" Width="235px"></asp:DropDownList> 
      </td> 
      <td > 
       <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ddlupdprdctname" ErrorMessage="Enter Product Name"></asp:RequiredFieldValidator> 
      </td> 
     </tr> 

     <tr> 
      <td> 
       <asp:Label ID="lblupdquantity" runat="server" Text="Quantity" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
      <td> 
       <asp:TextBox ID="txtupdquantity" runat="server" Width="235px"></asp:TextBox> 
      </td> 
      <td > 
       <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtupdquantity" ErrorMessage="Enter Quantity"></asp:RequiredFieldValidator> 
      </td> 
     </tr> 

     <tr> 
      <td> 
       <asp:Label ID="lblupdstocktype" runat="server" Text="Stock Type" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
      <td > 
       <asp:DropDownList ID="ddlupdstocktype" runat="server" Width="235px"></asp:DropDownList> 
      </td> 
      <td> 
       <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="ddlupdstocktype" ErrorMessage="Please Enter Stock Type"></asp:RequiredFieldValidator> 
      </td> 
     </tr> 

     <tr> 
      <td> 
       <asp:Label ID="lblupdstockdate" runat="server" Text="Stock Date" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
      <td> 
       <asp:TextBox ID="txtupdstockdate" runat="server" ValidationGroup="vg1" Height="16px" Width="235px"></asp:TextBox> 
      </td> 
      <td > 
       <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtupdstockdate" ErrorMessage="Please Enter Stock Date" ValidationGroup="vg1"></asp:RequiredFieldValidator> 
      </td> 
     </tr> 

     <tr> 
      <td></td> 
      <td > 
       <asp:Button ID="btnUpdate" runat="server" Text="Update" Width="125px" ValidationGroup="vg1" OnClick="btnUpdate_Click" /> 
      </td> 
      <td >&nbsp;</td> 
     </tr> 
     <tr> 
      <td colspan="3"> 
       <asp:Label ID="lblupdmsg" runat="server" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label> 
      </td> 
     </tr> 
    </table> 

    </asp:Panel> 
</asp:Content> 

Мой клиент сторона код кнопки

protected void btnInsert_Click(object sender, EventArgs e) 
    { 
     try 
     { 
     int productID, quantity; 
     string stockType; 
     DateTime stockDate; 

     productID = int.Parse(ddlprdctname.SelectedValue); 
     quantity = int.Parse(txtquantity.Text.Trim()); 
     stockType = ddlstocktype.SelectedValue.ToString().Trim(); 
     stockDate = DateTime.Parse(txtstockdate.Text.Trim()); 
     ProductStock prdctstock = new ProductStock(); 
     prdctstock.ProductID = productID; 
     prdctstock.Quantity = quantity; 
     prdctstock.StockType = stockType; 
     prdctstock.StockDate = stockDate; 
     if (new InsertAction().InsertData(prdctstock)) 
       { 
        lblmsg.Text = "Inserted Sucessfully"; 
        ViewPanel.Visible = true; 
       } 
       else 
       { 
        lblmsg.Text = "Please Check all the fields"; 
       } 

      BindGridView(); 
      ProductInfo prdctinfo = new ProductInfo(); 
      if (stockType == "In") 
      { 
       prdctinfo.Quantity += quantity; 
      } 
      if (stockType == "Out") 
      { 
       prdctinfo.Quantity -= quantity; 
      } 
      } 

      catch (Exception ex) 
     { 
      if (ex is FormatException) 
      { 
       lblmsg.Text = "Character value are not allowed"; 
      } 
      else 
      { 
       lblmsg.Text = ex.Message; 

      } 
     } 


    } 
+1

Перед тем, как мы сможем помочь, вам нужно показать код. Если бы все было правильно, вас бы здесь не было :) – CodingIntrigue

+0

можете ли вы поместить здесь какой-нибудь код? – Neel

+0

Если вы покажете нам свой код, мы можем вам помочь. –

ответ

0

Поместите контрольную точку где-то, где она попадает. Посмотрите на стек вызовов и перейдите к точке, когда вы обнаружите, почему она не идет к методу, который вы хотите вызвать. Невозможно многое сделать без дополнительной информации. Надеюсь, что это помогает

+2

Это должен быть комментарий, так как он не отвечает на вопрос о том, почему страница не обновляется при нажатии кнопки. Нет никакого способа узнать, почему в минуту, но это просто означает, что никто не может честно ответить на вопрос – CodingIntrigue

0

Я видел несколько нежелательных Кодекса

1), пожалуйста, удалите ValidationGroup="vg1" в ваших всех элементов управления ASP.NET, за исключением кнопки.

2) Не используйте панель, некоторое время кнопки мыши не работает на использование панели управления, поэтому, пожалуйста, используйте таблицу вместо панели (или удалить жерех:. Контроль панели)

3) и проверить, событие нажатия кнопки так же, как и на стороне сервера.

4) Если вы дадите мне наш код на стороне сервера, тогда я отвечу вам!

+0

сэр все остальные страницы тоже такие же, я использовал панель и validationgroup = "vg1", но они работают – VJain

+0

сэр я удалил все vg1, но все же такое же условие – VJain

+0

сэр все 4 точки изменены, но никаких изменений – VJain

Смежные вопросы