I have a date range user control with two calendar controls: DateRange.ascx
public partial class DateRange { public string FromDate { get { return calFromDate.Text; } set { calFromDate.Text = value; } }
public string ToDate { get { return calToDate.Date; } set { calToDate.Text = value; } } }
I have another user control in which DateRange control is loaded dynamically: ParamViewer.ascx
public partial class ParamViewer { public void Setup(string sControlName) { //Load parameter control Control control = LoadControl("DateRange.ascx"); Controls.Add(control);
DateRange dteFrom = (DateRange)control.FindControl("calFromDate"); DateRange dteTo = (DateRange)control.FindControl("calToDate");
}
}
I have a main page webForm1.aspx where ParamViewer.ascx is added
When user enter the dates, they're set correctly in DateRange control.
My question is how how do I retrieve the values entered in DateRange (FromDate and ToDate)control from btnSubmit_Click event in webForm1? Please advise. Thank you in advance.