Here is the deal. I have a Master-Detail Grid scenario. The Master GridView is loaded when the page is loaded. I am using a DataView of same DataTable which loads the Master to load the Detail GridView, by filtering what I need to show in the DetailGridView. Everything works fine when I view the first row of the MasterGridView. When I try to view the second row, I the the error "column[number] not found. I also notice that the "table" variable is nothing.
public partial class Gridview_Template : System.Web.UI.Page
{
DataTable table = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
SqlDataReader reader = DBSqlHelperFactory.ExecuteReader(
myconnection,
"crm_getcustomersummary",
new SqlParameter("@customerid", "99999")
);
table.Load(reader);
MasterGridView.DataSource = table;
MasterGridView.DataBind();
}
protected void detailGrid_DataSelect(object sender, EventArgs e)
{
string searchValue ="number=" + values.ToString();
DataView dv = new DataView(
table, searchValue, "number", DataViewRowState.OriginalRows
);
DetailGridView.DataSource = dv;
// ...
}
}
Am I to put the "table" variable in a session state so it exists across call?