I am using C # .net
I have different views in my web form, all of them usually contain different information, with the exception of three text fields (time of arrival / view / departure). To try and shorten the code, I created a UserControl that contains these three text fields.
I referenced UserControl at the top of my web form, as well as in every view.
<%@Register TagPrefix="uc1" TagName="userTimes" Src="~/usercontrols/userTimes.ascx"%>
<uc1:userTimes id="userAppointmentTimes" runat="server"></uc2:userTimes>
Unable to access text fields from code behind. I need to fill in the text fields first and also save any updated information that will be reinserted back into the database if it is changed.
There are also two Validation controls in each text box:
- First make sure that he succeeds in the HH: MM format
- Secondly, make sure that arrival is before seen time, etc.
My two questions are:
- How do I access the UserControl from the code behind? I read that I need to use FindControl, but I don’t understand why, when I know what it is called.
- Am I taking control (server side) of the UserControl code behind or the web form code behind?
Thanks in advance for your help.
Clare
source
share