I am in the midst of creating a re-usable composite control that just has a predefined grid on it, and a couple of text boxes to display customer information
I create a public datasource
public Customer DataSource
{
get{
object o = ViewState["DataSource"];
return (o == null)? null : (Customer)o;
}
set { ViewState["DataSource"]=value; }
}
and I override DataBind to do the custom mappings of the Cutomer object to each appropriate item
Customer is may up of various string variables and a List<Accounts> objects.
but when I put the statement
<cc:CustomerGrid Id="CustomerGrid" runat="server" DataSource='<% Eval("Customer") %>'>
The Databind runs before the assignment of the Datasoure, which I get because of the Eval statement.
I have looked into inheriting from DataboundControl. The one part that confuses me is the retrievedData parameter because my custom data does not adhere to IEnumerable.
Here is actual Code
So there is a list of Customer to an affiliation.
Thoughts on how to get the DataSource assigned before Databind Fires.
I create a public datasource
public Customer DataSource
{
get{
object o = ViewState["DataSource"];
return (o == null)? null : (Customer)o;
}
set { ViewState["DataSource"]=value; }
}
and I override DataBind to do the custom mappings of the Cutomer object to each appropriate item
Customer is may up of various string variables and a List<Accounts> objects.
but when I put the statement
<cc:CustomerGrid Id="CustomerGrid" runat="server" DataSource='<% Eval("Customer") %>'>
The Databind runs before the assignment of the Datasoure, which I get because of the Eval statement.
I have looked into inheriting from DataboundControl. The one part that confuses me is the retrievedData parameter because my custom data does not adhere to IEnumerable.
Here is actual Code
Code:
<asp:CompleteGridView ID="AffiliationGrid" runat="server"
AutoGenerateColumns="False" SkinID="Common">
<DetailTemplate>
<cc:CustomerGrid ID="CustomerGrid1" runat="server" DataSource='<%# Eval("Customer") %>'/>
</DetailTemplate>
So there is a list of Customer to an affiliation.
Thoughts on how to get the DataSource assigned before Databind Fires.