How do I access the Ids that are inside a Gridview?

Asked

Viewed 33 times

1

Example:

I want to take the amount that was typed into this TextBox and as soon as I trigger the button event bthResposta I can recover the same to be able to set the class properties./

Obs. To access this field, I click on a grid button that opens a popup inserir a descrição da imagem aqui

<asp:TextBox ID="txtComentario" runat="server" MaxLength="40" Width="800px"  MinLenght="15" Rows="5" TextMode="MultiLine"></asp:TextBox>

Event

protected void BtnResposta_Click(object sender, EventArgs e)
    {
        try
        {
            if (objWebItens.OcIOcorrencia > 0)
            {

                WebOcorrItens objItens = new WebOcorrItens();
                objItens.OcIOcorrencia = objWebItens.OcIOcorrencia;
                objItens.OcIAcao = "C";
                objItens.OcIDescr = // valor digitado no TextBox
                objItens.OcIDtCad = Convert.ToString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                objItens.OcIIdInc = (string)Session["login"];
                objItens.OcIDtInc = Convert.ToString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                objItens.OcIArea = objWebItens.OcIArea;
                objItens.InserirDados();
               if(objWebItens.ConsultarOcorrenciaItens(Convert.ToString(objWebItens.OcIOcorrencia)) > 0)
                {
                    WebOcorrencias webOcorrencias = new WebOcorrencias();
                    if (webOcorrencias.ConsultarOcorrencia(objItens.OcIOcorrencia.ToString()) > 0)
                    {
                        webOcorrencias.OcIdAlt = (string)Session["login"];
                        webOcorrencias.OcDtAlt = Convert.ToString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        //webOcorrencias.AlterarOcorrencia();
                    }

                    EnviarEmailChamado(objItens, "Resposta do Chamanto Nº " + objItens.OcIOcorrencia + "");
                }

            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.