John Jeyakumar

John Jeyakumar

  • NA
  • 42
  • 1.4k

Adding more than one usercontrols to sharepoint 2010 webpart

May 7 2013 2:50 AM

Hi,
I have one webpart in sharepoint 2010,have to add one more usercontrol(.ascx) in that webpart with configurable property.Is it possible..This one is working fine in normal webpage(.aspx),but it is not working in Sharepoint ,it shows error like 'filename.ascx is not allowed in this page.[i.e one usercontrol with configurable property we can add any webpart.---this is the actual requirement]
I tried load the usercontrol in page load,it is working fine,but i can not add the properties.

protected override void OnLoad(EventArgs e) { base.OnLoad(e); UserControl control = (UserControl)Page.LoadControl("/DropdownData.ascx"); Controls.Add(control); }

In the above example i have to add properties(hight,width,datasource) for ?DropdownData(dropdownlist) in webpart file.
please help me out.