| Home | Forums | Reviews | Guides | Newsgroups | Register | Search |
![]() |
| Thread Tools |
| TS |
|
|
|
| |
|
TS
Guest
Posts: n/a
|
Well i know it has something to do with the CREATEChildControls method
because when i overrode render instead of doing that method at all, the LoadPostData() was executed. I guess it has something to do with the controls being recreated each time, I DON"T KNOW. I need help all of you master coders "TS" <> wrote in message news:%... > i have a composite control that has dropdowns on them. The page will post > back on change, but their events won't raise. Can anyone tell me whats going > on? I tried to use the IPostBackDataHandler to try to get a hold of the > control to set values and such, but it has been no help. I'm confused at how > this control is supposed to work. I want it to be self contained so that > when a control changes, it posts back and then reloads its dependent drop > down lists with data that is filtered based on the value of the control that > changed. > > Every time the page posts back to server, the it hits the init and load > events and createchildcontrols, but thats it. i can't get into the > XXX_SelectedIndexChanged events for some reason even though they are wired > to do so. > > Any help will be appreaciated as i'm starting to feel dumb. > > using System; > > using System.Collections.Specialized; > > using System.Web.UI; > > using System.Web.UI.WebControls; > > using System.Text; > > using Operations.Teams.Business; > > using Operations.Teams.Data; > > using Operations.Teams.Reporting; > > using Operations.Teams.Reporting.WebControls; > > namespace Operations.Teams.Web.ReportControls > > { > > /// <summary> > > /// Summary description for FiscalAgentHierarchy. > > /// </summary> > > public class FiscalAgentHierarchy : Control, IReportParameterControl, > IPostBackDataHandler > > { > > public FiscalAgentHierarchy() > > { > > Parameters.Add(new Parameter("@SchoolYear")); > > Parameters.Add(new Parameter("@ReportingGroup")); > > Parameters.Add(new Parameter("@FiscalAgentID")); > > Parameters.Add(new Parameter("@FundingSourceID")); > > Parameters.Add(new Parameter("@ProviderID")); > > Parameters.Add(new Parameter("@SiteID")); > > Parameters.Add(new Parameter("@ClassID")); > > Parameters["@SchoolYear"].Value = 2006; > > } > > > #region Events > > > public bool LoadPostData(string postDataKey, NameValueCollection postData) > > { > > string postedValue = postData[postDataKey]; > > return true; > > } > > public void RaisePostDataChangedEvent() > > { > > rysReportingYearSelector_ReportingYearChanged(this , EventArgs.Empty); > > } > > protected override void LoadViewState(object savedState) > > { > > string zasdf="asdlfkjds"; > > } > > protected override object SaveViewState() > > { > > string zsad="asdf"; > > } > > protected override void OnInit(EventArgs e) > > { > > //this.EnsureChildControls(); > > > // Do whatever the control usually does OnInit > > base.OnInit(e); > > } > > protected override void OnLoad(EventArgs e) > > { > > //this.EnsureChildControls(); > > // Do whatever the control usually does OnInit > > base.OnLoad(e); > > } > > private void rysReportingYearSelector_ReportingYearChanged(obje ct sender, > EventArgs e) > > { > > this.LoadFundingSource(); > > this.LoadProviders(); > > } > > private void fasFiscalAgent_FiscalAgentChanged(object sender, EventArgs e) > > { > > this.LoadFundingSource(); > > this.LoadProviders(); > > } > > private void ddlProviders_SelectedIndexChanged(object sender, EventArgs e) > > { > > LoadSites(); > > } > > private void ddlSites_SelectedIndexChanged(object sender, EventArgs e) > > { > > LoadClasses(); > > } > > #endregion > > protected override void CreateChildControls() > > { > > rysReportingYearSelector = new ReportingYearReportSelector(); > > fasFiscalAgent = new FiscalAgentReportSelector(); > > this.ddlFundingSource = new DropDownList(); > > this.ddlProviders = new DropDownList(); > > this.ddlSites = new DropDownList(); > > this.ddlClasses = new DropDownList(); > > rysReportingYearSelector.ID = ReportingYearSelectorControlId; > > fasFiscalAgent.ID = FiscalAgentSelectorControlId; > > ddlFundingSource.ID = FundingSourceControlId; > > ddlProviders.ID = ProvidersControlId; > > ddlSites.ID = SitesControlId; > > ddlClasses.ID = ClassesControlId; > > // Assign these controls' Page property because when they try to access Page > they get null reference - apparently they aren't in the control tree at that > point > > rysReportingYearSelector.Page = this.Page; > > fasFiscalAgent.Page = this.Page; > > rysReportingYearSelector.ReportingYearChanged += new > EventHandler(rysReportingYearSelector_ReportingYea rChanged); > > fasFiscalAgent.FiscalAgentChanged += new > EventHandler(fasFiscalAgent_FiscalAgentChanged); > > ddlProviders.SelectedIndexChanged += new > EventHandler(ddlProviders_SelectedIndexChanged); > > ddlSites.SelectedIndexChanged += new > EventHandler(ddlSites_SelectedIndexChanged); > > fasFiscalAgent.IsSubmitOnChange = true; > > ddlProviders.AutoPostBack = true; > > ddlSites.AutoPostBack = true; > > // this.SchoolYear = rysReportingYearSelector.SchoolYear; > > // check if can populate funding sources and providers (because fiscalAgent > has been saved in session) > > if(this.fasFiscalAgent.SelectedFiscalAgentName != string.Empty) > > { > > LoadFundingSource(); > > LoadProviders(); > > } > > else > > { > > ddlFundingSource.Visible = false; > > ddlProviders.Visible = false; > > } > > // Initially set to false until their direct parent's selection has been > made (all other controls will have data on page load) > > ddlSites.Visible = false; > > ddlClasses.Visible = false; > > // start containing table > > this.Controls.Add(WebHelper.MakeLiteral("<table cellpadding=0 > cellspacing=0><tr><td>")); > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > this.Controls.Add(rysReportingYearSelector); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > this.Controls.Add(fasFiscalAgent); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Funding > Source</td><td>")); > > this.Controls.Add(ddlFundingSource); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Providers</td><td>") > ); > > this.Controls.Add(ddlProviders); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Sites</td><td>")); > > this.Controls.Add(ddlSites); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Classes</td><td>")); > > this.Controls.Add(ddlClasses); > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > // end containing table > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > } > > private void LoadFundingSource() > > { > > int fiscalAgentId = this.fasFiscalAgent.SelectedFiscalAgentId; > > > if(fiscalAgentId != int.MinValue) > > { > > this.ddlFundingSource.Visible = true; > > this.ddlFundingSource.DataSource = FiscalAgentFunding.Find(fiscalAgentId); > > this.ddlFundingSource.DataTextField = "ShortDescription"; > > this.ddlFundingSource.DataValueField = "CodeId"; > > this.ddlFundingSource.DataBind(); > > if(this.ddlFundingSource.Items.Count > 1) > > this.ddlFundingSource.Items.Insert(0, new ListItem(string.Empty, > string.Empty)); > > } > > else > > { > > this.ddlFundingSource.Visible = false; > > } > > } > > private void LoadProviders() > > { > > int fiscalAgentId = fasFiscalAgent.SelectedFiscalAgentId; > > if(fiscalAgentId != int.MinValue) > > { > > ddlProviders.Visible = true; > > ddlProviders.DataSource = FiscalAgentProvider.Find(fiscalAgentId, > rysReportingYearSelector.ReportingYearStartDate, > rysReportingYearSelector.ReportingYearEndDate); > > ddlProviders.DataTextField = "ProviderName"; > > ddlProviders.DataValueField = "ProviderId"; > > ddlProviders.DataBind(); > > ddlProviders.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > } > > else > > { > > this.ddlProviders.Items.Clear(); > > this.ddlProviders.Visible = false; > > } > > LoadSites(); > > } > > private void LoadSites() > > { > > if(ddlProviders.SelectedValue != string.Empty) > > { > > // Load the Site search parameters. > > SiteFindArgs siteFindArgs=new SiteFindArgs(); > > siteFindArgs.FiscalAgentId=Convert.ToInt32(fasFisc alAgent.SelectedFiscalAgen > tId); > > ddlSites.Visible = true; > > ddlSites.DataSource = Business.Site.Find(siteFindArgs); > > ddlSites.DataTextField = "Name"; > > ddlSites.DataValueField = "SiteId"; > > ddlSites.DataBind(); > > ddlSites.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > } > > else > > { > > ddlSites.Items.Clear(); > > ddlSites.Visible = false; > > } > > LoadClasses(); > > } > > private void LoadClasses() > > { > > if(ddlSites.SelectedValue != string.Empty) > > { > > ClassFindArgs adultEdClassFindArgs = new ClassFindArgs(); > > adultEdClassFindArgs.FiscalAgentId = > Convert.ToInt32(fasFiscalAgent.SelectedFiscalAgent Id); > > adultEdClassFindArgs.ReportingYearStartDate = > rysReportingYearSelector.ReportingYearStartDate; > > adultEdClassFindArgs.ReportingYearEndDate = > rysReportingYearSelector.ReportingYearEndDate; > > adultEdClassFindArgs.ProviderName = ddlProviders.SelectedValue; > > adultEdClassFindArgs.SiteName = ddlSites.SelectedValue; > > > ddlClasses.Visible = true; > > ddlClasses.DataSource = Class.Find(classFindArgs); > > ddlClasses.DataTextField = "Name"; > > ddlClasses.DataValueField = "ClassId"; > > ddlClasses.DataBind(); > > ddlClasses.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > } > > else > > { > > ddlClasses.Items.Clear(); > > ddlClasses.Visible = false; > > } > > } > > > > #region Public Properties > > #region IReportParameterControl Members > > public object ParameterValue > > { > > get{ return null; } > > set{ /*do nothing */ } > > } > > public ParameterCollection Parameters > > { > > get{ return parameters; } > > set{ parameters = value;} > > } > > #endregion > > public int SchoolYear > > { > > get{ return (int) ViewState["SchoolYear"]; } > > set{ ViewState["SchoolYear"] = value; } > > } > > #endregion > > #region Private Member Variables > > private ReportingYearReportSelector rysReportingYearSelector; > > private FiscalAgentReportSelector fasFiscalAgent; > > private DropDownList ddlFundingSource; > > private DropDownList ddlProviders; > > private DropDownList ddlSites; > > private DropDownList ddlClasses; > > private ParameterCollection parameters = new ParameterCollection(); > > #endregion > > #region Private Constants > > private const string ReportingYearSelectorControlId = > "rysReportingYearSelector"; > > private const string FiscalAgentSelectorControlId = > "fasFiscalAgentSelector"; > > private const string FundingSourceControlId = "ddlFundingSource"; > > private const string FundingSourceLabelControlId = "lblFundingSource"; > > private const string ProvidersControlId = "ddlProviders"; > > private const string ProvidersLabelControlId = "lblProviders"; > > private const string SitesControlId = "ddlSites"; > > private const string SitesLabelControlId = "lblSites"; > > private const string ClassesControlId = "ddlClasses"; > > private const string ClassesLabelControlId = "lblClasses"; > > #endregion > > } > > } > > |
|
|
|
|
|||
|
|||
| TS |
|
|
|
| |
|
TS
Guest
Posts: n/a
|
i followed the article at:
http://msdn.microsoft.com/library/de...singsample.asp and it works like that except like i said when I use createchildControls instead of render (because i need to render multiple controls), it doesn't hit those postback methods. thanks again "TS" <> wrote in message news:... > Well i know it has something to do with the CREATEChildControls method > because when i overrode render instead of doing that method at all, the > LoadPostData() was executed. I guess it has something to do with the > controls being recreated each time, I DON"T KNOW. > > I need help all of you master coders > > > "TS" <> wrote in message > news:%... > > i have a composite control that has dropdowns on them. The page will post > > back on change, but their events won't raise. Can anyone tell me whats > going > > on? I tried to use the IPostBackDataHandler to try to get a hold of the > > control to set values and such, but it has been no help. I'm confused at > how > > this control is supposed to work. I want it to be self contained so that > > when a control changes, it posts back and then reloads its dependent drop > > down lists with data that is filtered based on the value of the control > that > > changed. > > > > Every time the page posts back to server, the it hits the init and load > > events and createchildcontrols, but thats it. i can't get into the > > XXX_SelectedIndexChanged events for some reason even though they are wired > > to do so. > > > > Any help will be appreaciated as i'm starting to feel dumb. > > > > using System; > > > > using System.Collections.Specialized; > > > > using System.Web.UI; > > > > using System.Web.UI.WebControls; > > > > using System.Text; > > > > using Operations.Teams.Business; > > > > using Operations.Teams.Data; > > > > using Operations.Teams.Reporting; > > > > using Operations.Teams.Reporting.WebControls; > > > > namespace Operations.Teams.Web.ReportControls > > > > { > > > > /// <summary> > > > > /// Summary description for FiscalAgentHierarchy. > > > > /// </summary> > > > > public class FiscalAgentHierarchy : Control, IReportParameterControl, > > IPostBackDataHandler > > > > { > > > > public FiscalAgentHierarchy() > > > > { > > > > Parameters.Add(new Parameter("@SchoolYear")); > > > > Parameters.Add(new Parameter("@ReportingGroup")); > > > > Parameters.Add(new Parameter("@FiscalAgentID")); > > > > Parameters.Add(new Parameter("@FundingSourceID")); > > > > Parameters.Add(new Parameter("@ProviderID")); > > > > Parameters.Add(new Parameter("@SiteID")); > > > > Parameters.Add(new Parameter("@ClassID")); > > > > Parameters["@SchoolYear"].Value = 2006; > > > > } > > > > > > #region Events > > > > > > public bool LoadPostData(string postDataKey, NameValueCollection postData) > > > > { > > > > string postedValue = postData[postDataKey]; > > > > return true; > > > > } > > > > public void RaisePostDataChangedEvent() > > > > { > > > > rysReportingYearSelector_ReportingYearChanged(this , EventArgs.Empty); > > > > } > > > > protected override void LoadViewState(object savedState) > > > > { > > > > string zasdf="asdlfkjds"; > > > > } > > > > protected override object SaveViewState() > > > > { > > > > string zsad="asdf"; > > > > } > > > > protected override void OnInit(EventArgs e) > > > > { > > > > //this.EnsureChildControls(); > > > > > > // Do whatever the control usually does OnInit > > > > base.OnInit(e); > > > > } > > > > protected override void OnLoad(EventArgs e) > > > > { > > > > //this.EnsureChildControls(); > > > > // Do whatever the control usually does OnInit > > > > base.OnLoad(e); > > > > } > > > > private void rysReportingYearSelector_ReportingYearChanged(obje ct sender, > > EventArgs e) > > > > { > > > > this.LoadFundingSource(); > > > > this.LoadProviders(); > > > > } > > > > private void fasFiscalAgent_FiscalAgentChanged(object sender, EventArgs e) > > > > { > > > > this.LoadFundingSource(); > > > > this.LoadProviders(); > > > > } > > > > private void ddlProviders_SelectedIndexChanged(object sender, EventArgs e) > > > > { > > > > LoadSites(); > > > > } > > > > private void ddlSites_SelectedIndexChanged(object sender, EventArgs e) > > > > { > > > > LoadClasses(); > > > > } > > > > #endregion > > > > protected override void CreateChildControls() > > > > { > > > > rysReportingYearSelector = new ReportingYearReportSelector(); > > > > fasFiscalAgent = new FiscalAgentReportSelector(); > > > > this.ddlFundingSource = new DropDownList(); > > > > this.ddlProviders = new DropDownList(); > > > > this.ddlSites = new DropDownList(); > > > > this.ddlClasses = new DropDownList(); > > > > rysReportingYearSelector.ID = ReportingYearSelectorControlId; > > > > fasFiscalAgent.ID = FiscalAgentSelectorControlId; > > > > ddlFundingSource.ID = FundingSourceControlId; > > > > ddlProviders.ID = ProvidersControlId; > > > > ddlSites.ID = SitesControlId; > > > > ddlClasses.ID = ClassesControlId; > > > > // Assign these controls' Page property because when they try to access > Page > > they get null reference - apparently they aren't in the control tree at > that > > point > > > > rysReportingYearSelector.Page = this.Page; > > > > fasFiscalAgent.Page = this.Page; > > > > rysReportingYearSelector.ReportingYearChanged += new > > EventHandler(rysReportingYearSelector_ReportingYea rChanged); > > > > fasFiscalAgent.FiscalAgentChanged += new > > EventHandler(fasFiscalAgent_FiscalAgentChanged); > > > > ddlProviders.SelectedIndexChanged += new > > EventHandler(ddlProviders_SelectedIndexChanged); > > > > ddlSites.SelectedIndexChanged += new > > EventHandler(ddlSites_SelectedIndexChanged); > > > > fasFiscalAgent.IsSubmitOnChange = true; > > > > ddlProviders.AutoPostBack = true; > > > > ddlSites.AutoPostBack = true; > > > > // this.SchoolYear = rysReportingYearSelector.SchoolYear; > > > > // check if can populate funding sources and providers (because > fiscalAgent > > has been saved in session) > > > > if(this.fasFiscalAgent.SelectedFiscalAgentName != string.Empty) > > > > { > > > > LoadFundingSource(); > > > > LoadProviders(); > > > > } > > > > else > > > > { > > > > ddlFundingSource.Visible = false; > > > > ddlProviders.Visible = false; > > > > } > > > > // Initially set to false until their direct parent's selection has been > > made (all other controls will have data on page load) > > > > ddlSites.Visible = false; > > > > ddlClasses.Visible = false; > > > > // start containing table > > > > this.Controls.Add(WebHelper.MakeLiteral("<table cellpadding=0 > > cellspacing=0><tr><td>")); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > > > this.Controls.Add(rysReportingYearSelector); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > > > this.Controls.Add(fasFiscalAgent); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Funding > > Source</td><td>")); > > > > this.Controls.Add(ddlFundingSource); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Providers</td><td>") > > ); > > > > this.Controls.Add(ddlProviders); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Sites</td><td>")); > > > > this.Controls.Add(ddlSites); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Classes</td><td>")); > > > > this.Controls.Add(ddlClasses); > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > // end containing table > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > } > > > > private void LoadFundingSource() > > > > { > > > > int fiscalAgentId = this.fasFiscalAgent.SelectedFiscalAgentId; > > > > > > if(fiscalAgentId != int.MinValue) > > > > { > > > > this.ddlFundingSource.Visible = true; > > > > this.ddlFundingSource.DataSource = FiscalAgentFunding.Find(fiscalAgentId); > > > > this.ddlFundingSource.DataTextField = "ShortDescription"; > > > > this.ddlFundingSource.DataValueField = "CodeId"; > > > > this.ddlFundingSource.DataBind(); > > > > if(this.ddlFundingSource.Items.Count > 1) > > > > this.ddlFundingSource.Items.Insert(0, new ListItem(string.Empty, > > string.Empty)); > > > > } > > > > else > > > > { > > > > this.ddlFundingSource.Visible = false; > > > > } > > > > } > > > > private void LoadProviders() > > > > { > > > > int fiscalAgentId = fasFiscalAgent.SelectedFiscalAgentId; > > > > if(fiscalAgentId != int.MinValue) > > > > { > > > > ddlProviders.Visible = true; > > > > ddlProviders.DataSource = FiscalAgentProvider.Find(fiscalAgentId, > > rysReportingYearSelector.ReportingYearStartDate, > > rysReportingYearSelector.ReportingYearEndDate); > > > > ddlProviders.DataTextField = "ProviderName"; > > > > ddlProviders.DataValueField = "ProviderId"; > > > > ddlProviders.DataBind(); > > > > ddlProviders.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > > > } > > > > else > > > > { > > > > this.ddlProviders.Items.Clear(); > > > > this.ddlProviders.Visible = false; > > > > } > > > > LoadSites(); > > > > } > > > > private void LoadSites() > > > > { > > > > if(ddlProviders.SelectedValue != string.Empty) > > > > { > > > > // Load the Site search parameters. > > > > SiteFindArgs siteFindArgs=new SiteFindArgs(); > > > > > siteFindArgs.FiscalAgentId=Convert.ToInt32(fasFisc alAgent.SelectedFiscalAgen > > tId); > > > > ddlSites.Visible = true; > > > > ddlSites.DataSource = Business.Site.Find(siteFindArgs); > > > > ddlSites.DataTextField = "Name"; > > > > ddlSites.DataValueField = "SiteId"; > > > > ddlSites.DataBind(); > > > > ddlSites.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > > > } > > > > else > > > > { > > > > ddlSites.Items.Clear(); > > > > ddlSites.Visible = false; > > > > } > > > > LoadClasses(); > > > > } > > > > private void LoadClasses() > > > > { > > > > if(ddlSites.SelectedValue != string.Empty) > > > > { > > > > ClassFindArgs adultEdClassFindArgs = new ClassFindArgs(); > > > > adultEdClassFindArgs.FiscalAgentId = > > Convert.ToInt32(fasFiscalAgent.SelectedFiscalAgent Id); > > > > adultEdClassFindArgs.ReportingYearStartDate = > > rysReportingYearSelector.ReportingYearStartDate; > > > > adultEdClassFindArgs.ReportingYearEndDate = > > rysReportingYearSelector.ReportingYearEndDate; > > > > adultEdClassFindArgs.ProviderName = ddlProviders.SelectedValue; > > > > adultEdClassFindArgs.SiteName = ddlSites.SelectedValue; > > > > > > ddlClasses.Visible = true; > > > > ddlClasses.DataSource = Class.Find(classFindArgs); > > > > ddlClasses.DataTextField = "Name"; > > > > ddlClasses.DataValueField = "ClassId"; > > > > ddlClasses.DataBind(); > > > > ddlClasses.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > > > } > > > > else > > > > { > > > > ddlClasses.Items.Clear(); > > > > ddlClasses.Visible = false; > > > > } > > > > } > > > > > > > > #region Public Properties > > > > #region IReportParameterControl Members > > > > public object ParameterValue > > > > { > > > > get{ return null; } > > > > set{ /*do nothing */ } > > > > } > > > > public ParameterCollection Parameters > > > > { > > > > get{ return parameters; } > > > > set{ parameters = value;} > > > > } > > > > #endregion > > > > public int SchoolYear > > > > { > > > > get{ return (int) ViewState["SchoolYear"]; } > > > > set{ ViewState["SchoolYear"] = value; } > > > > } > > > > #endregion > > > > #region Private Member Variables > > > > private ReportingYearReportSelector rysReportingYearSelector; > > > > private FiscalAgentReportSelector fasFiscalAgent; > > > > private DropDownList ddlFundingSource; > > > > private DropDownList ddlProviders; > > > > private DropDownList ddlSites; > > > > private DropDownList ddlClasses; > > > > private ParameterCollection parameters = new ParameterCollection(); > > > > #endregion > > > > #region Private Constants > > > > private const string ReportingYearSelectorControlId = > > "rysReportingYearSelector"; > > > > private const string FiscalAgentSelectorControlId = > > "fasFiscalAgentSelector"; > > > > private const string FundingSourceControlId = "ddlFundingSource"; > > > > private const string FundingSourceLabelControlId = "lblFundingSource"; > > > > private const string ProvidersControlId = "ddlProviders"; > > > > private const string ProvidersLabelControlId = "lblProviders"; > > > > private const string SitesControlId = "ddlSites"; > > > > private const string SitesLabelControlId = "lblSites"; > > > > private const string ClassesControlId = "ddlClasses"; > > > > private const string ClassesLabelControlId = "lblClasses"; > > > > #endregion > > > > } > > > > } > > > > > > |
|
|
|
|
|||
|
|||
| TS |
|
TS
Guest
Posts: n/a
|
I think i maybe should be doing this at all because i can just access the
control's value because that control handles the functionality automatically that I was trying to do. If this is so, then i still have a problem: How do i raise events in my control for controls i have created in createchildcontrols? I have the controls wired up to event handlers, but they are never hit. What do i need to do? thanks "TS" <> wrote in message news:... > i followed the article at: > http://msdn.microsoft.com/library/de...singsample.asp > and it works like that except like i said when I use createchildControls > instead of render (because i need to render multiple controls), it doesn't > hit those postback methods. > > thanks again > > "TS" <> wrote in message > news:... > > Well i know it has something to do with the CREATEChildControls method > > because when i overrode render instead of doing that method at all, the > > LoadPostData() was executed. I guess it has something to do with the > > controls being recreated each time, I DON"T KNOW. > > > > I need help all of you master coders > > > > > > "TS" <> wrote in message > > news:%... > > > i have a composite control that has dropdowns on them. The page will > post > > > back on change, but their events won't raise. Can anyone tell me whats > > going > > > on? I tried to use the IPostBackDataHandler to try to get a hold of the > > > control to set values and such, but it has been no help. I'm confused at > > how > > > this control is supposed to work. I want it to be self contained so that > > > when a control changes, it posts back and then reloads its dependent > drop > > > down lists with data that is filtered based on the value of the control > > that > > > changed. > > > > > > Every time the page posts back to server, the it hits the init and load > > > events and createchildcontrols, but thats it. i can't get into the > > > XXX_SelectedIndexChanged events for some reason even though they are > wired > > > to do so. > > > > > > Any help will be appreaciated as i'm starting to feel dumb. > > > > > > using System; > > > > > > using System.Collections.Specialized; > > > > > > using System.Web.UI; > > > > > > using System.Web.UI.WebControls; > > > > > > using System.Text; > > > > > > using Operations.Teams.Business; > > > > > > using Operations.Teams.Data; > > > > > > using Operations.Teams.Reporting; > > > > > > using Operations.Teams.Reporting.WebControls; > > > > > > namespace Operations.Teams.Web.ReportControls > > > > > > { > > > > > > /// <summary> > > > > > > /// Summary description for FiscalAgentHierarchy. > > > > > > /// </summary> > > > > > > public class FiscalAgentHierarchy : Control, IReportParameterControl, > > > IPostBackDataHandler > > > > > > { > > > > > > public FiscalAgentHierarchy() > > > > > > { > > > > > > Parameters.Add(new Parameter("@SchoolYear")); > > > > > > Parameters.Add(new Parameter("@ReportingGroup")); > > > > > > Parameters.Add(new Parameter("@FiscalAgentID")); > > > > > > Parameters.Add(new Parameter("@FundingSourceID")); > > > > > > Parameters.Add(new Parameter("@ProviderID")); > > > > > > Parameters.Add(new Parameter("@SiteID")); > > > > > > Parameters.Add(new Parameter("@ClassID")); > > > > > > Parameters["@SchoolYear"].Value = 2006; > > > > > > } > > > > > > > > > #region Events > > > > > > > > > public bool LoadPostData(string postDataKey, NameValueCollection > postData) > > > > > > { > > > > > > string postedValue = postData[postDataKey]; > > > > > > return true; > > > > > > } > > > > > > public void RaisePostDataChangedEvent() > > > > > > { > > > > > > rysReportingYearSelector_ReportingYearChanged(this , EventArgs.Empty); > > > > > > } > > > > > > protected override void LoadViewState(object savedState) > > > > > > { > > > > > > string zasdf="asdlfkjds"; > > > > > > } > > > > > > protected override object SaveViewState() > > > > > > { > > > > > > string zsad="asdf"; > > > > > > } > > > > > > protected override void OnInit(EventArgs e) > > > > > > { > > > > > > //this.EnsureChildControls(); > > > > > > > > > // Do whatever the control usually does OnInit > > > > > > base.OnInit(e); > > > > > > } > > > > > > protected override void OnLoad(EventArgs e) > > > > > > { > > > > > > //this.EnsureChildControls(); > > > > > > // Do whatever the control usually does OnInit > > > > > > base.OnLoad(e); > > > > > > } > > > > > > private void rysReportingYearSelector_ReportingYearChanged(obje ct > sender, > > > EventArgs e) > > > > > > { > > > > > > this.LoadFundingSource(); > > > > > > this.LoadProviders(); > > > > > > } > > > > > > private void fasFiscalAgent_FiscalAgentChanged(object sender, EventArgs > e) > > > > > > { > > > > > > this.LoadFundingSource(); > > > > > > this.LoadProviders(); > > > > > > } > > > > > > private void ddlProviders_SelectedIndexChanged(object sender, EventArgs > e) > > > > > > { > > > > > > LoadSites(); > > > > > > } > > > > > > private void ddlSites_SelectedIndexChanged(object sender, EventArgs e) > > > > > > { > > > > > > LoadClasses(); > > > > > > } > > > > > > #endregion > > > > > > protected override void CreateChildControls() > > > > > > { > > > > > > rysReportingYearSelector = new ReportingYearReportSelector(); > > > > > > fasFiscalAgent = new FiscalAgentReportSelector(); > > > > > > this.ddlFundingSource = new DropDownList(); > > > > > > this.ddlProviders = new DropDownList(); > > > > > > this.ddlSites = new DropDownList(); > > > > > > this.ddlClasses = new DropDownList(); > > > > > > rysReportingYearSelector.ID = ReportingYearSelectorControlId; > > > > > > fasFiscalAgent.ID = FiscalAgentSelectorControlId; > > > > > > ddlFundingSource.ID = FundingSourceControlId; > > > > > > ddlProviders.ID = ProvidersControlId; > > > > > > ddlSites.ID = SitesControlId; > > > > > > ddlClasses.ID = ClassesControlId; > > > > > > // Assign these controls' Page property because when they try to access > > Page > > > they get null reference - apparently they aren't in the control tree at > > that > > > point > > > > > > rysReportingYearSelector.Page = this.Page; > > > > > > fasFiscalAgent.Page = this.Page; > > > > > > rysReportingYearSelector.ReportingYearChanged += new > > > EventHandler(rysReportingYearSelector_ReportingYea rChanged); > > > > > > fasFiscalAgent.FiscalAgentChanged += new > > > EventHandler(fasFiscalAgent_FiscalAgentChanged); > > > > > > ddlProviders.SelectedIndexChanged += new > > > EventHandler(ddlProviders_SelectedIndexChanged); > > > > > > ddlSites.SelectedIndexChanged += new > > > EventHandler(ddlSites_SelectedIndexChanged); > > > > > > fasFiscalAgent.IsSubmitOnChange = true; > > > > > > ddlProviders.AutoPostBack = true; > > > > > > ddlSites.AutoPostBack = true; > > > > > > // this.SchoolYear = rysReportingYearSelector.SchoolYear; > > > > > > // check if can populate funding sources and providers (because > > fiscalAgent > > > has been saved in session) > > > > > > if(this.fasFiscalAgent.SelectedFiscalAgentName != string.Empty) > > > > > > { > > > > > > LoadFundingSource(); > > > > > > LoadProviders(); > > > > > > } > > > > > > else > > > > > > { > > > > > > ddlFundingSource.Visible = false; > > > > > > ddlProviders.Visible = false; > > > > > > } > > > > > > // Initially set to false until their direct parent's selection has been > > > made (all other controls will have data on page load) > > > > > > ddlSites.Visible = false; > > > > > > ddlClasses.Visible = false; > > > > > > // start containing table > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table cellpadding=0 > > > cellspacing=0><tr><td>")); > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > > > > > this.Controls.Add(rysReportingYearSelector); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > > > > > this.Controls.Add(fasFiscalAgent); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Funding > > > Source</td><td>")); > > > > > > this.Controls.Add(ddlFundingSource); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Providers</td><td>") > > > ); > > > > > > this.Controls.Add(ddlProviders); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Sites</td><td>")); > > > > > > this.Controls.Add(ddlSites); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Classes</td><td>")); > > > > > > this.Controls.Add(ddlClasses); > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > // end containing table > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > } > > > > > > private void LoadFundingSource() > > > > > > { > > > > > > int fiscalAgentId = this.fasFiscalAgent.SelectedFiscalAgentId; > > > > > > > > > if(fiscalAgentId != int.MinValue) > > > > > > { > > > > > > this.ddlFundingSource.Visible = true; > > > > > > this.ddlFundingSource.DataSource = > FiscalAgentFunding.Find(fiscalAgentId); > > > > > > this.ddlFundingSource.DataTextField = "ShortDescription"; > > > > > > this.ddlFundingSource.DataValueField = "CodeId"; > > > > > > this.ddlFundingSource.DataBind(); > > > > > > if(this.ddlFundingSource.Items.Count > 1) > > > > > > this.ddlFundingSource.Items.Insert(0, new ListItem(string.Empty, > > > string.Empty)); > > > > > > } > > > > > > else > > > > > > { > > > > > > this.ddlFundingSource.Visible = false; > > > > > > } > > > > > > } > > > > > > private void LoadProviders() > > > > > > { > > > > > > int fiscalAgentId = fasFiscalAgent.SelectedFiscalAgentId; > > > > > > if(fiscalAgentId != int.MinValue) > > > > > > { > > > > > > ddlProviders.Visible = true; > > > > > > ddlProviders.DataSource = FiscalAgentProvider.Find(fiscalAgentId, > > > rysReportingYearSelector.ReportingYearStartDate, > > > rysReportingYearSelector.ReportingYearEndDate); > > > > > > ddlProviders.DataTextField = "ProviderName"; > > > > > > ddlProviders.DataValueField = "ProviderId"; > > > > > > ddlProviders.DataBind(); > > > > > > ddlProviders.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > > > > > } > > > > > > else > > > > > > { > > > > > > this.ddlProviders.Items.Clear(); > > > > > > this.ddlProviders.Visible = false; > > > > > > } > > > > > > LoadSites(); > > > > > > } > > > > > > private void LoadSites() > > > > > > { > > > > > > if(ddlProviders.SelectedValue != string.Empty) > > > > > > { > > > > > > // Load the Site search parameters. > > > > > > SiteFindArgs siteFindArgs=new SiteFindArgs(); > > > > > > > > > siteFindArgs.FiscalAgentId=Convert.ToInt32(fasFisc alAgent.SelectedFiscalAgen > > > tId); > > > > > > ddlSites.Visible = true; > > > > > > ddlSites.DataSource = Business.Site.Find(siteFindArgs); > > > > > > ddlSites.DataTextField = "Name"; > > > > > > ddlSites.DataValueField = "SiteId"; > > > > > > ddlSites.DataBind(); > > > > > > ddlSites.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > > > > > } > > > > > > else > > > > > > { > > > > > > ddlSites.Items.Clear(); > > > > > > ddlSites.Visible = false; > > > > > > } > > > > > > LoadClasses(); > > > > > > } > > > > > > private void LoadClasses() > > > > > > { > > > > > > if(ddlSites.SelectedValue != string.Empty) > > > > > > { > > > > > > ClassFindArgs adultEdClassFindArgs = new ClassFindArgs(); > > > > > > adultEdClassFindArgs.FiscalAgentId = > > > Convert.ToInt32(fasFiscalAgent.SelectedFiscalAgent Id); > > > > > > adultEdClassFindArgs.ReportingYearStartDate = > > > rysReportingYearSelector.ReportingYearStartDate; > > > > > > adultEdClassFindArgs.ReportingYearEndDate = > > > rysReportingYearSelector.ReportingYearEndDate; > > > > > > adultEdClassFindArgs.ProviderName = ddlProviders.SelectedValue; > > > > > > adultEdClassFindArgs.SiteName = ddlSites.SelectedValue; > > > > > > > > > ddlClasses.Visible = true; > > > > > > ddlClasses.DataSource = Class.Find(classFindArgs); > > > > > > ddlClasses.DataTextField = "Name"; > > > > > > ddlClasses.DataValueField = "ClassId"; > > > > > > ddlClasses.DataBind(); > > > > > > ddlClasses.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > > > > > } > > > > > > else > > > > > > { > > > > > > ddlClasses.Items.Clear(); > > > > > > ddlClasses.Visible = false; > > > > > > } > > > > > > } > > > > > > > > > > > > #region Public Properties > > > > > > #region IReportParameterControl Members > > > > > > public object ParameterValue > > > > > > { > > > > > > get{ return null; } > > > > > > set{ /*do nothing */ } > > > > > > } > > > > > > public ParameterCollection Parameters > > > > > > { > > > > > > get{ return parameters; } > > > > > > set{ parameters = value;} > > > > > > } > > > > > > #endregion > > > > > > public int SchoolYear > > > > > > { > > > > > > get{ return (int) ViewState["SchoolYear"]; } > > > > > > set{ ViewState["SchoolYear"] = value; } > > > > > > } > > > > > > #endregion > > > > > > #region Private Member Variables > > > > > > private ReportingYearReportSelector rysReportingYearSelector; > > > > > > private FiscalAgentReportSelector fasFiscalAgent; > > > > > > private DropDownList ddlFundingSource; > > > > > > private DropDownList ddlProviders; > > > > > > private DropDownList ddlSites; > > > > > > private DropDownList ddlClasses; > > > > > > private ParameterCollection parameters = new ParameterCollection(); > > > > > > #endregion > > > > > > #region Private Constants > > > > > > private const string ReportingYearSelectorControlId = > > > "rysReportingYearSelector"; > > > > > > private const string FiscalAgentSelectorControlId = > > > "fasFiscalAgentSelector"; > > > > > > private const string FundingSourceControlId = "ddlFundingSource"; > > > > > > private const string FundingSourceLabelControlId = "lblFundingSource"; > > > > > > private const string ProvidersControlId = "ddlProviders"; > > > > > > private const string ProvidersLabelControlId = "lblProviders"; > > > > > > private const string SitesControlId = "ddlSites"; > > > > > > private const string SitesLabelControlId = "lblSites"; > > > > > > private const string ClassesControlId = "ddlClasses"; > > > > > > private const string ClassesLabelControlId = "lblClasses"; > > > > > > #endregion > > > > > > } > > > > > > } > > > > > > > > > > > > |
|
|
|
|
|||
|
|||
| TS |
|
TS
Guest
Posts: n/a
|
I figured it out, i wasnt' implementing INamingContainer. that fixes
it...BUT WHY DOES THIS IMPACT IF EVENTS GET FIRED OR NOT???? "TS" <> wrote in message news:... > I think i maybe should be doing this at all because i can just access the > control's value because that control handles the functionality automatically > that I was trying to do. > > If this is so, then i still have a problem: How do i raise events in my > control for controls i have created in createchildcontrols? I have the > controls wired up to event handlers, but they are never hit. > > What do i need to do? > > thanks > > "TS" <> wrote in message > news:... > > i followed the article at: > > > http://msdn.microsoft.com/library/de...singsample.asp > > and it works like that except like i said when I use createchildControls > > instead of render (because i need to render multiple controls), it doesn't > > hit those postback methods. > > > > thanks again > > > > "TS" <> wrote in message > > news:... > > > Well i know it has something to do with the CREATEChildControls method > > > because when i overrode render instead of doing that method at all, the > > > LoadPostData() was executed. I guess it has something to do with the > > > controls being recreated each time, I DON"T KNOW. > > > > > > I need help all of you master coders > > > > > > > > > "TS" <> wrote in message > > > news:%... > > > > i have a composite control that has dropdowns on them. The page will > > post > > > > back on change, but their events won't raise. Can anyone tell me whats > > > going > > > > on? I tried to use the IPostBackDataHandler to try to get a hold of > the > > > > control to set values and such, but it has been no help. I'm confused > at > > > how > > > > this control is supposed to work. I want it to be self contained so > that > > > > when a control changes, it posts back and then reloads its dependent > > drop > > > > down lists with data that is filtered based on the value of the > control > > > that > > > > changed. > > > > > > > > Every time the page posts back to server, the it hits the init and > load > > > > events and createchildcontrols, but thats it. i can't get into the > > > > XXX_SelectedIndexChanged events for some reason even though they are > > wired > > > > to do so. > > > > > > > > Any help will be appreaciated as i'm starting to feel dumb. > > > > > > > > using System; > > > > > > > > using System.Collections.Specialized; > > > > > > > > using System.Web.UI; > > > > > > > > using System.Web.UI.WebControls; > > > > > > > > using System.Text; > > > > > > > > using Operations.Teams.Business; > > > > > > > > using Operations.Teams.Data; > > > > > > > > using Operations.Teams.Reporting; > > > > > > > > using Operations.Teams.Reporting.WebControls; > > > > > > > > namespace Operations.Teams.Web.ReportControls > > > > > > > > { > > > > > > > > /// <summary> > > > > > > > > /// Summary description for FiscalAgentHierarchy. > > > > > > > > /// </summary> > > > > > > > > public class FiscalAgentHierarchy : Control, IReportParameterControl, > > > > IPostBackDataHandler > > > > > > > > { > > > > > > > > public FiscalAgentHierarchy() > > > > > > > > { > > > > > > > > Parameters.Add(new Parameter("@SchoolYear")); > > > > > > > > Parameters.Add(new Parameter("@ReportingGroup")); > > > > > > > > Parameters.Add(new Parameter("@FiscalAgentID")); > > > > > > > > Parameters.Add(new Parameter("@FundingSourceID")); > > > > > > > > Parameters.Add(new Parameter("@ProviderID")); > > > > > > > > Parameters.Add(new Parameter("@SiteID")); > > > > > > > > Parameters.Add(new Parameter("@ClassID")); > > > > > > > > Parameters["@SchoolYear"].Value = 2006; > > > > > > > > } > > > > > > > > > > > > #region Events > > > > > > > > > > > > public bool LoadPostData(string postDataKey, NameValueCollection > > postData) > > > > > > > > { > > > > > > > > string postedValue = postData[postDataKey]; > > > > > > > > return true; > > > > > > > > } > > > > > > > > public void RaisePostDataChangedEvent() > > > > > > > > { > > > > > > > > rysReportingYearSelector_ReportingYearChanged(this , EventArgs.Empty); > > > > > > > > } > > > > > > > > protected override void LoadViewState(object savedState) > > > > > > > > { > > > > > > > > string zasdf="asdlfkjds"; > > > > > > > > } > > > > > > > > protected override object SaveViewState() > > > > > > > > { > > > > > > > > string zsad="asdf"; > > > > > > > > } > > > > > > > > protected override void OnInit(EventArgs e) > > > > > > > > { > > > > > > > > //this.EnsureChildControls(); > > > > > > > > > > > > // Do whatever the control usually does OnInit > > > > > > > > base.OnInit(e); > > > > > > > > } > > > > > > > > protected override void OnLoad(EventArgs e) > > > > > > > > { > > > > > > > > //this.EnsureChildControls(); > > > > > > > > // Do whatever the control usually does OnInit > > > > > > > > base.OnLoad(e); > > > > > > > > } > > > > > > > > private void rysReportingYearSelector_ReportingYearChanged(obje ct > > sender, > > > > EventArgs e) > > > > > > > > { > > > > > > > > this.LoadFundingSource(); > > > > > > > > this.LoadProviders(); > > > > > > > > } > > > > > > > > private void fasFiscalAgent_FiscalAgentChanged(object sender, > EventArgs > > e) > > > > > > > > { > > > > > > > > this.LoadFundingSource(); > > > > > > > > this.LoadProviders(); > > > > > > > > } > > > > > > > > private void ddlProviders_SelectedIndexChanged(object sender, > EventArgs > > e) > > > > > > > > { > > > > > > > > LoadSites(); > > > > > > > > } > > > > > > > > private void ddlSites_SelectedIndexChanged(object sender, EventArgs e) > > > > > > > > { > > > > > > > > LoadClasses(); > > > > > > > > } > > > > > > > > #endregion > > > > > > > > protected override void CreateChildControls() > > > > > > > > { > > > > > > > > rysReportingYearSelector = new ReportingYearReportSelector(); > > > > > > > > fasFiscalAgent = new FiscalAgentReportSelector(); > > > > > > > > this.ddlFundingSource = new DropDownList(); > > > > > > > > this.ddlProviders = new DropDownList(); > > > > > > > > this.ddlSites = new DropDownList(); > > > > > > > > this.ddlClasses = new DropDownList(); > > > > > > > > rysReportingYearSelector.ID = ReportingYearSelectorControlId; > > > > > > > > fasFiscalAgent.ID = FiscalAgentSelectorControlId; > > > > > > > > ddlFundingSource.ID = FundingSourceControlId; > > > > > > > > ddlProviders.ID = ProvidersControlId; > > > > > > > > ddlSites.ID = SitesControlId; > > > > > > > > ddlClasses.ID = ClassesControlId; > > > > > > > > // Assign these controls' Page property because when they try to > access > > > Page > > > > they get null reference - apparently they aren't in the control tree > at > > > that > > > > point > > > > > > > > rysReportingYearSelector.Page = this.Page; > > > > > > > > fasFiscalAgent.Page = this.Page; > > > > > > > > rysReportingYearSelector.ReportingYearChanged += new > > > > EventHandler(rysReportingYearSelector_ReportingYea rChanged); > > > > > > > > fasFiscalAgent.FiscalAgentChanged += new > > > > EventHandler(fasFiscalAgent_FiscalAgentChanged); > > > > > > > > ddlProviders.SelectedIndexChanged += new > > > > EventHandler(ddlProviders_SelectedIndexChanged); > > > > > > > > ddlSites.SelectedIndexChanged += new > > > > EventHandler(ddlSites_SelectedIndexChanged); > > > > > > > > fasFiscalAgent.IsSubmitOnChange = true; > > > > > > > > ddlProviders.AutoPostBack = true; > > > > > > > > ddlSites.AutoPostBack = true; > > > > > > > > // this.SchoolYear = rysReportingYearSelector.SchoolYear; > > > > > > > > // check if can populate funding sources and providers (because > > > fiscalAgent > > > > has been saved in session) > > > > > > > > if(this.fasFiscalAgent.SelectedFiscalAgentName != string.Empty) > > > > > > > > { > > > > > > > > LoadFundingSource(); > > > > > > > > LoadProviders(); > > > > > > > > } > > > > > > > > else > > > > > > > > { > > > > > > > > ddlFundingSource.Visible = false; > > > > > > > > ddlProviders.Visible = false; > > > > > > > > } > > > > > > > > // Initially set to false until their direct parent's selection has > been > > > > made (all other controls will have data on page load) > > > > > > > > ddlSites.Visible = false; > > > > > > > > ddlClasses.Visible = false; > > > > > > > > // start containing table > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table cellpadding=0 > > > > cellspacing=0><tr><td>")); > > > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > > > > > > > this.Controls.Add(rysReportingYearSelector); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > > > > > > > this.Controls.Add(fasFiscalAgent); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Funding > > > > Source</td><td>")); > > > > > > > > this.Controls.Add(ddlFundingSource); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Providers</td><td>") > > > > ); > > > > > > > > this.Controls.Add(ddlProviders); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Sites</td><td>")); > > > > > > > > this.Controls.Add(ddlSites); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Classes</td><td>")); > > > > > > > > this.Controls.Add(ddlClasses); > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > // end containing table > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > } > > > > > > > > private void LoadFundingSource() > > > > > > > > { > > > > > > > > int fiscalAgentId = this.fasFiscalAgent.SelectedFiscalAgentId; > > > > > > > > > > > > if(fiscalAgentId != int.MinValue) > > > > > > > > { > > > > > > > > this.ddlFundingSource.Visible = true; > > > > > > > > this.ddlFundingSource.DataSource = > > FiscalAgentFunding.Find(fiscalAgentId); > > > > > > > > this.ddlFundingSource.DataTextField = "ShortDescription"; > > > > > > > > this.ddlFundingSource.DataValueField = "CodeId"; > > > > > > > > this.ddlFundingSource.DataBind(); > > > > > > > > if(this.ddlFundingSource.Items.Count > 1) > > > > > > > > this.ddlFundingSource.Items.Insert(0, new ListItem(string.Empty, > > > > string.Empty)); > > > > > > > > } > > > > > > > > else > > > > > > > > { > > > > > > > > this.ddlFundingSource.Visible = false; > > > > > > > > } > > > > > > > > } > > > > > > > > private void LoadProviders() > > > > > > > > { > > > > > > > > int fiscalAgentId = fasFiscalAgent.SelectedFiscalAgentId; > > > > > > > > if(fiscalAgentId != int.MinValue) > > > > > > > > { > > > > > > > > ddlProviders.Visible = true; > > > > > > > > ddlProviders.DataSource = FiscalAgentProvider.Find(fiscalAgentId, > > > > rysReportingYearSelector.ReportingYearStartDate, > > > > rysReportingYearSelector.ReportingYearEndDate); > > > > > > > > ddlProviders.DataTextField = "ProviderName"; > > > > > > > > ddlProviders.DataValueField = "ProviderId"; > > > > > > > > ddlProviders.DataBind(); > > > > > > > > ddlProviders.Items.Insert(0, new ListItem(string.Empty, > string.Empty)); > > > > > > > > } > > > > > > > > else > > > > > > > > { > > > > > > > > this.ddlProviders.Items.Clear(); > > > > > > > > this.ddlProviders.Visible = false; > > > > > > > > } > > > > > > > > LoadSites(); > > > > > > > > } > > > > > > > > private void LoadSites() > > > > > > > > { > > > > > > > > if(ddlProviders.SelectedValue != string.Empty) > > > > > > > > { > > > > > > > > // Load the Site search parameters. > > > > > > > > SiteFindArgs siteFindArgs=new SiteFindArgs(); > > > > > > > > > > > > > > siteFindArgs.FiscalAgentId=Convert.ToInt32(fasFisc alAgent.SelectedFiscalAgen > > > > tId); > > > > > > > > ddlSites.Visible = true; > > > > > > > > ddlSites.DataSource = Business.Site.Find(siteFindArgs); > > > > > > > > ddlSites.DataTextField = "Name"; > > > > > > > > ddlSites.DataValueField = "SiteId"; > > > > > > > > ddlSites.DataBind(); > > > > > > > > ddlSites.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > > > > > > > } > > > > > > > > else > > > > > > > > { > > > > > > > > ddlSites.Items.Clear(); > > > > > > > > ddlSites.Visible = false; > > > > > > > > } > > > > > > > > LoadClasses(); > > > > > > > > } > > > > > > > > private void LoadClasses() > > > > > > > > { > > > > > > > > if(ddlSites.SelectedValue != string.Empty) > > > > > > > > { > > > > > > > > ClassFindArgs adultEdClassFindArgs = new ClassFindArgs(); > > > > > > > > adultEdClassFindArgs.FiscalAgentId = > > > > Convert.ToInt32(fasFiscalAgent.SelectedFiscalAgent Id); > > > > > > > > adultEdClassFindArgs.ReportingYearStartDate = > > > > rysReportingYearSelector.ReportingYearStartDate; > > > > > > > > adultEdClassFindArgs.ReportingYearEndDate = > > > > rysReportingYearSelector.ReportingYearEndDate; > > > > > > > > adultEdClassFindArgs.ProviderName = ddlProviders.SelectedValue; > > > > > > > > adultEdClassFindArgs.SiteName = ddlSites.SelectedValue; > > > > > > > > > > > > ddlClasses.Visible = true; > > > > > > > > ddlClasses.DataSource = Class.Find(classFindArgs); > > > > > > > > ddlClasses.DataTextField = "Name"; > > > > > > > > ddlClasses.DataValueField = "ClassId"; > > > > > > > > ddlClasses.DataBind(); > > > > > > > > ddlClasses.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > > > > > > > } > > > > > > > > else > > > > > > > > { > > > > > > > > ddlClasses.Items.Clear(); > > > > > > > > ddlClasses.Visible = false; > > > > > > > > } > > > > > > > > } > > > > > > > > > > > > > > > > #region Public Properties > > > > > > > > #region IReportParameterControl Members > > > > > > > > public object ParameterValue > > > > > > > > { > > > > > > > > get{ return null; } > > > > > > > > set{ /*do nothing */ } > > > > > > > > } > > > > > > > > public ParameterCollection Parameters > > > > > > > > { > > > > > > > > get{ return parameters; } > > > > > > > > set{ parameters = value;} > > > > > > > > } > > > > > > > > #endregion > > > > > > > > public int SchoolYear > > > > > > > > { > > > > > > > > get{ return (int) ViewState["SchoolYear"]; } > > > > > > > > set{ ViewState["SchoolYear"] = value; } > > > > > > > > } > > > > > > > > #endregion > > > > > > > > #region Private Member Variables > > > > > > > > private ReportingYearReportSelector rysReportingYearSelector; > > > > > > > > private FiscalAgentReportSelector fasFiscalAgent; > > > > > > > > private DropDownList ddlFundingSource; > > > > > > > > private DropDownList ddlProviders; > > > > > > > > private DropDownList ddlSites; > > > > > > > > private DropDownList ddlClasses; > > > > > > > > private ParameterCollection parameters = new ParameterCollection(); > > > > > > > > #endregion > > > > > > > > #region Private Constants > > > > > > > > private const string ReportingYearSelectorControlId = > > > > "rysReportingYearSelector"; > > > > > > > > private const string FiscalAgentSelectorControlId = > > > > "fasFiscalAgentSelector"; > > > > > > > > private const string FundingSourceControlId = "ddlFundingSource"; > > > > > > > > private const string FundingSourceLabelControlId = "lblFundingSource"; > > > > > > > > private const string ProvidersControlId = "ddlProviders"; > > > > > > > > private const string ProvidersLabelControlId = "lblProviders"; > > > > > > > > private const string SitesControlId = "ddlSites"; > > > > > > > > private const string SitesLabelControlId = "lblSites"; > > > > > > > > private const string ClassesControlId = "ddlClasses"; > > > > > > > > private const string ClassesLabelControlId = "lblClasses"; > > > > > > > > #endregion > > > > > > > > } > > > > > > > > } > > > > > > > > > > > > > > > > > > > > |
|
|
|
|
|||
|
|||
| TS |
|
TS
Guest
Posts: n/a
|
I have a new issue:
One of my controls in my composite control is in itself a composite control. It has an event that is raised when one of its drop down lists selected index changes. In main composite control, i hook into this other control's event so that i can do processing. This event won't fire in either the drop down list's selected index change event handler and also not in the event handler that my main control subscribes to. I have a clue that may be the reason: In this sub composite control, it tries to access the page property, which is null when it's CreateChildControls. So how i fixed it was to assign this composite control's page property to my main control's page property so that it now can access the page property. I'm wondering if this has something to do with the event not firing. thanks "TS" <> wrote in message news:... > I figured it out, i wasnt' implementing INamingContainer. that fixes > it...BUT WHY DOES THIS IMPACT IF EVENTS GET FIRED OR NOT???? > > > "TS" <> wrote in message > news:... > > I think i maybe should be doing this at all because i can just access the > > control's value because that control handles the functionality > automatically > > that I was trying to do. > > > > If this is so, then i still have a problem: How do i raise events in my > > control for controls i have created in createchildcontrols? I have the > > controls wired up to event handlers, but they are never hit. > > > > What do i need to do? > > > > thanks > > > > "TS" <> wrote in message > > news:... > > > i followed the article at: > > > > > > http://msdn.microsoft.com/library/de...singsample.asp > > > and it works like that except like i said when I use createchildControls > > > instead of render (because i need to render multiple controls), it > doesn't > > > hit those postback methods. > > > > > > thanks again > > > > > > "TS" <> wrote in message > > > news:... > > > > Well i know it has something to do with the CREATEChildControls method > > > > because when i overrode render instead of doing that method at all, > the > > > > LoadPostData() was executed. I guess it has something to do with the > > > > controls being recreated each time, I DON"T KNOW. > > > > > > > > I need help all of you master coders > > > > > > > > > > > > "TS" <> wrote in message > > > > news:%... > > > > > i have a composite control that has dropdowns on them. The page will > > > post > > > > > back on change, but their events won't raise. Can anyone tell me > whats > > > > going > > > > > on? I tried to use the IPostBackDataHandler to try to get a hold of > > the > > > > > control to set values and such, but it has been no help. I'm > confused > > at > > > > how > > > > > this control is supposed to work. I want it to be self contained so > > that > > > > > when a control changes, it posts back and then reloads its dependent > > > drop > > > > > down lists with data that is filtered based on the value of the > > control > > > > that > > > > > changed. > > > > > > > > > > Every time the page posts back to server, the it hits the init and > > load > > > > > events and createchildcontrols, but thats it. i can't get into the > > > > > XXX_SelectedIndexChanged events for some reason even though they are > > > wired > > > > > to do so. > > > > > > > > > > Any help will be appreaciated as i'm starting to feel dumb. > > > > > > > > > > using System; > > > > > > > > > > using System.Collections.Specialized; > > > > > > > > > > using System.Web.UI; > > > > > > > > > > using System.Web.UI.WebControls; > > > > > > > > > > using System.Text; > > > > > > > > > > using Operations.Teams.Business; > > > > > > > > > > using Operations.Teams.Data; > > > > > > > > > > using Operations.Teams.Reporting; > > > > > > > > > > using Operations.Teams.Reporting.WebControls; > > > > > > > > > > namespace Operations.Teams.Web.ReportControls > > > > > > > > > > { > > > > > > > > > > /// <summary> > > > > > > > > > > /// Summary description for FiscalAgentHierarchy. > > > > > > > > > > /// </summary> > > > > > > > > > > public class FiscalAgentHierarchy : Control, > IReportParameterControl, > > > > > IPostBackDataHandler > > > > > > > > > > { > > > > > > > > > > public FiscalAgentHierarchy() > > > > > > > > > > { > > > > > > > > > > Parameters.Add(new Parameter("@SchoolYear")); > > > > > > > > > > Parameters.Add(new Parameter("@ReportingGroup")); > > > > > > > > > > Parameters.Add(new Parameter("@FiscalAgentID")); > > > > > > > > > > Parameters.Add(new Parameter("@FundingSourceID")); > > > > > > > > > > Parameters.Add(new Parameter("@ProviderID")); > > > > > > > > > > Parameters.Add(new Parameter("@SiteID")); > > > > > > > > > > Parameters.Add(new Parameter("@ClassID")); > > > > > > > > > > Parameters["@SchoolYear"].Value = 2006; > > > > > > > > > > } > > > > > > > > > > > > > > > #region Events > > > > > > > > > > > > > > > public bool LoadPostData(string postDataKey, NameValueCollection > > > postData) > > > > > > > > > > { > > > > > > > > > > string postedValue = postData[postDataKey]; > > > > > > > > > > return true; > > > > > > > > > > } > > > > > > > > > > public void RaisePostDataChangedEvent() > > > > > > > > > > { > > > > > > > > > > rysReportingYearSelector_ReportingYearChanged(this , > EventArgs.Empty); > > > > > > > > > > } > > > > > > > > > > protected override void LoadViewState(object savedState) > > > > > > > > > > { > > > > > > > > > > string zasdf="asdlfkjds"; > > > > > > > > > > } > > > > > > > > > > protected override object SaveViewState() > > > > > > > > > > { > > > > > > > > > > string zsad="asdf"; > > > > > > > > > > } > > > > > > > > > > protected override void OnInit(EventArgs e) > > > > > > > > > > { > > > > > > > > > > //this.EnsureChildControls(); > > > > > > > > > > > > > > > // Do whatever the control usually does OnInit > > > > > > > > > > base.OnInit(e); > > > > > > > > > > } > > > > > > > > > > protected override void OnLoad(EventArgs e) > > > > > > > > > > { > > > > > > > > > > //this.EnsureChildControls(); > > > > > > > > > > // Do whatever the control usually does OnInit > > > > > > > > > > base.OnLoad(e); > > > > > > > > > > } > > > > > > > > > > private void rysReportingYearSelector_ReportingYearChanged(obje ct > > > sender, > > > > > EventArgs e) > > > > > > > > > > { > > > > > > > > > > this.LoadFundingSource(); > > > > > > > > > > this.LoadProviders(); > > > > > > > > > > } > > > > > > > > > > private void fasFiscalAgent_FiscalAgentChanged(object sender, > > EventArgs > > > e) > > > > > > > > > > { > > > > > > > > > > this.LoadFundingSource(); > > > > > > > > > > this.LoadProviders(); > > > > > > > > > > } > > > > > > > > > > private void ddlProviders_SelectedIndexChanged(object sender, > > EventArgs > > > e) > > > > > > > > > > { > > > > > > > > > > LoadSites(); > > > > > > > > > > } > > > > > > > > > > private void ddlSites_SelectedIndexChanged(object sender, EventArgs > e) > > > > > > > > > > { > > > > > > > > > > LoadClasses(); > > > > > > > > > > } > > > > > > > > > > #endregion > > > > > > > > > > protected override void CreateChildControls() > > > > > > > > > > { > > > > > > > > > > rysReportingYearSelector = new ReportingYearReportSelector(); > > > > > > > > > > fasFiscalAgent = new FiscalAgentReportSelector(); > > > > > > > > > > this.ddlFundingSource = new DropDownList(); > > > > > > > > > > this.ddlProviders = new DropDownList(); > > > > > > > > > > this.ddlSites = new DropDownList(); > > > > > > > > > > this.ddlClasses = new DropDownList(); > > > > > > > > > > rysReportingYearSelector.ID = ReportingYearSelectorControlId; > > > > > > > > > > fasFiscalAgent.ID = FiscalAgentSelectorControlId; > > > > > > > > > > ddlFundingSource.ID = FundingSourceControlId; > > > > > > > > > > ddlProviders.ID = ProvidersControlId; > > > > > > > > > > ddlSites.ID = SitesControlId; > > > > > > > > > > ddlClasses.ID = ClassesControlId; > > > > > > > > > > // Assign these controls' Page property because when they try to > > access > > > > Page > > > > > they get null reference - apparently they aren't in the control tree > > at > > > > that > > > > > point > > > > > > > > > > rysReportingYearSelector.Page = this.Page; > > > > > > > > > > fasFiscalAgent.Page = this.Page; > > > > > > > > > > rysReportingYearSelector.ReportingYearChanged += new > > > > > EventHandler(rysReportingYearSelector_ReportingYea rChanged); > > > > > > > > > > fasFiscalAgent.FiscalAgentChanged += new > > > > > EventHandler(fasFiscalAgent_FiscalAgentChanged); > > > > > > > > > > ddlProviders.SelectedIndexChanged += new > > > > > EventHandler(ddlProviders_SelectedIndexChanged); > > > > > > > > > > ddlSites.SelectedIndexChanged += new > > > > > EventHandler(ddlSites_SelectedIndexChanged); > > > > > > > > > > fasFiscalAgent.IsSubmitOnChange = true; > > > > > > > > > > ddlProviders.AutoPostBack = true; > > > > > > > > > > ddlSites.AutoPostBack = true; > > > > > > > > > > // this.SchoolYear = rysReportingYearSelector.SchoolYear; > > > > > > > > > > // check if can populate funding sources and providers (because > > > > fiscalAgent > > > > > has been saved in session) > > > > > > > > > > if(this.fasFiscalAgent.SelectedFiscalAgentName != string.Empty) > > > > > > > > > > { > > > > > > > > > > LoadFundingSource(); > > > > > > > > > > LoadProviders(); > > > > > > > > > > } > > > > > > > > > > else > > > > > > > > > > { > > > > > > > > > > ddlFundingSource.Visible = false; > > > > > > > > > > ddlProviders.Visible = false; > > > > > > > > > > } > > > > > > > > > > // Initially set to false until their direct parent's selection has > > been > > > > > made (all other controls will have data on page load) > > > > > > > > > > ddlSites.Visible = false; > > > > > > > > > > ddlClasses.Visible = false; > > > > > > > > > > // start containing table > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table cellpadding=0 > > > > > cellspacing=0><tr><td>")); > > > > > > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > > > > > > > > > this.Controls.Add(rysReportingYearSelector); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > > > > > > > > > > this.Controls.Add(fasFiscalAgent); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Funding > > > > > Source</td><td>")); > > > > > > > > > > this.Controls.Add(ddlFundingSource); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > > > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Providers</td><td>") > > > > > ); > > > > > > > > > > this.Controls.Add(ddlProviders); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Sites</td><td>")); > > > > > > > > > > this.Controls.Add(ddlSites); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > > > > > > > > > > > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Classes</td><td>")); > > > > > > > > > > this.Controls.Add(ddlClasses); > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > > > // end containing table > > > > > > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > > > > > > > > > > } > > > > > > > > > > private void LoadFundingSource() > > > > > > > > > > { > > > > > > > > > > int fiscalAgentId = this.fasFiscalAgent.SelectedFiscalAgentId; > > > > > > > > > > > > > > > if(fiscalAgentId != int.MinValue) > > > > > > > > > > { > > > > > > > > > > this.ddlFundingSource.Visible = true; > > > > > > > > > > this.ddlFundingSource.DataSource = > > > FiscalAgentFunding.Find(fiscalAgentId); > > > > > > > > > > this.ddlFundingSource.DataTextField = "ShortDescription"; > > > > > > > > > > this.ddlFundingSource.DataValueField = "CodeId"; > > > > > > > > > > this.ddlFundingSource.DataBind(); > > > > > > > > > > if(this.ddlFundingSource.Items.Count > 1) > > > > > > > > > > this.ddlFundingSource.Items.Insert(0, new ListItem(string.Empty, > > > > > string.Empty)); > > > > > > > > > > } > > > > > > > > > > else > > > > > > > > > > { > > > > > > > > > > this.ddlFundingSource.Visible = false; > > > > > > > > > > } > > > > > > > > > > } > > > > > > > > > > private void LoadProviders() > > > > > > > > > > { > > > > > > > > > > int fiscalAgentId = fasFiscalAgent.SelectedFiscalAgentId; > > > > > > > > > > if(fiscalAgentId != int.MinValue) > > > > > > > > > > { > > > > > > > > > > ddlProviders.Visible = true; > > > > > > > > > > ddlProviders.DataSource = FiscalAgentProvider.Find(fiscalAgentId, > > > > > rysReportingYearSelector.ReportingYearStartDate, > > > > > rysReportingYearSelector.ReportingYearEndDate); > > > > > > > > > > ddlProviders.DataTextField = "ProviderName"; > > > > > > > > > > ddlProviders.DataValueField = "ProviderId"; > > > > > > > > > > ddlProviders.DataBind(); > > > > > > > > > > ddlProviders.Items.Insert(0, new ListItem(string.Empty, > > string.Empty)); > > > > > > > > > > } > > > > > > > > > > else > > > > > > > > > > { > > > > > > > > > > this.ddlProviders.Items.Clear(); > > > > > > > > > > this.ddlProviders.Visible = false; > > > > > > > > > > } > > > > > > > > > > LoadSites(); > > > > > > > > > > } > > > > > > > > > > private void LoadSites() > > > > > > > > > > { > > > > > > > > > > if(ddlProviders.SelectedValue != string.Empty) > > > > > > > > > > { > > > > > > > > > > // Load the Site search parameters. > > > > > > > > > > SiteFindArgs siteFindArgs=new SiteFindArgs(); > > > > > > > > > > > > > > > > > > > > siteFindArgs.FiscalAgentId=Convert.ToInt32(fasFisc alAgent.SelectedFiscalAgen > > > > > tId); > > > > > > > > > > ddlSites.Visible = true; > > > > > > > > > > ddlSites.DataSource = Business.Site.Find(siteFindArgs); > > > > > > > > > > ddlSites.DataTextField = "Name"; > > > > > > > > > > ddlSites.DataValueField = "SiteId"; > > > > > > > > > > ddlSites.DataBind(); > > > > > > > > > > ddlSites.Items.Insert(0, new ListItem(string.Empty, string.Empty)); > > > > > > > > > > } > > > > > > > > > > else > > > > > > > > > > { > > > > > > > > > > ddlSites.Items.Clear(); > > > > > > > > > > ddlSites.Visible = false; > > > > > > > > > > } > > > > > > > > > > LoadClasses(); > > > > > > > > > > } > > > > > > > > > > private void LoadClasses() > > > > > > > > > > { > > > > > > > > > > if(ddlSites.SelectedValue != string.Empty) > > > > > > > > > > { > > > > > > > > > > ClassFindArgs adultEdClassFindArgs = new ClassFindArgs(); > > > > > > > > > > adultEdClassFindArgs.FiscalAgentId = > > > > > Convert.ToInt32(fasFiscalAgent.SelectedFiscalAgent Id); > > > > > > > > > > adultEdClassFindArgs.ReportingYearStartDate = > > > > > rysReportingYearSelector.ReportingYearStartDate; > > > > > > > > > > adultEdClassFindArgs.ReportingYearEndDate = > > > > > rysReportingYearSelector.ReportingYearEndDate; > > > > > > > > > > adultEdClassFindArgs.ProviderName = ddlProviders.SelectedValue; > > > > > > > > > > adultEdClassFindArgs.SiteName = ddlSites.SelectedValue; > > > > > > > > > > > > > > > ddlClasses.Visible = true; > > > > > > > > > > ddlClasses.DataSource = Class.Find(classFindArgs); > > > > > > > > > > ddlClasses.DataTextField = "Name"; > > > > > > > > > > ddlClasses.DataValueField = "ClassId"; > > > > > > > > > > ddlClasses.DataBind(); > > > > > > > > > > ddlClasses.Items.Insert(0, new ListItem(string.Empty, > string.Empty)); > > > > > > > > > > } > > > > > > > > > > else > > > > > > > > > > { > > > > > > > > > > ddlClasses.Items.Clear(); > > > > > > > > > > ddlClasses.Visible = false; > > > > > > > > > > } > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > #region Public Properties > > > > > > > > > > #region IReportParameterControl Members > > > > > > > > > > public object ParameterValue > > > > > > > > > > { > > > > > > > > > > get{ return null; } > > > > > > > > > > set{ /*do nothing */ } > > > > > > > > > > } > > > > > > > > > > public ParameterCollection Parameters > > > > > > > > > > { > > > > > > > > > > get{ return parameters; } > > > > > > > > > > set{ parameters = value;} > > > > > > > > > > } > > > > > > > > > > #endregion > > > > > > > > > > public int SchoolYear > > > > > > > > > > { > > > > > > > > > > get{ return (int) ViewState["SchoolYear"]; } > > > > > > > > > > set{ ViewState["SchoolYear"] = value; } > > > > > > > > > > } > > > > > > > > > > #endregion > > > > > > > > > > #region Private Member Variables > > > > > > > > > > private ReportingYearReportSelector rysReportingYearSelector; > > > > > > > > > > private FiscalAgentReportSelector fasFiscalAgent; > > > > > > > > > > private DropDownList ddlFundingSource; > > > > > > > > > > private DropDownList ddlProviders; > > > > > > > > > > private DropDownList ddlSites; > > > > > > > > > > private DropDownList ddlClasses; > > > > > > > > > > private ParameterCollection parameters = new ParameterCollection(); > > > > > > > > > > #endregion > > > > > > > > > > #region Private Constants > > > > > > > > > > private const string ReportingYearSelectorControlId = > > > > > "rysReportingYearSelector"; > > > > > > > > > > private const string FiscalAgentSelectorControlId = > > > > > "fasFiscalAgentSelector"; > > > > > > > > > > private const string FundingSourceControlId = "ddlFundingSource"; > > > > > > > > > > private const string FundingSourceLabelControlId = > "lblFundingSource"; > > > > > > > > > > private const string ProvidersControlId = "ddlProviders"; > > > > > > > > > > private const string ProvidersLabelControlId = "lblProviders"; > > > > > > > > > > private const string SitesControlId = "ddlSites"; > > > > > > > > > > private const string SitesLabelControlId = "lblSites"; > > > > > > > > > > private const string ClassesControlId = "ddlClasses"; > > > > > > > > > > private const string ClassesLabelControlId = "lblClasses"; > > > > > > > > > > #endregion > > > > > > > > > > } > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
|
|
|
|||
|
|||
| TS |
|
Steven Cheng[MSFT]
Guest
Posts: n/a
|
Hi TS,
Welcome to ASPNET newsgroup. Regarding on the post back event handling problem in composite control, generaly speaking , the most likely cause is still the event handler's registering sequence and the control's constructing and adding approach. For your former problem, (postback event for sub controls not fire when the composite control doesn't implement INamingContainer), this is because for sub controls contained in composite control, they need to be assigned an unique clientID which will be used when it's postback event be fired( the runtime will use this ID to mapping the event to the correct control instance). When we didn't implement NamingContainer interface, the composite control won't assign the appropriate ClientID(also UniqueID) for the nested sub controls, so sub controls' post back event won't be handled correclty. As for the new problem you mentioned, I'm wondering how did you create your composite control (also its nested sub composite controls inside it)? For the "Page" property, it'll be assigned properly when a certain control is added into its container control's Controls collection, we don't need to manually assign it. Anyway, would you try provide some code snippet to represent your composite control's code logic? It'll be much helpful if you can make a very simple repro demo control to demostrate the problem. Thanks, Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) -------------------- | From: "TS" <> | References: <#> <> <> <> <> | Subject: Re: processing postback | Date: Tue, 2 Aug 2005 15:54:05 -0500 | Lines: 717 | X-Priority: 3 | X-MSMail-Priority: Normal | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 | Message-ID: <> | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingc ontrols,microsoft.public.d otnet.framework.aspnet.webcontrols | NNTP-Posting-Host: 103nat100.tea.state.tx.us 198.214.103.100 | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontro ls:10237 microsoft.public.dotnet.framework.aspnet.buildingc ontrols:3976 | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols | | I have a new issue: | | One of my controls in my composite control is in itself a composite control. | It has an event that is raised when one of its drop down lists selected | index changes. In main composite control, i hook into this other control's | event so that i can do processing. This event won't fire in either the drop | down list's selected index change event handler and also not in the event | handler that my main control subscribes to. | | I have a clue that may be the reason: In this sub composite control, it | tries to access the page property, which is null when it's | CreateChildControls. So how i fixed it was to assign this composite | control's page property to my main control's page property so that it now | can access the page property. I'm wondering if this has something to do with | the event not firing. | | thanks | | "TS" <> wrote in message | news:... | > I figured it out, i wasnt' implementing INamingContainer. that fixes | > it...BUT WHY DOES THIS IMPACT IF EVENTS GET FIRED OR NOT???? | > | > | > "TS" <> wrote in message | > news:... | > > I think i maybe should be doing this at all because i can just access | the | > > control's value because that control handles the functionality | > automatically | > > that I was trying to do. | > > | > > If this is so, then i still have a problem: How do i raise events in my | > > control for controls i have created in createchildcontrols? I have the | > > controls wired up to event handlers, but they are never hit. | > > | > > What do i need to do? | > > | > > thanks | > > | > > "TS" <> wrote in message | > > news:... | > > > i followed the article at: | > > > | > > | > | http://msdn.microsoft.com/library/de...us/cpguide/htm l/cpconpostbackdataprocessingsample.asp | > > > and it works like that except like i said when I use | createchildControls | > > > instead of render (because i need to render multiple controls), it | > doesn't | > > > hit those postback methods. | > > > | > > > thanks again | > > > | > > > "TS" <> wrote in message | > > > news:... | > > > > Well i know it has something to do with the CREATEChildControls | method | > > > > because when i overrode render instead of doing that method at all, | > the | > > > > LoadPostData() was executed. I guess it has something to do with the | > > > > controls being recreated each time, I DON"T KNOW. | > > > > | > > > > I need help all of you master coders | > > > > | > > > > | > > > > "TS" <> wrote in message | > > > > news:%... | > > > > > i have a composite control that has dropdowns on them. The page | will | > > > post | > > > > > back on change, but their events won't raise. Can anyone tell me | > whats | > > > > going | > > > > > on? I tried to use the IPostBackDataHandler to try to get a hold | of | > > the | > > > > > control to set values and such, but it has been no help. I'm | > confused | > > at | > > > > how | > > > > > this control is supposed to work. I want it to be self contained | so | > > that | > > > > > when a control changes, it posts back and then reloads its | dependent | > > > drop | > > > > > down lists with data that is filtered based on the value of the | > > control | > > > > that | > > > > > changed. | > > > > > | > > > > > Every time the page posts back to server, the it hits the init and | > > load | > > > > > events and createchildcontrols, but thats it. i can't get into the | > > > > > XXX_SelectedIndexChanged events for some reason even though they | are | > > > wired | > > > > > to do so. | > > > > > | > > > > > Any help will be appreaciated as i'm starting to feel dumb. | > > > > > | > > > > > using System; | > > > > > | > > > > > using System.Collections.Specialized; | > > > > > | > > > > > using System.Web.UI; | > > > > > | > > > > > using System.Web.UI.WebControls; | > > > > > | > > > > > using System.Text; | > > > > > | > > > > > using Operations.Teams.Business; | > > > > > | > > > > > using Operations.Teams.Data; | > > > > > | > > > > > using Operations.Teams.Reporting; | > > > > > | > > > > > using Operations.Teams.Reporting.WebControls; | > > > > > | > > > > > namespace Operations.Teams.Web.ReportControls | > > > > > | > > > > > { | > > > > > | > > > > > /// <summary> | > > > > > | > > > > > /// Summary description for FiscalAgentHierarchy. | > > > > > | > > > > > /// </summary> | > > > > > | > > > > > public class FiscalAgentHierarchy : Control, | > IReportParameterControl, | > > > > > IPostBackDataHandler | > > > > > | > > > > > { | > > > > > | > > > > > public FiscalAgentHierarchy() | > > > > > | > > > > > { | > > > > > | > > > > > Parameters.Add(new Parameter("@SchoolYear")); | > > > > > | > > > > > Parameters.Add(new Parameter("@ReportingGroup")); | > > > > > | > > > > > Parameters.Add(new Parameter("@FiscalAgentID")); | > > > > > | > > > > > Parameters.Add(new Parameter("@FundingSourceID")); | > > > > > | > > > > > Parameters.Add(new Parameter("@ProviderID")); | > > > > > | > > > > > Parameters.Add(new Parameter("@SiteID")); | > > > > > | > > > > > Parameters.Add(new Parameter("@ClassID")); | > > > > > | > > > > > Parameters["@SchoolYear"].Value = 2006; | > > > > > | > > > > > } | > > > > > | > > > > > | > > > > > #region Events | > > > > > | > > > > > | > > > > > public bool LoadPostData(string postDataKey, NameValueCollection | > > > postData) | > > > > > | > > > > > { | > > > > > | > > > > > string postedValue = postData[postDataKey]; | > > > > > | > > > > > return true; | > > > > > | > > > > > } | > > > > > | > > > > > public void RaisePostDataChangedEvent() | > > > > > | > > > > > { | > > > > > | > > > > > rysReportingYearSelector_ReportingYearChanged(this , | > EventArgs.Empty); | > > > > > | > > > > > } | > > > > > | > > > > > protected override void LoadViewState(object savedState) | > > > > > | > > > > > { | > > > > > | > > > > > string zasdf="asdlfkjds"; | > > > > > | > > > > > } | > > > > > | > > > > > protected override object SaveViewState() | > > > > > | > > > > > { | > > > > > | > > > > > string zsad="asdf"; | > > > > > | > > > > > } | > > > > > | > > > > > protected override void OnInit(EventArgs e) | > > > > > | > > > > > { | > > > > > | > > > > > //this.EnsureChildControls(); | > > > > > | > > > > > | > > > > > // Do whatever the control usually does OnInit | > > > > > | > > > > > base.OnInit(e); | > > > > > | > > > > > } | > > > > > | > > > > > protected override void OnLoad(EventArgs e) | > > > > > | > > > > > { | > > > > > | > > > > > //this.EnsureChildControls(); | > > > > > | > > > > > // Do whatever the control usually does OnInit | > > > > > | > > > > > base.OnLoad(e); | > > > > > | > > > > > } | > > > > > | > > > > > private void rysReportingYearSelector_ReportingYearChanged(obje ct | > > > sender, | > > > > > EventArgs e) | > > > > > | > > > > > { | > > > > > | > > > > > this.LoadFundingSource(); | > > > > > | > > > > > this.LoadProviders(); | > > > > > | > > > > > } | > > > > > | > > > > > private void fasFiscalAgent_FiscalAgentChanged(object sender, | > > EventArgs | > > > e) | > > > > > | > > > > > { | > > > > > | > > > > > this.LoadFundingSource(); | > > > > > | > > > > > this.LoadProviders(); | > > > > > | > > > > > } | > > > > > | > > > > > private void ddlProviders_SelectedIndexChanged(object sender, | > > EventArgs | > > > e) | > > > > > | > > > > > { | > > > > > | > > > > > LoadSites(); | > > > > > | > > > > > } | > > > > > | > > > > > private void ddlSites_SelectedIndexChanged(object sender, | EventArgs | > e) | > > > > > | > > > > > { | > > > > > | > > > > > LoadClasses(); | > > > > > | > > > > > } | > > > > > | > > > > > #endregion | > > > > > | > > > > > protected override void CreateChildControls() | > > > > > | > > > > > { | > > > > > | > > > > > rysReportingYearSelector = new ReportingYearReportSelector(); | > > > > > | > > > > > fasFiscalAgent = new FiscalAgentReportSelector(); | > > > > > | > > > > > this.ddlFundingSource = new DropDownList(); | > > > > > | > > > > > this.ddlProviders = new DropDownList(); | > > > > > | > > > > > this.ddlSites = new DropDownList(); | > > > > > | > > > > > this.ddlClasses = new DropDownList(); | > > > > > | > > > > > rysReportingYearSelector.ID = ReportingYearSelectorControlId; | > > > > > | > > > > > fasFiscalAgent.ID = FiscalAgentSelectorControlId; | > > > > > | > > > > > ddlFundingSource.ID = FundingSourceControlId; | > > > > > | > > > > > ddlProviders.ID = ProvidersControlId; | > > > > > | > > > > > ddlSites.ID = SitesControlId; | > > > > > | > > > > > ddlClasses.ID = ClassesControlId; | > > > > > | > > > > > // Assign these controls' Page property because when they try to | > > access | > > > > Page | > > > > > they get null reference - apparently they aren't in the control | tree | > > at | > > > > that | > > > > > point | > > > > > | > > > > > rysReportingYearSelector.Page = this.Page; | > > > > > | > > > > > fasFiscalAgent.Page = this.Page; | > > > > > | > > > > > rysReportingYearSelector.ReportingYearChanged += new | > > > > > EventHandler(rysReportingYearSelector_ReportingYea rChanged); | > > > > > | > > > > > fasFiscalAgent.FiscalAgentChanged += new | > > > > > EventHandler(fasFiscalAgent_FiscalAgentChanged); | > > > > > | > > > > > ddlProviders.SelectedIndexChanged += new | > > > > > EventHandler(ddlProviders_SelectedIndexChanged); | > > > > > | > > > > > ddlSites.SelectedIndexChanged += new | > > > > > EventHandler(ddlSites_SelectedIndexChanged); | > > > > > | > > > > > fasFiscalAgent.IsSubmitOnChange = true; | > > > > > | > > > > > ddlProviders.AutoPostBack = true; | > > > > > | > > > > > ddlSites.AutoPostBack = true; | > > > > > | > > > > > // this.SchoolYear = rysReportingYearSelector.SchoolYear; | > > > > > | > > > > > // check if can populate funding sources and providers (because | > > > > fiscalAgent | > > > > > has been saved in session) | > > > > > | > > > > > if(this.fasFiscalAgent.SelectedFiscalAgentName != string.Empty) | > > > > > | > > > > > { | > > > > > | > > > > > LoadFundingSource(); | > > > > > | > > > > > LoadProviders(); | > > > > > | > > > > > } | > > > > > | > > > > > else | > > > > > | > > > > > { | > > > > > | > > > > > ddlFundingSource.Visible = false; | > > > > > | > > > > > ddlProviders.Visible = false; | > > > > > | > > > > > } | > > > > > | > > > > > // Initially set to false until their direct parent's selection | has | > > been | > > > > > made (all other controls will have data on page load) | > > > > > | > > > > > ddlSites.Visible = false; | > > > > > | > > > > > ddlClasses.Visible = false; | > > > > > | > > > > > // start containing table | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table cellpadding=0 | > > > > > cellspacing=0><tr><td>")); | > > > > > | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); | > > > > > | > > > > > this.Controls.Add(rysReportingYearSelector); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); | > > > > > | > > > > > this.Controls.Add(fasFiscalAgent); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Funding | > > > > > Source</td><td>")); | > > > > > | > > > > > this.Controls.Add(ddlFundingSource); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > > > > > | > > > > > | > > > > | > > > | > > | > | this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Providers</td><td>") | > > > > > ); | > > > > > | > > > > > this.Controls.Add(ddlProviders); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > > > > > | > > > > > | > > > | > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Sites</td><td>")); | > > > > > | > > > > > this.Controls.Add(ddlSites); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > > > > > | > > > > > | > > > > | > > > | > > | > | this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Classes</td><td>")); | > > > > > | > > > > > this.Controls.Add(ddlClasses); | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > > > > > | > > > > > // end containing table | > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > > > > > | > > > > > } | > > > > > | > > > > > private void LoadFundingSource() | > > > > > | > > > > > { | > > > > > | > > > > > int fiscalAgentId = this.fasFiscalAgent.SelectedFiscalAgentId; | > > > > > | > > > > > | > > > > > if(fiscalAgentId != int.MinValue) | > > > > > | > > > > > { | > > > > > | > > > > > this.ddlFundingSource.Visible = true; | > > > > > | > > > > > this.ddlFundingSource.DataSource = | > > > FiscalAgentFunding.Find(fiscalAgentId); | > > > > > | > > > > > this.ddlFundingSource.DataTextField = "ShortDescription"; | > > > > > | > > > > > this.ddlFundingSource.DataValueField = "CodeId"; | > > > > > | > > > > > this.ddlFundingSource.DataBind(); | > > > > > | > > > > > if(this.ddlFundingSource.Items.Count > 1) | > > > > > | > > > > > this.ddlFundingSource.Items.Insert(0, new ListItem(string.Empty, | > > > > > string.Empty)); | > > > > > | > > > > > } | > > > > > | > > > > > else | > > > > > | > > > > > { | > > > > > | > > > > > this.ddlFundingSource.Visible = false; | > > > > > | > > > > > } | > > > > > | > > > > > } | > > > > > | > > > > > private void LoadProviders() | > > > > > | > > > > > { | > > > > > | > > > > > int fiscalAgentId = fasFiscalAgent.SelectedFiscalAgentId; | > > > > > | > > > > > if(fiscalAgentId != int.MinValue) | > > > > > | > > > > > { | > > > > > | > > > > > ddlProviders.Visible = true; | > > > > > | > > > > > ddlProviders.DataSource = FiscalAgentProvider.Find(fiscalAgentId, | > > > > > rysReportingYearSelector.ReportingYearStartDate, | > > > > > rysReportingYearSelector.ReportingYearEndDate); | > > > > > | > > > > > ddlProviders.DataTextField = "ProviderName"; | > > > > > | > > > > > ddlProviders.DataValueField = "ProviderId"; | > > > > > | > > > > > ddlProviders.DataBind(); | > > > > > | > > > > > ddlProviders.Items.Insert(0, new ListItem(string.Empty, | > > string.Empty)); | > > > > > | > > > > > } | > > > > > | > > > > > else | > > > > > | > > > > > { | > > > > > | > > > > > this.ddlProviders.Items.Clear(); | > > > > > | > > > > > this.ddlProviders.Visible = false; | > > > > > | > > > > > } | > > > > > | > > > > > LoadSites(); | > > > > > | > > > > > } | > > > > > | > > > > > private void LoadSites() | > > > > > | > > > > > { | > > > > > | > > > > > if(ddlProviders.SelectedValue != string.Empty) | > > > > > | > > > > > { | > > > > > | > > > > > // Load the Site search parameters. | > > > > > | > > > > > SiteFindArgs siteFindArgs=new SiteFindArgs(); | > > > > > | > > > > > | > > > > | > > > | > > | > | siteFindArgs.FiscalAgentId=Convert.ToInt32(fasFisc alAgent.SelectedFiscalAgen | > > > > > tId); | > > > > > | > > > > > ddlSites.Visible = true; | > > > > > | > > > > > ddlSites.DataSource = Business.Site.Find(siteFindArgs); | > > > > > | > > > > > ddlSites.DataTextField = "Name"; | > > > > > | > > > > > ddlSites.DataValueField = "SiteId"; | > > > > > | > > > > > ddlSites.DataBind(); | > > > > > | > > > > > ddlSites.Items.Insert(0, new ListItem(string.Empty, | string.Empty)); | > > > > > | > > > > > } | > > > > > | > > > > > else | > > > > > | > > > > > { | > > > > > | > > > > > ddlSites.Items.Clear(); | > > > > > | > > > > > ddlSites.Visible = false; | > > > > > | > > > > > } | > > > > > | > > > > > LoadClasses(); | > > > > > | > > > > > } | > > > > > | > > > > > private void LoadClasses() | > > > > > | > > > > > { | > > > > > | > > > > > if(ddlSites.SelectedValue != string.Empty) | > > > > > | > > > > > { | > > > > > | > > > > > ClassFindArgs adultEdClassFindArgs = new ClassFindArgs(); | > > > > > | > > > > > adultEdClassFindArgs.FiscalAgentId = | > > > > > Convert.ToInt32(fasFiscalAgent.SelectedFiscalAgent Id); | > > > > > | > > > > > adultEdClassFindArgs.ReportingYearStartDate = | > > > > > rysReportingYearSelector.ReportingYearStartDate; | > > > > > | > > > > > adultEdClassFindArgs.ReportingYearEndDate = | > > > > > rysReportingYearSelector.ReportingYearEndDate; | > > > > > | > > > > > adultEdClassFindArgs.ProviderName = ddlProviders.SelectedValue; | > > > > > | > > > > > adultEdClassFindArgs.SiteName = ddlSites.SelectedValue; | > > > > > | > > > > > | > > > > > ddlClasses.Visible = true; | > > > > > | > > > > > ddlClasses.DataSource = Class.Find(classFindArgs); | > > > > > | > > > > > ddlClasses.DataTextField = "Name"; | > > > > > | > > > > > ddlClasses.DataValueField = "ClassId"; | > > > > > | > > > > > ddlClasses.DataBind(); | > > > > > | > > > > > ddlClasses.Items.Insert(0, new ListItem(string.Empty, | > string.Empty)); | > > > > > | > > > > > } | > > > > > | > > > > > else | > > > > > | > > > > > { | > > > > > | > > > > > ddlClasses.Items.Clear(); | > > > > > | > > > > > ddlClasses.Visible = false; | > > > > > | > > > > > } | > > > > > | > > > > > } | > > > > > | > > > > > | > > > > > | > > > > > #region Public Properties | > > > > > | > > > > > #region IReportParameterControl Members | > > > > > | > > > > > public object ParameterValue | > > > > > | > > > > > { | > > > > > | > > > > > get{ return null; } | > > > > > | > > > > > set{ /*do nothing */ } | > > > > > | > > > > > } | > > > > > | > > > > > public ParameterCollection Parameters | > > > > > | > > > > > { | > > > > > | > > > > > get{ return parameters; } | > > > > > | > > > > > set{ parameters = value;} | > > > > > | > > > > > } | > > > > > | > > > > > #endregion | > > > > > | > > > > > public int SchoolYear | > > > > > | > > > > > { | > > > > > | > > > > > get{ return (int) ViewState["SchoolYear"]; } | > > > > > | > > > > > set{ ViewState["SchoolYear"] = value; } | > > > > > | > > > > > } | > > > > > | > > > > > #endregion | > > > > > | > > > > > #region Private Member Variables | > > > > > | > > > > > private ReportingYearReportSelector rysReportingYearSelector; | > > > > > | > > > > > private FiscalAgentReportSelector fasFiscalAgent; | > > > > > | > > > > > private DropDownList ddlFundingSource; | > > > > > | > > > > > private DropDownList ddlProviders; | > > > > > | > > > > > private DropDownList ddlSites; | > > > > > | > > > > > private DropDownList ddlClasses; | > > > > > | > > > > > private ParameterCollection parameters = new | ParameterCollection(); | > > > > > | > > > > > #endregion | > > > > > | > > > > > #region Private Constants | > > > > > | > > > > > private const string ReportingYearSelectorControlId = | > > > > > "rysReportingYearSelector"; | > > > > > | > > > > > private const string FiscalAgentSelectorControlId = | > > > > > "fasFiscalAgentSelector"; | > > > > > | > > > > > private const string FundingSourceControlId = "ddlFundingSource"; | > > > > > | > > > > > private const string FundingSourceLabelControlId = | > "lblFundingSource"; | > > > > > | > > > > > private const string ProvidersControlId = "ddlProviders"; | > > > > > | > > > > > private const string ProvidersLabelControlId = "lblProviders"; | > > > > > | > > > > > private const string SitesControlId = "ddlSites"; | > > > > > | > > > > > private const string SitesLabelControlId = "lblSites"; | > > > > > | > > > > > private const string ClassesControlId = "ddlClasses"; | > > > > > | > > > > > private const string ClassesLabelControlId = "lblClasses"; | > > > > > | > > > > > #endregion | > > > > > | > > > > > } | > > > > > | > > > > > } | > > > > > | > > > > > | > > > > | > > > > | > > > | > > > | > > | > > | > | > | | | |
|
|
|
|
|||
|
|||
| Steven Cheng[MSFT] |
|
TS
Guest
Posts: n/a
|
thanks, but it seems my only problem that still exists is the posts i'm
making in "explanation of when need..." "Steven Cheng[MSFT]" <> wrote in message news:... > Hi TS, > > Welcome to ASPNET newsgroup. > Regarding on the post back event handling problem in composite control, > generaly speaking , the most likely cause is still the event handler's > registering sequence and the control's constructing and adding approach. > > For your former problem, (postback event for sub controls not fire when the > composite control doesn't implement INamingContainer), this is because for > sub controls contained in composite control, they need to be assigned an > unique clientID which will be used when it's postback event be fired( the > runtime will use this ID to mapping the event to the correct control > instance). When we didn't implement NamingContainer interface, the > composite control won't assign the appropriate ClientID(also UniqueID) for > the nested sub controls, so sub controls' post back event won't be handled > correclty. > > As for the new problem you mentioned, I'm wondering how did you create your > composite control (also its nested sub composite controls inside it)? For > the "Page" property, it'll be assigned properly when a certain control is > added into its container control's Controls collection, we don't need to > manually assign it. Anyway, would you try provide some code snippet to > represent your composite control's code logic? It'll be much helpful if you > can make a very simple repro demo control to demostrate the problem. > > Thanks, > > Steven Cheng > Microsoft Online Support > > Get Secure! www.microsoft.com/security > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > > > > > > > -------------------- > | From: "TS" <> > | References: <#> > <> > <> > <> > <> > | Subject: Re: processing postback > | Date: Tue, 2 Aug 2005 15:54:05 -0500 > | Lines: 717 > | X-Priority: 3 > | X-MSMail-Priority: Normal > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 > | Message-ID: <> > | Newsgroups: > microsoft.public.dotnet.framework.aspnet.buildingc ontrols,microsoft.public.d > otnet.framework.aspnet.webcontrols > | NNTP-Posting-Host: 103nat100.tea.state.tx.us 198.214.103.100 > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.phx.gbl > | Xref: TK2MSFTNGXA01.phx.gbl > microsoft.public.dotnet.framework.aspnet.webcontro ls:10237 > microsoft.public.dotnet.framework.aspnet.buildingc ontrols:3976 > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols > | > | I have a new issue: > | > | One of my controls in my composite control is in itself a composite > control. > | It has an event that is raised when one of its drop down lists selected > | index changes. In main composite control, i hook into this other control's > | event so that i can do processing. This event won't fire in either the > drop > | down list's selected index change event handler and also not in the event > | handler that my main control subscribes to. > | > | I have a clue that may be the reason: In this sub composite control, it > | tries to access the page property, which is null when it's > | CreateChildControls. So how i fixed it was to assign this composite > | control's page property to my main control's page property so that it now > | can access the page property. I'm wondering if this has something to do > with > | the event not firing. > | > | thanks > | > | "TS" <> wrote in message > | news:... > | > I figured it out, i wasnt' implementing INamingContainer. that fixes > | > it...BUT WHY DOES THIS IMPACT IF EVENTS GET FIRED OR NOT???? > | > > | > > | > "TS" <> wrote in message > | > news:... > | > > I think i maybe should be doing this at all because i can just access > | the > | > > control's value because that control handles the functionality > | > automatically > | > > that I was trying to do. > | > > > | > > If this is so, then i still have a problem: How do i raise events in > my > | > > control for controls i have created in createchildcontrols? I have the > | > > controls wired up to event handlers, but they are never hit. > | > > > | > > What do i need to do? > | > > > | > > thanks > | > > > | > > "TS" <> wrote in message > | > > news:... > | > > > i followed the article at: > | > > > > | > > > | > > | > http://msdn.microsoft.com/library/de...us/cpguide/htm > l/cpconpostbackdataprocessingsample.asp > | > > > and it works like that except like i said when I use > | createchildControls > | > > > instead of render (because i need to render multiple controls), it > | > doesn't > | > > > hit those postback methods. > | > > > > | > > > thanks again > | > > > > | > > > "TS" <> wrote in message > | > > > news:... > | > > > > Well i know it has something to do with the CREATEChildControls > | method > | > > > > because when i overrode render instead of doing that method at > all, > | > the > | > > > > LoadPostData() was executed. I guess it has something to do with > the > | > > > > controls being recreated each time, I DON"T KNOW. > | > > > > > | > > > > I need help all of you master coders > | > > > > > | > > > > > | > > > > "TS" <> wrote in message > | > > > > news:%... > | > > > > > i have a composite control that has dropdowns on them. The page > | will > | > > > post > | > > > > > back on change, but their events won't raise. Can anyone tell me > | > whats > | > > > > going > | > > > > > on? I tried to use the IPostBackDataHandler to try to get a hold > | of > | > > the > | > > > > > control to set values and such, but it has been no help. I'm > | > confused > | > > at > | > > > > how > | > > > > > this control is supposed to work. I want it to be self contained > | so > | > > that > | > > > > > when a control changes, it posts back and then reloads its > | dependent > | > > > drop > | > > > > > down lists with data that is filtered based on the value of the > | > > control > | > > > > that > | > > > > > changed. > | > > > > > > | > > > > > Every time the page posts back to server, the it hits the init > and > | > > load > | > > > > > events and createchildcontrols, but thats it. i can't get into > the > | > > > > > XXX_SelectedIndexChanged events for some reason even though they > | are > | > > > wired > | > > > > > to do so. > | > > > > > > | > > > > > Any help will be appreaciated as i'm starting to feel dumb. > | > > > > > > | > > > > > using System; > | > > > > > > | > > > > > using System.Collections.Specialized; > | > > > > > > | > > > > > using System.Web.UI; > | > > > > > > | > > > > > using System.Web.UI.WebControls; > | > > > > > > | > > > > > using System.Text; > | > > > > > > | > > > > > using Operations.Teams.Business; > | > > > > > > | > > > > > using Operations.Teams.Data; > | > > > > > > | > > > > > using Operations.Teams.Reporting; > | > > > > > > | > > > > > using Operations.Teams.Reporting.WebControls; > | > > > > > > | > > > > > namespace Operations.Teams.Web.ReportControls > | > > > > > > | > > > > > { > | > > > > > > | > > > > > /// <summary> > | > > > > > > | > > > > > /// Summary description for FiscalAgentHierarchy. > | > > > > > > | > > > > > /// </summary> > | > > > > > > | > > > > > public class FiscalAgentHierarchy : Control, > | > IReportParameterControl, > | > > > > > IPostBackDataHandler > | > > > > > > | > > > > > { > | > > > > > > | > > > > > public FiscalAgentHierarchy() > | > > > > > > | > > > > > { > | > > > > > > | > > > > > Parameters.Add(new Parameter("@SchoolYear")); > | > > > > > > | > > > > > Parameters.Add(new Parameter("@ReportingGroup")); > | > > > > > > | > > > > > Parameters.Add(new Parameter("@FiscalAgentID")); > | > > > > > > | > > > > > Parameters.Add(new Parameter("@FundingSourceID")); > | > > > > > > | > > > > > Parameters.Add(new Parameter("@ProviderID")); > | > > > > > > | > > > > > Parameters.Add(new Parameter("@SiteID")); > | > > > > > > | > > > > > Parameters.Add(new Parameter("@ClassID")); > | > > > > > > | > > > > > Parameters["@SchoolYear"].Value = 2006; > | > > > > > > | > > > > > } > | > > > > > > | > > > > > > | > > > > > #region Events > | > > > > > > | > > > > > > | > > > > > public bool LoadPostData(string postDataKey, NameValueCollection > | > > > postData) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > string postedValue = postData[postDataKey]; > | > > > > > > | > > > > > return true; > | > > > > > > | > > > > > } > | > > > > > > | > > > > > public void RaisePostDataChangedEvent() > | > > > > > > | > > > > > { > | > > > > > > | > > > > > rysReportingYearSelector_ReportingYearChanged(this , > | > EventArgs.Empty); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > protected override void LoadViewState(object savedState) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > string zasdf="asdlfkjds"; > | > > > > > > | > > > > > } > | > > > > > > | > > > > > protected override object SaveViewState() > | > > > > > > | > > > > > { > | > > > > > > | > > > > > string zsad="asdf"; > | > > > > > > | > > > > > } > | > > > > > > | > > > > > protected override void OnInit(EventArgs e) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > //this.EnsureChildControls(); > | > > > > > > | > > > > > > | > > > > > // Do whatever the control usually does OnInit > | > > > > > > | > > > > > base.OnInit(e); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > protected override void OnLoad(EventArgs e) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > //this.EnsureChildControls(); > | > > > > > > | > > > > > // Do whatever the control usually does OnInit > | > > > > > > | > > > > > base.OnLoad(e); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > private void > rysReportingYearSelector_ReportingYearChanged(obje ct > | > > > sender, > | > > > > > EventArgs e) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > this.LoadFundingSource(); > | > > > > > > | > > > > > this.LoadProviders(); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > private void fasFiscalAgent_FiscalAgentChanged(object sender, > | > > EventArgs > | > > > e) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > this.LoadFundingSource(); > | > > > > > > | > > > > > this.LoadProviders(); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > private void ddlProviders_SelectedIndexChanged(object sender, > | > > EventArgs > | > > > e) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > LoadSites(); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > private void ddlSites_SelectedIndexChanged(object sender, > | EventArgs > | > e) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > LoadClasses(); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > #endregion > | > > > > > > | > > > > > protected override void CreateChildControls() > | > > > > > > | > > > > > { > | > > > > > > | > > > > > rysReportingYearSelector = new ReportingYearReportSelector(); > | > > > > > > | > > > > > fasFiscalAgent = new FiscalAgentReportSelector(); > | > > > > > > | > > > > > this.ddlFundingSource = new DropDownList(); > | > > > > > > | > > > > > this.ddlProviders = new DropDownList(); > | > > > > > > | > > > > > this.ddlSites = new DropDownList(); > | > > > > > > | > > > > > this.ddlClasses = new DropDownList(); > | > > > > > > | > > > > > rysReportingYearSelector.ID = ReportingYearSelectorControlId; > | > > > > > > | > > > > > fasFiscalAgent.ID = FiscalAgentSelectorControlId; > | > > > > > > | > > > > > ddlFundingSource.ID = FundingSourceControlId; > | > > > > > > | > > > > > ddlProviders.ID = ProvidersControlId; > | > > > > > > | > > > > > ddlSites.ID = SitesControlId; > | > > > > > > | > > > > > ddlClasses.ID = ClassesControlId; > | > > > > > > | > > > > > // Assign these controls' Page property because when they try to > | > > access > | > > > > Page > | > > > > > they get null reference - apparently they aren't in the control > | tree > | > > at > | > > > > that > | > > > > > point > | > > > > > > | > > > > > rysReportingYearSelector.Page = this.Page; > | > > > > > > | > > > > > fasFiscalAgent.Page = this.Page; > | > > > > > > | > > > > > rysReportingYearSelector.ReportingYearChanged += new > | > > > > > EventHandler(rysReportingYearSelector_ReportingYea rChanged); > | > > > > > > | > > > > > fasFiscalAgent.FiscalAgentChanged += new > | > > > > > EventHandler(fasFiscalAgent_FiscalAgentChanged); > | > > > > > > | > > > > > ddlProviders.SelectedIndexChanged += new > | > > > > > EventHandler(ddlProviders_SelectedIndexChanged); > | > > > > > > | > > > > > ddlSites.SelectedIndexChanged += new > | > > > > > EventHandler(ddlSites_SelectedIndexChanged); > | > > > > > > | > > > > > fasFiscalAgent.IsSubmitOnChange = true; > | > > > > > > | > > > > > ddlProviders.AutoPostBack = true; > | > > > > > > | > > > > > ddlSites.AutoPostBack = true; > | > > > > > > | > > > > > // this.SchoolYear = rysReportingYearSelector.SchoolYear; > | > > > > > > | > > > > > // check if can populate funding sources and providers (because > | > > > > fiscalAgent > | > > > > > has been saved in session) > | > > > > > > | > > > > > if(this.fasFiscalAgent.SelectedFiscalAgentName != string.Empty) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > LoadFundingSource(); > | > > > > > > | > > > > > LoadProviders(); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > else > | > > > > > > | > > > > > { > | > > > > > > | > > > > > ddlFundingSource.Visible = false; > | > > > > > > | > > > > > ddlProviders.Visible = false; > | > > > > > > | > > > > > } > | > > > > > > | > > > > > // Initially set to false until their direct parent's selection > | has > | > > been > | > > > > > made (all other controls will have data on page load) > | > > > > > > | > > > > > ddlSites.Visible = false; > | > > > > > > | > > > > > ddlClasses.Visible = false; > | > > > > > > | > > > > > // start containing table > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table cellpadding=0 > | > > > > > cellspacing=0><tr><td>")); > | > > > > > > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > | > > > > > > | > > > > > this.Controls.Add(rysReportingYearSelector); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); > | > > > > > > | > > > > > this.Controls.Add(fasFiscalAgent); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Funding > | > > > > > Source</td><td>")); > | > > > > > > | > > > > > this.Controls.Add(ddlFundingSource); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > | > > > > > > | > > > > > > | > > > > > | > > > > | > > > | > > | > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Providers</td><td>") > | > > > > > ); > | > > > > > > | > > > > > this.Controls.Add(ddlProviders); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > | > > > > > > | > > > > > > | > > > > | > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Sites</td><td>")); > | > > > > > > | > > > > > this.Controls.Add(ddlSites); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); > | > > > > > > | > > > > > > | > > > > > | > > > > | > > > | > > | > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Classes</td><td>")); > | > > > > > > | > > > > > this.Controls.Add(ddlClasses); > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > | > > > > > > | > > > > > // end containing table > | > > > > > > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > private void LoadFundingSource() > | > > > > > > | > > > > > { > | > > > > > > | > > > > > int fiscalAgentId = this.fasFiscalAgent.SelectedFiscalAgentId; > | > > > > > > | > > > > > > | > > > > > if(fiscalAgentId != int.MinValue) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > this.ddlFundingSource.Visible = true; > | > > > > > > | > > > > > this.ddlFundingSource.DataSource = > | > > > FiscalAgentFunding.Find(fiscalAgentId); > | > > > > > > | > > > > > this.ddlFundingSource.DataTextField = "ShortDescription"; > | > > > > > > | > > > > > this.ddlFundingSource.DataValueField = "CodeId"; > | > > > > > > | > > > > > this.ddlFundingSource.DataBind(); > | > > > > > > | > > > > > if(this.ddlFundingSource.Items.Count > 1) > | > > > > > > | > > > > > this.ddlFundingSource.Items.Insert(0, new ListItem(string.Empty, > | > > > > > string.Empty)); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > else > | > > > > > > | > > > > > { > | > > > > > > | > > > > > this.ddlFundingSource.Visible = false; > | > > > > > > | > > > > > } > | > > > > > > | > > > > > } > | > > > > > > | > > > > > private void LoadProviders() > | > > > > > > | > > > > > { > | > > > > > > | > > > > > int fiscalAgentId = fasFiscalAgent.SelectedFiscalAgentId; > | > > > > > > | > > > > > if(fiscalAgentId != int.MinValue) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > ddlProviders.Visible = true; > | > > > > > > | > > > > > ddlProviders.DataSource = > FiscalAgentProvider.Find(fiscalAgentId, > | > > > > > rysReportingYearSelector.ReportingYearStartDate, > | > > > > > rysReportingYearSelector.ReportingYearEndDate); > | > > > > > > | > > > > > ddlProviders.DataTextField = "ProviderName"; > | > > > > > > | > > > > > ddlProviders.DataValueField = "ProviderId"; > | > > > > > > | > > > > > ddlProviders.DataBind(); > | > > > > > > | > > > > > ddlProviders.Items.Insert(0, new ListItem(string.Empty, > | > > string.Empty)); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > else > | > > > > > > | > > > > > { > | > > > > > > | > > > > > this.ddlProviders.Items.Clear(); > | > > > > > > | > > > > > this.ddlProviders.Visible = false; > | > > > > > > | > > > > > } > | > > > > > > | > > > > > LoadSites(); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > private void LoadSites() > | > > > > > > | > > > > > { > | > > > > > > | > > > > > if(ddlProviders.SelectedValue != string.Empty) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > // Load the Site search parameters. > | > > > > > > | > > > > > SiteFindArgs siteFindArgs=new SiteFindArgs(); > | > > > > > > | > > > > > > | > > > > > | > > > > | > > > | > > | > siteFindArgs.FiscalAgentId=Convert.ToInt32(fasFisc alAgent.SelectedFiscalAgen > | > > > > > tId); > | > > > > > > | > > > > > ddlSites.Visible = true; > | > > > > > > | > > > > > ddlSites.DataSource = Business.Site.Find(siteFindArgs); > | > > > > > > | > > > > > ddlSites.DataTextField = "Name"; > | > > > > > > | > > > > > ddlSites.DataValueField = "SiteId"; > | > > > > > > | > > > > > ddlSites.DataBind(); > | > > > > > > | > > > > > ddlSites.Items.Insert(0, new ListItem(string.Empty, > | string.Empty)); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > else > | > > > > > > | > > > > > { > | > > > > > > | > > > > > ddlSites.Items.Clear(); > | > > > > > > | > > > > > ddlSites.Visible = false; > | > > > > > > | > > > > > } > | > > > > > > | > > > > > LoadClasses(); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > private void LoadClasses() > | > > > > > > | > > > > > { > | > > > > > > | > > > > > if(ddlSites.SelectedValue != string.Empty) > | > > > > > > | > > > > > { > | > > > > > > | > > > > > ClassFindArgs adultEdClassFindArgs = new ClassFindArgs(); > | > > > > > > | > > > > > adultEdClassFindArgs.FiscalAgentId = > | > > > > > Convert.ToInt32(fasFiscalAgent.SelectedFiscalAgent Id); > | > > > > > > | > > > > > adultEdClassFindArgs.ReportingYearStartDate = > | > > > > > rysReportingYearSelector.ReportingYearStartDate; > | > > > > > > | > > > > > adultEdClassFindArgs.ReportingYearEndDate = > | > > > > > rysReportingYearSelector.ReportingYearEndDate; > | > > > > > > | > > > > > adultEdClassFindArgs.ProviderName = ddlProviders.SelectedValue; > | > > > > > > | > > > > > adultEdClassFindArgs.SiteName = ddlSites.SelectedValue; > | > > > > > > | > > > > > > | > > > > > ddlClasses.Visible = true; > | > > > > > > | > > > > > ddlClasses.DataSource = Class.Find(classFindArgs); > | > > > > > > | > > > > > ddlClasses.DataTextField = "Name"; > | > > > > > > | > > > > > ddlClasses.DataValueField = "ClassId"; > | > > > > > > | > > > > > ddlClasses.DataBind(); > | > > > > > > | > > > > > ddlClasses.Items.Insert(0, new ListItem(string.Empty, > | > string.Empty)); > | > > > > > > | > > > > > } > | > > > > > > | > > > > > else > | > > > > > > | > > > > > { > | > > > > > > | > > > > > ddlClasses.Items.Clear(); > | > > > > > > | > > > > > ddlClasses.Visible = false; > | > > > > > > | > > > > > } > | > > > > > > | > > > > > } > | > > > > > > | > > > > > > | > > > > > > | > > > > > #region Public Properties > | > > > > > > | > > > > > #region IReportParameterControl Members > | > > > > > > | > > > > > public object ParameterValue > | > > > > > > | > > > > > { > | > > > > > > | > > > > > get{ return null; } > | > > > > > > | > > > > > set{ /*do nothing */ } > | > > > > > > | > > > > > } > | > > > > > > | > > > > > public ParameterCollection Parameters > | > > > > > > | > > > > > { > | > > > > > > | > > > > > get{ return parameters; } > | > > > > > > | > > > > > set{ parameters = value;} > | > > > > > > | > > > > > } > | > > > > > > | > > > > > #endregion > | > > > > > > | > > > > > public int SchoolYear > | > > > > > > | > > > > > { > | > > > > > > | > > > > > get{ return (int) ViewState["SchoolYear"]; } > | > > > > > > | > > > > > set{ ViewState["SchoolYear"] = value; } > | > > > > > > | > > > > > } > | > > > > > > | > > > > > #endregion > | > > > > > > | > > > > > #region Private Member Variables > | > > > > > > | > > > > > private ReportingYearReportSelector rysReportingYearSelector; > | > > > > > > | > > > > > private FiscalAgentReportSelector fasFiscalAgent; > | > > > > > > | > > > > > private DropDownList ddlFundingSource; > | > > > > > > | > > > > > private DropDownList ddlProviders; > | > > > > > > | > > > > > private DropDownList ddlSites; > | > > > > > > | > > > > > private DropDownList ddlClasses; > | > > > > > > | > > > > > private ParameterCollection parameters = new > | ParameterCollection(); > | > > > > > > | > > > > > #endregion > | > > > > > > | > > > > > #region Private Constants > | > > > > > > | > > > > > private const string ReportingYearSelectorControlId = > | > > > > > "rysReportingYearSelector"; > | > > > > > > | > > > > > private const string FiscalAgentSelectorControlId = > | > > > > > "fasFiscalAgentSelector"; > | > > > > > > | > > > > > private const string FundingSourceControlId = > "ddlFundingSource"; > | > > > > > > | > > > > > private const string FundingSourceLabelControlId = > | > "lblFundingSource"; > | > > > > > > | > > > > > private const string ProvidersControlId = "ddlProviders"; > | > > > > > > | > > > > > private const string ProvidersLabelControlId = "lblProviders"; > | > > > > > > | > > > > > private const string SitesControlId = "ddlSites"; > | > > > > > > | > > > > > private const string SitesLabelControlId = "lblSites"; > | > > > > > > | > > > > > private const string ClassesControlId = "ddlClasses"; > | > > > > > > | > > > > > private const string ClassesLabelControlId = "lblClasses"; > | > > > > > > | > > > > > #endregion > | > > > > > > | > > > > > } > | > > > > > > | > > > > > } > | > > > > > > | > > > > > > | > > > > > | > > > > > | > > > > | > > > > | > > > | > > > | > > | > > | > | > | > |
|
|
|
|
|||
|
|||
| TS |
|
Steven Cheng[MSFT]
Guest
Posts: n/a
|
OK. I'll continue to followup in your "explanation of when need..." issue.
Please feel free to post there. Thanks, Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) -------------------- | From: "TS" <> | References: <#> <> <> <> <> <> <> | Subject: Re: processing postback | Date: Fri, 5 Aug 2005 08:34:54 -0500 | Lines: 848 | X-Priority: 3 | X-MSMail-Priority: Normal | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 | Message-ID: <> | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingc ontrols | NNTP-Posting-Host: 103nat100.tea.state.tx.us 198.214.103.100 | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.aspnet.buildingc ontrols:4000 | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols | | thanks, but it seems my only problem that still exists is the posts i'm | making in "explanation of when need..." | | | "Steven Cheng[MSFT]" <> wrote in message | news:... | > Hi TS, | > | > Welcome to ASPNET newsgroup. | > Regarding on the post back event handling problem in composite control, | > generaly speaking , the most likely cause is still the event handler's | > registering sequence and the control's constructing and adding approach. | > | > For your former problem, (postback event for sub controls not fire when | the | > composite control doesn't implement INamingContainer), this is because for | > sub controls contained in composite control, they need to be assigned an | > unique clientID which will be used when it's postback event be fired( the | > runtime will use this ID to mapping the event to the correct control | > instance). When we didn't implement NamingContainer interface, the | > composite control won't assign the appropriate ClientID(also UniqueID) for | > the nested sub controls, so sub controls' post back event won't be handled | > correclty. | > | > As for the new problem you mentioned, I'm wondering how did you create | your | > composite control (also its nested sub composite controls inside it)? For | > the "Page" property, it'll be assigned properly when a certain control is | > added into its container control's Controls collection, we don't need to | > manually assign it. Anyway, would you try provide some code snippet to | > represent your composite control's code logic? It'll be much helpful if | you | > can make a very simple repro demo control to demostrate the problem. | > | > Thanks, | > | > Steven Cheng | > Microsoft Online Support | > | > Get Secure! www.microsoft.com/security | > (This posting is provided "AS IS", with no warranties, and confers no | > rights.) | > | > | > | > | > | > | > -------------------- | > | From: "TS" <> | > | References: <#> | > <> | > <> | > <> | > <> | > | Subject: Re: processing postback | > | Date: Tue, 2 Aug 2005 15:54:05 -0500 | > | Lines: 717 | > | X-Priority: 3 | > | X-MSMail-Priority: Normal | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 | > | Message-ID: <> | > | Newsgroups: | > | microsoft.public.dotnet.framework.aspnet.buildingc ontrols,microsoft.public.d | > otnet.framework.aspnet.webcontrols | > | NNTP-Posting-Host: 103nat100.tea.state.tx.us 198.214.103.100 | > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.phx.gbl | > | Xref: TK2MSFTNGXA01.phx.gbl | > microsoft.public.dotnet.framework.aspnet.webcontro ls:10237 | > microsoft.public.dotnet.framework.aspnet.buildingc ontrols:3976 | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols | > | | > | I have a new issue: | > | | > | One of my controls in my composite control is in itself a composite | > control. | > | It has an event that is raised when one of its drop down lists selected | > | index changes. In main composite control, i hook into this other | control's | > | event so that i can do processing. This event won't fire in either the | > drop | > | down list's selected index change event handler and also not in the | event | > | handler that my main control subscribes to. | > | | > | I have a clue that may be the reason: In this sub composite control, it | > | tries to access the page property, which is null when it's | > | CreateChildControls. So how i fixed it was to assign this composite | > | control's page property to my main control's page property so that it | now | > | can access the page property. I'm wondering if this has something to do | > with | > | the event not firing. | > | | > | thanks | > | | > | "TS" <> wrote in message | > | news:... | > | > I figured it out, i wasnt' implementing INamingContainer. that fixes | > | > it...BUT WHY DOES THIS IMPACT IF EVENTS GET FIRED OR NOT???? | > | > | > | > | > | > "TS" <> wrote in message | > | > news:... | > | > > I think i maybe should be doing this at all because i can just | access | > | the | > | > > control's value because that control handles the functionality | > | > automatically | > | > > that I was trying to do. | > | > > | > | > > If this is so, then i still have a problem: How do i raise events in | > my | > | > > control for controls i have created in createchildcontrols? I have | the | > | > > controls wired up to event handlers, but they are never hit. | > | > > | > | > > What do i need to do? | > | > > | > | > > thanks | > | > > | > | > > "TS" <> wrote in message | > | > > news:... | > | > > > i followed the article at: | > | > > > | > | > > | > | > | > | | > | http://msdn.microsoft.com/library/de...us/cpguide/htm | > l/cpconpostbackdataprocessingsample.asp | > | > > > and it works like that except like i said when I use | > | createchildControls | > | > > > instead of render (because i need to render multiple controls), it | > | > doesn't | > | > > > hit those postback methods. | > | > > > | > | > > > thanks again | > | > > > | > | > > > "TS" <> wrote in message | > | > > > news:... | > | > > > > Well i know it has something to do with the CREATEChildControls | > | method | > | > > > > because when i overrode render instead of doing that method at | > all, | > | > the | > | > > > > LoadPostData() was executed. I guess it has something to do with | > the | > | > > > > controls being recreated each time, I DON"T KNOW. | > | > > > > | > | > > > > I need help all of you master coders | > | > > > > | > | > > > > | > | > > > > "TS" <> wrote in message | > | > > > > news:%... | > | > > > > > i have a composite control that has dropdowns on them. The | page | > | will | > | > > > post | > | > > > > > back on change, but their events won't raise. Can anyone tell | me | > | > whats | > | > > > > going | > | > > > > > on? I tried to use the IPostBackDataHandler to try to get a | hold | > | of | > | > > the | > | > > > > > control to set values and such, but it has been no help. I'm | > | > confused | > | > > at | > | > > > > how | > | > > > > > this control is supposed to work. I want it to be self | contained | > | so | > | > > that | > | > > > > > when a control changes, it posts back and then reloads its | > | dependent | > | > > > drop | > | > > > > > down lists with data that is filtered based on the value of | the | > | > > control | > | > > > > that | > | > > > > > changed. | > | > > > > > | > | > > > > > Every time the page posts back to server, the it hits the init | > and | > | > > load | > | > > > > > events and createchildcontrols, but thats it. i can't get into | > the | > | > > > > > XXX_SelectedIndexChanged events for some reason even though | they | > | are | > | > > > wired | > | > > > > > to do so. | > | > > > > > | > | > > > > > Any help will be appreaciated as i'm starting to feel dumb. | > | > > > > > | > | > > > > > using System; | > | > > > > > | > | > > > > > using System.Collections.Specialized; | > | > > > > > | > | > > > > > using System.Web.UI; | > | > > > > > | > | > > > > > using System.Web.UI.WebControls; | > | > > > > > | > | > > > > > using System.Text; | > | > > > > > | > | > > > > > using Operations.Teams.Business; | > | > > > > > | > | > > > > > using Operations.Teams.Data; | > | > > > > > | > | > > > > > using Operations.Teams.Reporting; | > | > > > > > | > | > > > > > using Operations.Teams.Reporting.WebControls; | > | > > > > > | > | > > > > > namespace Operations.Teams.Web.ReportControls | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > /// <summary> | > | > > > > > | > | > > > > > /// Summary description for FiscalAgentHierarchy. | > | > > > > > | > | > > > > > /// </summary> | > | > > > > > | > | > > > > > public class FiscalAgentHierarchy : Control, | > | > IReportParameterControl, | > | > > > > > IPostBackDataHandler | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > public FiscalAgentHierarchy() | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > Parameters.Add(new Parameter("@SchoolYear")); | > | > > > > > | > | > > > > > Parameters.Add(new Parameter("@ReportingGroup")); | > | > > > > > | > | > > > > > Parameters.Add(new Parameter("@FiscalAgentID")); | > | > > > > > | > | > > > > > Parameters.Add(new Parameter("@FundingSourceID")); | > | > > > > > | > | > > > > > Parameters.Add(new Parameter("@ProviderID")); | > | > > > > > | > | > > > > > Parameters.Add(new Parameter("@SiteID")); | > | > > > > > | > | > > > > > Parameters.Add(new Parameter("@ClassID")); | > | > > > > > | > | > > > > > Parameters["@SchoolYear"].Value = 2006; | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > | > | > > > > > #region Events | > | > > > > > | > | > > > > > | > | > > > > > public bool LoadPostData(string postDataKey, | NameValueCollection | > | > > > postData) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > string postedValue = postData[postDataKey]; | > | > > > > > | > | > > > > > return true; | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > public void RaisePostDataChangedEvent() | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > rysReportingYearSelector_ReportingYearChanged(this , | > | > EventArgs.Empty); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > protected override void LoadViewState(object savedState) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > string zasdf="asdlfkjds"; | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > protected override object SaveViewState() | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > string zsad="asdf"; | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > protected override void OnInit(EventArgs e) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > //this.EnsureChildControls(); | > | > > > > > | > | > > > > > | > | > > > > > // Do whatever the control usually does OnInit | > | > > > > > | > | > > > > > base.OnInit(e); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > protected override void OnLoad(EventArgs e) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > //this.EnsureChildControls(); | > | > > > > > | > | > > > > > // Do whatever the control usually does OnInit | > | > > > > > | > | > > > > > base.OnLoad(e); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > private void | > rysReportingYearSelector_ReportingYearChanged(obje ct | > | > > > sender, | > | > > > > > EventArgs e) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > this.LoadFundingSource(); | > | > > > > > | > | > > > > > this.LoadProviders(); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > private void fasFiscalAgent_FiscalAgentChanged(object sender, | > | > > EventArgs | > | > > > e) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > this.LoadFundingSource(); | > | > > > > > | > | > > > > > this.LoadProviders(); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > private void ddlProviders_SelectedIndexChanged(object sender, | > | > > EventArgs | > | > > > e) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > LoadSites(); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > private void ddlSites_SelectedIndexChanged(object sender, | > | EventArgs | > | > e) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > LoadClasses(); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > #endregion | > | > > > > > | > | > > > > > protected override void CreateChildControls() | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > rysReportingYearSelector = new ReportingYearReportSelector(); | > | > > > > > | > | > > > > > fasFiscalAgent = new FiscalAgentReportSelector(); | > | > > > > > | > | > > > > > this.ddlFundingSource = new DropDownList(); | > | > > > > > | > | > > > > > this.ddlProviders = new DropDownList(); | > | > > > > > | > | > > > > > this.ddlSites = new DropDownList(); | > | > > > > > | > | > > > > > this.ddlClasses = new DropDownList(); | > | > > > > > | > | > > > > > rysReportingYearSelector.ID = ReportingYearSelectorControlId; | > | > > > > > | > | > > > > > fasFiscalAgent.ID = FiscalAgentSelectorControlId; | > | > > > > > | > | > > > > > ddlFundingSource.ID = FundingSourceControlId; | > | > > > > > | > | > > > > > ddlProviders.ID = ProvidersControlId; | > | > > > > > | > | > > > > > ddlSites.ID = SitesControlId; | > | > > > > > | > | > > > > > ddlClasses.ID = ClassesControlId; | > | > > > > > | > | > > > > > // Assign these controls' Page property because when they try | to | > | > > access | > | > > > > Page | > | > > > > > they get null reference - apparently they aren't in the | control | > | tree | > | > > at | > | > > > > that | > | > > > > > point | > | > > > > > | > | > > > > > rysReportingYearSelector.Page = this.Page; | > | > > > > > | > | > > > > > fasFiscalAgent.Page = this.Page; | > | > > > > > | > | > > > > > rysReportingYearSelector.ReportingYearChanged += new | > | > > > > > EventHandler(rysReportingYearSelector_ReportingYea rChanged); | > | > > > > > | > | > > > > > fasFiscalAgent.FiscalAgentChanged += new | > | > > > > > EventHandler(fasFiscalAgent_FiscalAgentChanged); | > | > > > > > | > | > > > > > ddlProviders.SelectedIndexChanged += new | > | > > > > > EventHandler(ddlProviders_SelectedIndexChanged); | > | > > > > > | > | > > > > > ddlSites.SelectedIndexChanged += new | > | > > > > > EventHandler(ddlSites_SelectedIndexChanged); | > | > > > > > | > | > > > > > fasFiscalAgent.IsSubmitOnChange = true; | > | > > > > > | > | > > > > > ddlProviders.AutoPostBack = true; | > | > > > > > | > | > > > > > ddlSites.AutoPostBack = true; | > | > > > > > | > | > > > > > // this.SchoolYear = rysReportingYearSelector.SchoolYear; | > | > > > > > | > | > > > > > // check if can populate funding sources and providers | (because | > | > > > > fiscalAgent | > | > > > > > has been saved in session) | > | > > > > > | > | > > > > > if(this.fasFiscalAgent.SelectedFiscalAgentName != | string.Empty) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > LoadFundingSource(); | > | > > > > > | > | > > > > > LoadProviders(); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > else | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > ddlFundingSource.Visible = false; | > | > > > > > | > | > > > > > ddlProviders.Visible = false; | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > // Initially set to false until their direct parent's | selection | > | has | > | > > been | > | > > > > > made (all other controls will have data on page load) | > | > > > > > | > | > > > > > ddlSites.Visible = false; | > | > > > > > | > | > > > > > ddlClasses.Visible = false; | > | > > > > > | > | > > > > > // start containing table | > | > > > > > | > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table cellpadding=0 | > | > > > > > cellspacing=0><tr><td>")); | > | > > > > > | > | > > > > > | > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); | > | > > > > > | > | > > > > > this.Controls.Add(rysReportingYearSelector); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > | > > > > > | > | > > > > > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>")); | > | > > > > > | > | > > > > > this.Controls.Add(fasFiscalAgent); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Funding | > | > > > > > Source</td><td>")); | > | > > > > > | > | > > > > > this.Controls.Add(ddlFundingSource); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > | > > > > > | > | > > > > > | > | > > > > | > | > > > | > | > > | > | > | > | | > | this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Providers</td><td>") | > | > > > > > ); | > | > > > > > | > | > > > > > this.Controls.Add(ddlProviders); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > | > > > > > | > | > > > > > | > | > > > | > | > | > this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Sites</td><td>")); | > | > > > > > | > | > > > > > this.Controls.Add(ddlSites); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr><tr><td>")); | > | > > > > > | > | > > > > > | > | > > > > | > | > > > | > | > > | > | > | > | | > | this.Controls.Add(WebHelper.MakeLiteral("<table><t r><td>Classes</td><td>")); | > | > > > > > | > | > > > > > this.Controls.Add(ddlClasses); | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > | > > > > > | > | > > > > > // end containing table | > | > > > > > | > | > > > > > | this.Controls.Add(WebHelper.MakeLiteral("</td></tr></table>")); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > private void LoadFundingSource() | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > int fiscalAgentId = this.fasFiscalAgent.SelectedFiscalAgentId; | > | > > > > > | > | > > > > > | > | > > > > > if(fiscalAgentId != int.MinValue) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > this.ddlFundingSource.Visible = true; | > | > > > > > | > | > > > > > this.ddlFundingSource.DataSource = | > | > > > FiscalAgentFunding.Find(fiscalAgentId); | > | > > > > > | > | > > > > > this.ddlFundingSource.DataTextField = "ShortDescription"; | > | > > > > > | > | > > > > > this.ddlFundingSource.DataValueField = "CodeId"; | > | > > > > > | > | > > > > > this.ddlFundingSource.DataBind(); | > | > > > > > | > | > > > > > if(this.ddlFundingSource.Items.Count > 1) | > | > > > > > | > | > > > > > this.ddlFundingSource.Items.Insert(0, new | ListItem(string.Empty, | > | > > > > > string.Empty)); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > else | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > this.ddlFundingSource.Visible = false; | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > private void LoadProviders() | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > int fiscalAgentId = fasFiscalAgent.SelectedFiscalAgentId; | > | > > > > > | > | > > > > > if(fiscalAgentId != int.MinValue) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > ddlProviders.Visible = true; | > | > > > > > | > | > > > > > ddlProviders.DataSource = | > FiscalAgentProvider.Find(fiscalAgentId, | > | > > > > > rysReportingYearSelector.ReportingYearStartDate, | > | > > > > > rysReportingYearSelector.ReportingYearEndDate); | > | > > > > > | > | > > > > > ddlProviders.DataTextField = "ProviderName"; | > | > > > > > | > | > > > > > ddlProviders.DataValueField = "ProviderId"; | > | > > > > > | > | > > > > > ddlProviders.DataBind(); | > | > > > > > | > | > > > > > ddlProviders.Items.Insert(0, new ListItem(string.Empty, | > | > > string.Empty)); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > else | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > this.ddlProviders.Items.Clear(); | > | > > > > > | > | > > > > > this.ddlProviders.Visible = false; | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > LoadSites(); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > private void LoadSites() | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > if(ddlProviders.SelectedValue != string.Empty) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > // Load the Site search parameters. | > | > > > > > | > | > > > > > SiteFindArgs siteFindArgs=new SiteFindArgs(); | > | > > > > > | > | > > > > > | > | > > > > | > | > > > | > | > > | > | > | > | | > | siteFindArgs.FiscalAgentId=Convert.ToInt32(fasFisc alAgent.SelectedFiscalAgen | > | > > > > > tId); | > | > > > > > | > | > > > > > ddlSites.Visible = true; | > | > > > > > | > | > > > > > ddlSites.DataSource = Business.Site.Find(siteFindArgs); | > | > > > > > | > | > > > > > ddlSites.DataTextField = "Name"; | > | > > > > > | > | > > > > > ddlSites.DataValueField = "SiteId"; | > | > > > > > | > | > > > > > ddlSites.DataBind(); | > | > > > > > | > | > > > > > ddlSites.Items.Insert(0, new ListItem(string.Empty, | > | string.Empty)); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > else | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > ddlSites.Items.Clear(); | > | > > > > > | > | > > > > > ddlSites.Visible = false; | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > LoadClasses(); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > private void LoadClasses() | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > if(ddlSites.SelectedValue != string.Empty) | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > ClassFindArgs adultEdClassFindArgs = new ClassFindArgs(); | > | > > > > > | > | > > > > > adultEdClassFindArgs.FiscalAgentId = | > | > > > > > Convert.ToInt32(fasFiscalAgent.SelectedFiscalAgent Id); | > | > > > > > | > | > > > > > adultEdClassFindArgs.ReportingYearStartDate = | > | > > > > > rysReportingYearSelector.ReportingYearStartDate; | > | > > > > > | > | > > > > > adultEdClassFindArgs.ReportingYearEndDate = | > | > > > > > rysReportingYearSelector.ReportingYearEndDate; | > | > > > > > | > | > > > > > adultEdClassFindArgs.ProviderName = | ddlProviders.SelectedValue; | > | > > > > > | > | > > > > > adultEdClassFindArgs.SiteName = ddlSites.SelectedValue; | > | > > > > > | > | > > > > > | > | > > > > > ddlClasses.Visible = true; | > | > > > > > | > | > > > > > ddlClasses.DataSource = Class.Find(classFindArgs); | > | > > > > > | > | > > > > > ddlClasses.DataTextField = "Name"; | > | > > > > > | > | > > > > > ddlClasses.DataValueField = "ClassId"; | > | > > > > > | > | > > > > > ddlClasses.DataBind(); | > | > > > > > | > | > > > > > ddlClasses.Items.Insert(0, new ListItem(string.Empty, | > | > string.Empty)); | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > else | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > ddlClasses.Items.Clear(); | > | > > > > > | > | > > > > > ddlClasses.Visible = false; | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > | > | > > > > > | > | > > > > > #region Public Properties | > | > > > > > | > | > > > > > #region IReportParameterControl Members | > | > > > > > | > | > > > > > public object ParameterValue | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > get{ return null; } | > | > > > > > | > | > > > > > set{ /*do nothing */ } | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > public ParameterCollection Parameters | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > get{ return parameters; } | > | > > > > > | > | > > > > > set{ parameters = value;} | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > #endregion | > | > > > > > | > | > > > > > public int SchoolYear | > | > > > > > | > | > > > > > { | > | > > > > > | > | > > > > > get{ return (int) ViewState["SchoolYear"]; } | > | > > > > > | > | > > > > > set{ ViewState["SchoolYear"] = value; } | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > #endregion | > | > > > > > | > | > > > > > #region Private Member Variables | > | > > > > > | > | > > > > > private ReportingYearReportSelector rysReportingYearSelector; | > | > > > > > | > | > > > > > private FiscalAgentReportSelector fasFiscalAgent; | > | > > > > > | > | > > > > > private DropDownList ddlFundingSource; | > | > > > > > | > | > > > > > private DropDownList ddlProviders; | > | > > > > > | > | > > > > > private DropDownList ddlSites; | > | > > > > > | > | > > > > > private DropDownList ddlClasses; | > | > > > > > | > | > > > > > private ParameterCollection parameters = new | > | ParameterCollection(); | > | > > > > > | > | > > > > > #endregion | > | > > > > > | > | > > > > > #region Private Constants | > | > > > > > | > | > > > > > private const string ReportingYearSelectorControlId = | > | > > > > > "rysReportingYearSelector"; | > | > > > > > | > | > > > > > private const string FiscalAgentSelectorControlId = | > | > > > > > "fasFiscalAgentSelector"; | > | > > > > > | > | > > > > > private const string FundingSourceControlId = | > "ddlFundingSource"; | > | > > > > > | > | > > > > > private const string FundingSourceLabelControlId = | > | > "lblFundingSource"; | > | > > > > > | > | > > > > > private const string ProvidersControlId = "ddlProviders"; | > | > > > > > | > | > > > > > private const string ProvidersLabelControlId = "lblProviders"; | > | > > > > > | > | > > > > > private const string SitesControlId = "ddlSites"; | > | > > > > > | > | > > > > > private const string SitesLabelControlId = "lblSites"; | > | > > > > > | > | > > > > > private const string ClassesControlId = "ddlClasses"; | > | > > > > > | > | > > > > > private const string ClassesLabelControlId = "lblClasses"; | > | > > > > > | > | > > > > > #endregion | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > } | > | > > > > > | > | > > > > > | > | > > > > | > | > > > > | > | > > > | > | > > > | > | > > | > | > > | > | > | > | > | > | | > | | > | | > | | | |
|
|
|
|
|||
|
|||
| Steven Cheng[MSFT] |
|
|
|
| |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Postback not processing without Trace Mode | jeffreytfritz@gmail.com | ASP .Net | 1 | 08-24-2006 03:23 PM |
| Processing Postback Data | Nathan Sokalski | ASP .Net | 3 | 07-21-2006 09:19 PM |
| Stop input while postback is processing | Adrian Parker | ASP .Net | 5 | 03-03-2006 05:39 AM |
| Post-Processing RAW vs Post-Processing TIFF | Mike Henley | Digital Photography | 42 | 01-30-2005 08:26 AM |
| Question: processing HTML, re-write default processing action of many tags | Hubert Hung-Hsien Chang | Python | 2 | 09-17-2004 03:10 PM |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc..
SEO by vBSEO ©2010, Crawlability, Inc. |




