Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 User-controls WebParts , +
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.
Posted 6-May-13 21:54pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

do u have another user control in layout folder.
bcs usercontrols r stored in layout folder.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 7 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100