I'm creating my first Visual Web Part project with Visual Studio 2010 (C#). The purpose of this simple project is to become better aquainted with the RadGrid control. There are basically two parts to it:
1. Add RadGrid control and bind to datasource using C#. The RadGrid has an edit and delete column.
2. Add a RadTextBox control to display the captured content of a specific cell when I click on the update option when editing the record.
Part 1 is pretty straightforward and seems to work fine. Here is the code that I run upon page load:
"SELECT Recipient, Email FROM Table1"
SqlConnection conn =
SqlCommand cmd =
SqlDataAdapter adapter =
DataTable recipients =
grid.DataSource = recipients;
The problem is with part 2. When I click on edit then update I want to capture the value in that row for the column labeled "Recipient".
I try to do this with the following code:
sender, GridCommandEventArgs e)
GridDataItem dataItem = e.Item
RadTextBox1.Text = dataItem[
Instead of getting the persons name displayed in the cell, all I get is " "; I've tried this several different ways, even using
the NeedDataSource method. The result is always the same.
Out of curiousity I counted the columns in the RadGrid immediately after binding with RadGrid1.columns.count and get 0. So the RadGrid displays the data from the datasource properly on page load, but I can't seem to access any of that data.
I can't figure this out and any guidance would be greatly appreciated.