CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 4/8/2008 11:31:21 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 6 Views: 24 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
7 Items, 1 Pages 1 |< << Go >> >|
JasonTrinacle
Asp.Net User
Why do some User Controls display as a class and other don't? (Master Page Goodness)4/8/2008 11:31:21 PM

0/0

While trying to figure out how to access a user control's methods contained in a master page dynamically from a content page, I came across this (pseudo)code:

    Dim ucm As UC_MyUserControl = DirectCast(Me.Page.Master.FindControl("myUserControl"), UC_MyUserControl) 

 My problem is that only a partial list of the classes attached to my user controls display via Intellisense when I start typing "UC_" (the prefix for all my user controls)

Can anyone explain this behavior?  If I can instantiate my user control into an object and call the methods attached to that user control (and, more importantly, pass it arguments), then I have come a long way to finishing my current project!

 

Any help would be Greatly Appreciated!

 

Jason 

mbanavige
Asp.Net User
Re: Why do some User Controls display as a class and other don't? (Master Page Goodness)4/9/2008 2:41:51 AM

0/0

if the user is on the page that you are accessing it from then its Type would be recognized as the control would be registered with the page.

It looks like you're accessing a control on a MasterPage from the code-behind of a content page.  That user control is probably not registered on the content page so its Type is not recognized.  Drag/Drop the usercontrol onto the content page itself and then delete it. Then look in the markup up by the page directive and you should see that the control is now registered on your content page.  Now try casting to that Type.


Mike Banavige
~~~~~~~~~~~~
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
JasonTrinacle
Asp.Net User
Re: Why do some User Controls display as a class and other don't? (Master Page Goodness)4/9/2008 2:17:30 PM

0/0

mbanavige:

Drag/Drop the usercontrol onto the content page itself and then delete it. Then look in the markup up by the page directive and you should see that the control is now registered on your content page.  Now try casting to that Type.

That worked perfectly!  Now my user control class is appearing on the code-behind page and I can type to it, and call the methods attached to that user control.

But now I am getting an "ambiguous name" error when I run the page.  Could this be because the class is already being defined on the Master Page?  Any idea how I could get around this?

Thanks,

Jason

brucevde
Asp.Net User
Re: Why do some User Controls display as a class and other don't? (Master Page Goodness)4/9/2008 8:17:03 PM

0/0

Try using the @Reference directive instead of @Register in the content page.

 <%@ Reference Control="~/uc_MyControl.ascx" %>

 

 

mbanavige
Asp.Net User
Re: Why do some User Controls display as a class and other don't? (Master Page Goodness)4/10/2008 11:01:56 PM

0/0

JasonTrinacle:

But now I am getting an "ambiguous name" error when I run the page.  Could this be because the class is already being defined on the Master Page? 

Using a usercontrol on both your masterpage and a content page shouldn't be a problem.  Usually when i get an error like that it's caused by a stale temporary assembly from a prior build.  Doing a full rebuild has always cleared that type of error for me.

 


Mike Banavige
~~~~~~~~~~~~
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
JasonTrinacle
Asp.Net User
Re: Why do some User Controls display as a class and other don't? (Master Page Goodness)4/11/2008 1:09:02 PM

0/0

Thanks!  That worked.  I found a back-up copy of my user control that contained the same class name, but re-buidling the project cleared up the error altogether.

Jason

uwspstar
Asp.Net User
Re: Why do some User Controls display as a class and other don't? (Master Page Goodness)4/11/2008 2:39:11 PM

0/0

mbanavige:

if the user is on the page that you are accessing it from then its Type would be recognized as the control would be registered with the page.

It looks like you're accessing a control on a MasterPage from the code-behind of a content page.  That user control is probably not registered on the content page so its Type is not recognized.  Drag/Drop the usercontrol onto the content page itself and then delete it. Then look in the markup up by the page directive and you should see that the control is now registered on your content page.  Now try casting to that Type.

mbanavige 's answere also solve my problem too


