I am trying to create a page that will display a dynamic set of results based on user input. The gist is that the results will look something would contain specific info about a customer site, followed by a grid with the detailed results for that particular location. Something like:
Site: sitename, city, state
grid w/ satisfaction survey results
The user would be able to pick either a single site, all of the sites that reports to them, or to a subset. Since this is a dynamic list, I thought it would be best to use a user control with the grid. I already have a datatable that has the results for all of the selected sites, so I want to pass the datatable to the user control, then let the control apply a filter.
So I created a user control, and the code-behind for it looks like:
Then I added a placeholder to my primary page, and added the following code:
When I set a breakpoint on the set property for dtResults, I am only getting a null value. So then when the page_load for the user control runs, the datasource is null. I don't get an error, I just don't get a grid either.
I will be very much appreciative if someone can point out what it is that I am doing wrong here.
Thank you!
Site: sitename, city, state
grid w/ satisfaction survey results
The user would be able to pick either a single site, all of the sites that reports to them, or to a subset. Since this is a dynamic list, I thought it would be best to use a user control with the grid. I already have a datatable that has the results for all of the selected sites, so I want to pass the datatable to the user control, then let the control apply a filter.
So I created a user control, and the code-behind for it looks like:
namespace
SurveyResults
{
public
partial
class
resultsGrid : System.Web.UI.UserControl
{
private
DataTable _dtResults =
null
;
public
DataTable dtResults
{
get
{
return
_dtResults;
}
set
{
_dtResults = dtResults;
}
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
gridResults.DataSource = _dtResults;
gridResults.Rebind();
}
}
}
Then I added a placeholder to my primary page, and added the following code:
// dtResults is a datatable that contains the results for all sites. I have verified that it does contain data at this point
_resultsGrid = (resultsGrid)Page.LoadControl(
"resultsGrid.ascx"
);
_resultsGrid.dtResults = dtResults;
phResults.Controls.Add(_resultsGrid);
When I set a breakpoint on the set property for dtResults, I am only getting a null value. So then when the page_load for the user control runs, the datasource is null. I don't get an error, I just don't get a grid either.
I will be very much appreciative if someone can point out what it is that I am doing wrong here.
Thank you!