473,396 Members | 2,034 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,396 software developers and data experts.

Set HTML Attribute In Page_Load Event

I want to be able to set an attribute of the HTML object in the form's
Page_Load event. I can't see how to do this. The main problem is that I
can't see how to access the HTML object from this event. Can anyone help ?

Ben
Nov 19 '05 #1
2 1740
Ben,

Forthe element you need to specify runat=server and id=myHtml. Then VS will
define the element for you in code-behind as the page's protected member. In
any page method you can set an attribute as (c# syntax):

myHtml.Attributes["myAttribute"]="my string";

Eliyahu

"Ben Foster" <be********@nospam.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
I want to be able to set an attribute of the HTML object in the form's
Page_Load event. I can't see how to do this. The main problem is that I
can't see how to access the HTML object from this event. Can anyone help ?

Ben

Nov 19 '05 #2
Eliyahu,

That works fine. Thanks.

Ben

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Ben,

Forthe element you need to specify runat=server and id=myHtml. Then VS
will
define the element for you in code-behind as the page's protected member.
In
any page method you can set an attribute as (c# syntax):

myHtml.Attributes["myAttribute"]="my string";

Eliyahu

"Ben Foster" <be********@nospam.com> wrote in message
news:Oo**************@TK2MSFTNGP10.phx.gbl...
I want to be able to set an attribute of the HTML object in the form's
Page_Load event. I can't see how to do this. The main problem is that I
can't see how to access the HTML object from this event. Can anyone help
?

Ben


Nov 19 '05 #3

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

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
3
by: Ramesh | last post by:
hi, I have some basic questions. Can anybody explain me the following doubt: 1. In my asp page, right click and selected HTML source code. Added following method. <script...
2
by: Jeff | last post by:
Can I manipulate the properties of pure HTML controls (i.e. not server side controls) from my aspx.cs Page_Load event? If so, I don't see the control listed by intellisense. I gave the control a...
7
by: Oisin Grehan | last post by:
Hi, I have a UserControl derived class: <ns:votingbutton runat="server" id="btn1" onclick="votingbuttonclick" /> My question is, what code do I need in place in the codebehind for this to...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: Corno | last post by:
Hi all, I have a page with a table of which the rows have to be added dynamically. What I also want is 'code behind' the onclick event of a row (the page should be posted back to the server,...
1
by: Neil Zanella | last post by:
Hello, I would like to ask a question pertaining to programmatic initialization of ASP web controls (as opposed to initialization via standalone attributes and other elements contained in the...
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
9
by: Veerle | last post by:
Hi, When you use multiple asp:Buttons on one Form, then asp.net generates html submit buttons for all of them. When you put your cursor in one of the textfields of the form, the default submit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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
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,...

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.