Wednesday, August 11, 2010

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

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


jayaHow to get the data in the gridview. By clicking on it the whole row information should appear in the textbox?
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.
  • web hosting talk
  • loan
  • No comments:

    Post a Comment