473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

WebUserControl reference

I have created a base page (inherits from System.Web.UI.Page) from which all
my .aspx pages inherit. How can I reference a web-user-control from that
basepage? (e.g. the .aspx page calls a function on the base page
(this.SetSomeText('Hello')), which in turn will call a function in a
web-user-control (wuc.SetText()) if it exists on the page.

Thanks,
C.
Nov 22 '06 #1
3 2132
You could try using a conditional Page.FindControl( ...) call.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"chris" wrote:
I have created a base page (inherits from System.Web.UI.Page) from which all
my .aspx pages inherit. How can I reference a web-user-control from that
basepage? (e.g. the .aspx page calls a function on the base page
(this.SetSomeText('Hello')), which in turn will call a function in a
web-user-control (wuc.SetText()) if it exists on the page.

Thanks,
C.
Nov 23 '06 #2
Yes, I've tried that. If I cast to a Control, I can find the object, but
cannot cast it to the appropriate Web User Control, since I cannot seem to
reference the Web User Control.

"Peter Bromberg [C# MVP]" wrote:
You could try using a conditional Page.FindControl( ...) call.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"chris" wrote:
I have created a base page (inherits from System.Web.UI.Page) from which all
my .aspx pages inherit. How can I reference a web-user-control from that
basepage? (e.g. the .aspx page calls a function on the base page
(this.SetSomeText('Hello')), which in turn will call a function in a
web-user-control (wuc.SetText()) if it exists on the page.

Thanks,
C.
Nov 27 '06 #3
Are you using the WebSite project model? You will find it a lot easier to do
this kind of stuff with the Web Application Project Add-in.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"chris" wrote:
Yes, I've tried that. If I cast to a Control, I can find the object, but
cannot cast it to the appropriate Web User Control, since I cannot seem to
reference the Web User Control.

"Peter Bromberg [C# MVP]" wrote:
You could try using a conditional Page.FindControl( ...) call.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"chris" wrote:
I have created a base page (inherits from System.Web.UI.Page) from which all
my .aspx pages inherit. How can I reference a web-user-control from that
basepage? (e.g. the .aspx page calls a function on the base page
(this.SetSomeText('Hello')), which in turn will call a function in a
web-user-control (wuc.SetText()) if it exists on the page.
>
Thanks,
C.
Nov 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike Levin | last post by:
Hello Group, I'm using VisualStudio.NET and put a DataGrid into a WebUserControl (an ascx file). For the DataGrid element, I have set AllowSorting="True" and OnSortCommand="Grid_Sort".
4
by: Chris | last post by:
Hi, I have 2 textboxes (txtVal1, txtVal2) in a WebUserControl (WebCalcUserControl) for which I write public properties : public int Value1 { get { return Convert.ToInt32(txtVal1.Text); }...
1
by: DichkoSoft | last post by:
Hi I create WebUserControl and very confused when use control For Example: ***************************** *wuc.ascx ***************************** <script id=clientEventHandlersJS...
1
by: Robert Ward | last post by:
I am trying to load a web user control from code behind. This used to be something simple in .net 1.1 Dim myControl As ControlName = CType(Page.LoadControl("ControlName .ascx"), ControlName ) ...
0
by: Christian H | last post by:
Hello, I've just created a WebUserControl that consists of a few other controls such as DropDownList, TextBox and Button. Based on the information entered in the DropDownlist, and TextBox, the...
2
by: Oren | last post by:
Hello everyone... I have a simple WebUserControl with Button and TextBox on it. Webform1.aspx contains this WebUserControl. How can I create my own C'tor for this WebUserControl - I mean when I...
2
by: Oren | last post by:
Hi everyone, I have WebUserControl on a Webform. How can I sent dynamically to the WebUserControl from a Function/Property on the Webform ? <uc:myuc id="myid1" CurrentPage=<%#GetText()%>...
0
by: Giovanni | last post by:
Dear Friends, I have a decision to make and hope to get some insight: I have built several WebUserControls one of which is a WebUserControl that queries an SQL server database, retrieves a...
1
by: David | last post by:
I created a WebUserControl and dragged it on a form. The control works but the parent form is unaware of the control and can not access any properties, receive events, etc. Eg. .net does not...
0
by: Klaus Jensen | last post by:
Hi In a repeater-control, in the <SeparatorTemplatei have placed a webusercontrol, I have made. That works great- However, I want to know be able to only display this WebUserControl a certain...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.