sublyer 0 Denunciar post Postado Junho 9, 2008 Olá, estou com um problema em master page no .net framework 3.5, aonde eu criei uma master page e então nas páginas filhas adiciono um text box e um botão. Quando aciono o evento Click do botão com o text box preenchido, no evento do botão não pega o Text do textbox. Alguém saberia se eu tenho que colocar alguma referência ou algo do tipo?? Pois é muito estranho esse problema. Flwwww, grande abraço. Compartilhar este post Link para o post Compartilhar em outros sites
quintelab 91 Denunciar post Postado Junho 9, 2008 Mas o TextBox e o Botão estão no mesmo formulário?? Ou um esta na Master Page e o outro em um formulário filho?? Abraços... Compartilhar este post Link para o post Compartilhar em outros sites
sublyer 0 Denunciar post Postado Junho 9, 2008 Está dentro do contentplaceholder que a master page provê para as páginas filho Compartilhar este post Link para o post Compartilhar em outros sites
sublyer 0 Denunciar post Postado Junho 9, 2008 Segue o código da página filha: <%@ Page Language="C#" MasterPageFile="~/masterPageSite.master" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="produtos_Default" Title="Produtos - Loja virtual" EnableEventValidation="false" EnableViewState="true"%> <%@ MasterType VirtualPath="~/masterPageSite.master" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script src="/www/static/js/default.js" type="text/javascript"></script> <style type="text/css"> .style1 { height: 70px; } .style2 { width: 18%; height: 56px; } .style3 { height: 35px; } .style4 { height: 29px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:MultiView ID="multiViewProdutos" runat="server"> <asp:View ID="viewGridProdutos" runat="server"> <asp:GridView ID="gridViewProdutosCategoria" runat="server" Width="100%" AutoGenerateColumns="False" BorderStyle="None" GridLines="None" onrowdatabound="gridViewProdutosCategoria_RowDataBound" onselectedindexchanged="gridViewProdutosCategoria_SelectedIndexChanged"> <Columns> <asp:BoundField DataField="CODIGO" /> <asp:BoundField DataField="NOME" /> <asp:BoundField DataField="PRECO" /> <asp:TemplateField> <ItemTemplate> <br /> <asp:Label ID="labelProduto" runat="server" style="font-weight: 700" Text="Produto:"></asp:Label> <asp:Label ID="labelProdutoConteudo" runat="server"></asp:Label> <br /><br /> <asp:Label ID="labelPreco" runat="server" style="font-weight: 700" Text="Preço:"></asp:Label> <asp:Label ID="labelPrecoConteudo" runat="server"></asp:Label> <br /><br /> <asp:Label ID="labelDescricao" runat="server" style="font-weight: 700" Text="Descrição:"></asp:Label> <br /> <asp:Label ID="labelDescricaoConteudo" runat="server"></asp:Label> <br /><br /> </ItemTemplate> <ItemStyle CssClass="bordaInferiorGrid" /> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <br /> <asp:HyperLink ID="hyperLinkMaisDetalhes" runat="server" NavigateUrl="~/produtos/default.aspx">Mais detalhes</asp:HyperLink> </ItemTemplate> <ItemStyle CssClass="bordaInferiorGrid" /> </asp:TemplateField> <asp:BoundField DataField="DESCRICAO" /> </Columns> <EmptyDataTemplate> <br /> <br /> <center><asp:Label ID="labelNenhumProdutoEncontrado" runat="server" style="font-weight: 700" Text="Nenhum produto encontrado nesta categoria."></asp:Label> </center> </EmptyDataTemplate> </asp:GridView> </asp:View> <asp:View ID="viewConsultaProdutos" runat="server"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="4%" class="style2" colspan="2" rowspan="5"></td> <td width="82%"> <asp:Label ID="labelNomeProduto" runat="server" style="font-weight: 700" Text="Produto:"></asp:Label> <asp:Label ID="labelProdutoNomeConteudo" runat="server"></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="labelPreco" runat="server" style="font-weight: 700" Text="Preço:"></asp:Label> <asp:Label ID="labelPrecoProdutoConteudo" runat="server"></asp:Label> </td> </tr> <tr> <td> </td> </tr> <tr> <td class="style3"> <asp:Label ID="labelProdutoDescricao" runat="server" style="font-weight: 700" Text="Descrição:"></asp:Label> </td> </tr> <tr> <td rowspan="2"> </td> </tr> <tr> <td class="style1" colspan="2"></td> </tr> <tr> <td class="style4"></td> <td class="style4"></td> <td class="style4"> <asp:Label ID="Label1" runat="server" style="font-weight: 700" Text="Comprar: "></asp:Label> <asp:TextBox ID="textBoxQuantidade" runat="server" AutoPostBack="True"></asp:TextBox> <asp:Label ID="labelUnidadesConteudo" runat="server"></asp:Label> </td> </tr> <tr> <td> </td> <td> </td> <td> <asp:LinkButton ID="linkButtonAdicionarCarrinhoCompras" runat="server" onclick="linkButtonAdicionarCarrinhoCompras_Click">Adicionar ao carrinho</asp:LinkButton> / <asp:LinkButton ID="linkButtonRemoverCarrinhoCompras" runat="server" onclick="linkButtonRemoverCarrinhoCompras_Click">Remover</asp:LinkButton> </td> </tr> </table> </asp:View> </asp:MultiView> </asp:Content> O problema se encontra no trecho <asp:LinkButton ID="linkButtonAdicionarCarrinhoCompras" runat="server" onclick="linkButtonAdicionarCarrinhoCompras_Click">Adicionar ao carrinho</asp:LinkButton> / <asp:LinkButton ID="linkButtonRemoverCarrinhoCompras" runat="server" onclick="linkButtonRemoverCarrinhoCompras_Click">Remover</asp:Link Compartilhar este post Link para o post Compartilhar em outros sites
quintelab 91 Denunciar post Postado Junho 9, 2008 Mas o seu botão e o seu TextBox estão na mesma View?? Acho que pode ser isso. Abraços... Compartilhar este post Link para o post Compartilhar em outros sites
sublyer 0 Denunciar post Postado Junho 9, 2008 Estão sim, pode ver a view correspondente a ele é viewConsultaProdutos Flwww Compartilhar este post Link para o post Compartilhar em outros sites
quintelab 91 Denunciar post Postado Junho 9, 2008 Vélinho estranho, por que fiz o teste aqui e pegou o valor normalmente. Protected Sub linkButtonAdicionarCarrinhoCompras_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles linkButtonAdicionarCarrinhoCompras.Click Dim Valor As Integer = textBoxQuantidade.Text Response.Write(Valor) End Sub Funcionou normal kra. Abraços... Compartilhar este post Link para o post Compartilhar em outros sites
sublyer 0 Denunciar post Postado Junho 10, 2008 Bem estranho, vou reinstalar o visual studio pra verificar se o erro ocorre. Flwww Compartilhar este post Link para o post Compartilhar em outros sites