Jump to content
Fórum Script Brasil
  • 0

Porque ! ?


Renyo
 Share

Question

Boa tarde pessoal eu sei que hoje é sexta e tal.. ta todo mundo querendo ficar atoa e eu também :P

mas quero resolver essa bagaça aqui com a ajuda de você's ! :D

bem.. o que está acontecendo é o um seguinte eu tenho esses dados

------------------------------ PARTE C# -----------------------------------

protected void GridObjEspc_RowUpdating(object sender, GridViewUpdateEventArgs e)

{

try

{

this.InitializeComponent();

this.Conexao.Open();

this.Comando.CommandText = "UPDATE OBJETO_ESPECIF_SEG_SGS SET "+

"VLR_ATUAL_OBESSG = :VLR_ATUAL_OBESSG,"+

"VLR_NOVO_OBESSG = :VLR_NOVO_OBESSG,"+

"VLR_PMP_OBESSG = :VLR_PMP_OBESSG,"+

"VLR_PRMLIQ_OBESSG = :VLR_PRMLIQ_OBESSG "+

"WHERE NUM_ESPCSG = :NUM_ESPCSG "+

"AND NUM_OBESSG = :NUM_OBESSG "+

"AND NUM_VERSAO_OBESSG = :NUM_VERSAO_OBESSG";

GridViewRow gr = this.GridObjEspc.Rows[e.RowIndex];

string num = ((TextBox)gr.FindControl("txtVlrAtual")).Text; PEGANDO VALORES DO GRID

string teste0 = ((TextBox)gr.FindControl("txtVlrNovo")).Text; PEGANDO VALORES DO GRID

string teste1 = ((TextBox)gr.FindControl("txtVlrPMP")).Text; PEGANDO VALORES DO GRID

estas variáveis estão sempre vindo zerados... porque ??? SENDO QUE NO GRID EU COLOCO VALORES LÁ...qualquer coisa a parte html do código ta aí...

------------------ PARTE HTML DO CÓDIGO ------------------------

<asp:TemplateField HeaderText = "Valor Atual">

<ItemTemplate>

<asp:Label Visible="true" ID="lblVlrAtual" runat="server">

<%# DataBinder.Eval(Container.DataItem, "VLR_ATUAL_OBESSG")%>

</asp:Label>

</ItemTemplate>

<EditItemTemplate>

<asp:TextBox ID="txtVlrAtual" runat="server"

Text='<%# DataBinder.Eval(Container.DataItem,"VLR_ATUAL_OBESSG") %>'> </asp:TextBox>

</EditItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText = "Valor Novo">

<ItemTemplate>

<asp:Label Visible="true" ID="lblVlrNovo" runat="server">

<%# DataBinder.Eval(Container.DataItem, "VLR_NOVO_OBESSG")%>

</asp:Label>

</ItemTemplate>

<EditItemTemplate>

<asp:TextBox ID="txtVlrNovo" runat="server"

Text='<%# DataBinder.Eval(Container.DataItem,"VLR_NOVO_OBESSG") %>'> </asp:TextBox>

</EditItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText = "Valor PMP">

<ItemTemplate>

<asp:Label Visible="true" ID="lblVlrPMO" runat="server">

<%# DataBinder.Eval(Container.DataItem, "VLR_PMP_OBESSG")%>

</asp:Label>

</ItemTemplate>

<EditItemTemplate>

<asp:TextBox ID="txtVlrPMP" runat="server"

Text='<%# DataBinder.Eval(Container.DataItem,"VLR_PMP_OBESSG") %>'> </asp:TextBox>

</EditItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText = "Valor Prêmio Líquido">

<ItemTemplate>

<asp:Label Visible="true" ID="lblVlrPrmLiq" runat="server">

<%# DataBinder.Eval(Container.DataItem, "VLR_PRMLIQ_OBESSG")%>

</asp:Label>

</ItemTemplate>

<EditItemTemplate>

<asp:TextBox ID="txtVlrPrmLiq" runat="server"

Text='<%# DataBinder.Eval(Container.DataItem,"VLR_PRMLIQ_OBESSG") %>'> </asp:TextBox>

</EditItemTemplate>

</asp:TemplateField>

THANK'S!!!

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
Guest --Andre --

ops... errei xD....

Tente os dois.. HTMLinputText ou TextBox...

HtmlInputText nomevariavel = (HtmlInputText)e.Item.FindControl("Campo")

nomevariavel.Value

Link to comment
Share on other sites

  • 0

tentei assim.. olha o que visual me falo

Unable to cast object of type 'System.Web.UI.WebControls.TextBox' to type 'System.Web.UI.HtmlControls.HtmlInputText'.

GridViewRow gr = this.GridObjEspc.Rows[e.RowIndex];

HtmlInputText num = (HtmlInputText)gr.FindControl("txtVlrAtual");

int teste = int.Parse(num.Value);

Link to comment
Share on other sites

  • 0

Desisto !!!!!!!!!!!!!!

GridViewRow gr = this.GridObjEspc.Rows[e.RowIndex];

TextBox num = (TextBox)gr.FindControl("txtVlrNovo");

string teste1 = num.Text;

tente isso.. e a vairável teste1 só recebe zero...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.8k
    • Total Posts
      646.6k
×
×
  • Create New...