Last post Jun 06, 2013 12:30 AM by Pengzhen Song - MSFT
Jun 04, 2013 09:15 PM|QEDDave|LINK
I want to put into a text box the value from the current row of a linq datasource. If I have it hooked up to a grid, I can go to that cell and pull it out but rather than have it in a grid I want it straight to a text box.
How do I get at a column value for the current row? For example:
StartDate = CDate(gvCerts.SelectedRow.Cells(2).Text) <<< this sets startDate to the grid cell value that is connected to my linq datasource.
What would I do to hook a text box up directly, say something like (but I know this isn't it):
Textbox1.text = LinqDataSource1.whateverTheCurrentRowIs.Field("StartDate")
Jun 06, 2013 12:30 AM|Pengzhen Song - MSFT|LINK
You can set the textbox value in the gridview selectedIndexchanged event like this
void CustomersGridView_SelectedIndexChanged(Object sender, EventArgs e)
// Get the currently selected row using the SelectedRow property.
GridViewRow row = CustomersGridView.SelectedRow;
TextBox1.Text = row.Cells[theFieldIndex].Text;
And refer here
Hope it can help you