Question:

How to get the data in the gridview. By clicking on it the whole row information should appear in the textbox?

by  |  earlier

0 LIKES UnLike

I have four text boxes, from which i am inserting the data to the table and gridview assigns that table.

my intension is when we click on any of the rows the appropriate data should be present in the textboxes, so that i can edit it.

So can any one help me regarding this

thanks

jaya

 Tags:

   Report

1 ANSWERS


  1. DatagridView has many events, you can try another, but I think this best suits your requirement. ROWENTER event to

    display all row contents to your text box.

    ' heres a sample

    private void grid_RowEnter(object sender, DataGridViewCellEventArgs e)

    {

    string str1 = "";

    str1 = this.grid.Rows[e.RowIndex]

    .Cells[0].Value.ToString();

    this.textBox1.Text = str1;

    }

    hope this helps...

    this.grid.Rows[1].Cells[0] is one line

    I just cut it, for it to be displayed.

    tnx.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.