Jump to content
Fórum Script Brasil
  • 0

Pegar Valor Do Grid


Renyo
 Share

Question

pessoa eu tenho um grid e quero pegar os valores dele.. estou no evento GridObjEspc_RowUpdating...

e sempre da isso...

+++++++++++++++++++++++++++++++++

Object reference not set to an instance of an object.

+++++++++++++++++++++++++++++++++

isso acontece já primeira linha... poque isso acontece.. :D

this.Comando.Parameters[0].Value = this.GridObjEspc.Rows[e.RowIndex].FindControl("NUM_ESPCSG").ToString();

this.Comando.Parameters[1].Value = this.GridObjEspc.Rows[e.RowIndex].FindControl("NUM_OBESSG").ToString();

valeuuu

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

E aí, não manjo muito de C#, e não entendi se você esta tentando obter o texto de uma coluna simples, ou de um controle que esta dentro da grid.

Vou postar a forma como faço no VB, talvez ajude.

Coluna Simples:

Dim vCodigo As String = gv.Rows(e.RowIndex).Cells(0).Text

Coluna com um controle (ex.: textBox):

Dim txtTexto As TextBox = gv.Rows(e.RowIndex).Cells(1).Controls(0)

Dim vTexto as String = txtTexto.Text

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...