owner -- AskBargains.com
7 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Visual Web Developer Team Blog : Part 2 of 3: Creating shared user ... Part 2 of 3: Creating shared user controls and master pages with sub-projects ..... Similarly for other resources, e.g. some of my sub-projects include ...
Display SinglePost User Control And don’t forget, you can use the User Control options to remove the items like date and author ... Net that will display the time it took to load the page. ...
Nikhil Kothari's Weblog : Atlas M1 Refresh - Some More Goodies The other problem is that the two selects are placed inside user control which ... project i have master page and content page too but here in this project ...
Passing data to Master pages in ASP.NET MVC - ASP.NET Forums I've also used this technique for passing data to User Controls, ... That way we don't violate SoC, SRP and all that goodness. ...
CodeProject: UFrame: goodness of UpdatePanel and IFRAME combined ... May 24, 2008 ... If you don't do this, IE6 just hangs when you attempt to set the ..... The web application uses a menu control which is in the masterpage. ...
Passing parameter from one user control to another - ASP.NET Forums Do I pass the paremter to the master page and then pass it into the user ... I don’t think it was setting the values for the properties in the master page ...
AnimeOnDVD Forums - Announcements in Forum : Gaming Goodness User Display Names - Originally we had no problems with users using Japanese text for .... Linguistic Master - Don't assume that everything fansubbers do is ...
Blog & Development Diary :: Doodle Graphics If you don't want to do that, you can create a .config file next to the Site .... specific master page or base master page, or indeed on a user control). ...
'Dynamic' Master Pages - .Net Development Now, since the two applications are the same, I don't really ... I call the ' backward' approach -- the content page controls the master page ...
lancefisher.net You lost control over the ids as soon as you used a master page or user control, ..... For instance, some functions like append() in jQuery don't have ...

Videos:
Randy Pausch - Really Achieving Your Childhood Dreams Randy Pausch's Last Lecture with English and German subtitles by Friederike Sophie Brand, Spanish subtitles by Carlos Velásquez and Ezequiel Aranda, ...
Literate functional testing Google London Test Automation Conference (LTAC) Google Tech Talks September 7th, 2006 Presenters: Robert Chatley and Tom White
XML11: An Abstract Windowing Protocol Google TechTalks June 1, 2006 Arno Puder Arno Puder received his masters and Ph.D. in computer science and is currently working as an Assistant Prof...
(888)MOAX.ORG Microsoft Offfice Accounting Xchange 4_IT_JOURNAL.wmv (888)MOAX.ORG Microsoft Offfice Accounting Xchange 4_IT_JOURNAL.wmv - 31 min - Apr 23, 2008 USStudios - http://www.onafree.com (1 Rating) Rate: (...




Search This Site:










change relative path problems

sqlsitemapprovider tip ...

text wrapping in submenu item for menu control

treeview in page with existing menu and sitemap

menu or treeview where only children of selected node are expanded

sys.webforms.pagerequestmanagerservererrorexception

themes - changing the display of a control in response to user input

menu staticsubmenu text wrap not aligning propely

multiple sitemap files one site

treeview issue in .net 2.0

how to set acceptbutton to a content page?

listing content place holderers of a masterpage???

asp:content within the head tag of the maintemplate.master throwing error when compiling

subdomain site: master page not working

request.form is not working with the master page (plz.... really urgent)

skin error?

apply css in master page

using javascript calendar in content page

determine if master page is using default content or content contained in an .aspx

treeview with anchor tags

how do you change the path for to a .dll?

dynamic statictopseparatorimageurl?

sitemappath problem

'createresourcebasedliteralcontrol' is not a member of 'asp.homemasterpage_master'.

bread and crumb navigation

how to access next button in createuserwizard

how to apply a masterpage to existing aspx pages?

strange gray line in treeview entries

treeview menu looks wrong once uploaded to internet

dropdown vertical navigation menu ( with animation? )

  Privacy | Contact Us
All Times Are GMT