I have created a userconrol named FirstControl.ascx and SecondControl.ascx in Sharepoint. Both the controls automatically created under CONTROLTEMPLATES\MySolution\.. folder

Within SecondControl.ascx I registered FirstControl.ascx as below:

<%@ Register Src="~/_controltemplates/15/MySolution/FirstControl.ascx" TagPrefix="uc1" TagName="FirstControl" %>

<uc1:FirstControl ID="FirstControl1" runat="server" OnLoad="FirstControl1_Load" />

On code behinde SecondControl.ascx.cs file, I could not access public property SelectedDateTime of FirstControl.ascx

on FirstControl.ascx.cs file , I have this Public property declared:

public partial class FirstControl: UserControl

        public delegate void SelectedDate(SelectedDateEventArgs e);
        public event SelectedDate OnSelectedDate;

    public DateTime SelectedDateTime
                    return GetDateTime(txtDate.Text, txtTime.Text);
                    hfDateTime.Value = value;

on SecondControl.ascx.cs file, I tried to access the public property SelectedDateTime But in the intellisence of FirstControl1., I could not find property SelectedDateTime

  • do both .cs files have same namespace? – Aveenav Mar 15 '17 at 19:39
  • Yes, both controls have same namespace. any idea to fix? – SPBeginer Mar 16 '17 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.