473,473 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

accessing the base Page elements

hi
I'm having great problems at this simple task; accessing elements on the
base page from my code behind various user controls. For example I have the
default.aspx page and in the @Page directive I use ClassName="default_aspx"
so I would have thought that to access a Label server control with
id="myLabel" I'd use

default_aspx.myLabel.text = "my text";

well it doesn't work!
Nov 16 '05 #1
2 1290
The Page property of your Controls and Page instance points to a baseclass
of type System.Web.UI.Page. In order to get hold of your public properties
(controls etc.), you'll have to cast the Page instance to your own type:

((default_aspx) this.Page).myLabel.Text = "My Text";

Not sure this is what you were looking for, but then again, you might have
learned something new :-)

--
venlig hilsen / with regards
anders borum
--
Nov 16 '05 #2
thx Anders will look into this
I haven't seen before this syntax where you put default_aspx into
parenthesis... what is that???
Seen the same when parsing custom sections from the web configuration file:

NameValueCollection sampleConfig = (NameValueCollection) ----------here ???
ConfigurationSettings.GetConfig("myDepartmentGroup/mySection");
string strKeyValue = (string)sampleConfig["myKey"]; --------- again with
string???
"Anders Borum" <a@b.dk> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
The Page property of your Controls and Page instance points to a baseclass
of type System.Web.UI.Page. In order to get hold of your public properties
(controls etc.), you'll have to cast the Page instance to your own type:

((default_aspx) this.Page).myLabel.Text = "My Text";

Not sure this is what you were looking for, but then again, you might have
learned something new :-)

--
venlig hilsen / with regards
anders borum
--

Nov 16 '05 #3

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

Similar topics

4
by: f_salazar | last post by:
English Version !! Hi !! I have a page with a Form, inside the form I have listbox with 'X' elements. Wend I submit the page, an ASP process inside the page have to read those elements and...
6
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is...
5
by: Jack Addington | last post by:
How do I go about accessing elements of an Arraylist using something other than the index? I have a class that manages a number of subclasses. Those subclasses are stored in an arraylist. The...
1
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created...
2
by: RKT | last post by:
(Web Developer Express 2005, CSharp, C#) I've searched high and low... If have the typical _Default page. In it is a MultiView that contains another MultiView - in both of those are Views...
3
by: Joe | last post by:
Hello All: I have two webforms (WebForm1.aspx and WebForm2.aspx) that inherit from BasePage.aspx. BasePage.aspx inherits System.Web.UI.Page and has one hidden field (hdnSessionId) that I want...
5
by: Siva | last post by:
Hello I have a dropdownlist inside the gridview as a template column defined as follows: <asp:TemplateField HeaderText="Choose Location"> <ItemTemplate> <asp:DropDownList ID="ddlChooseLoc"...
3
by: judy.j.miller | last post by:
Does anyone know why i can't access a form element value using dot notation in firefox, when i'm in a function. Works ok in the body. I'm trying to do this: var FarTemp = faren.temp.value; I...
3
by: orkonoid | last post by:
Hello, I am having trouble with a Polymorphism issue using container classes. I have a longwinded and shortwinded version of my question: Shortwinded version: How can I store base class...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.