Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Set HTML Attribute In Page_Load Event

Reply
Thread Tools

Set HTML Attribute In Page_Load Event

 
 
Ben Foster
Guest
Posts: n/a
 
      02-21-2005
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


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      02-21-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Ben Foster
Guest
Posts: n/a
 
      02-21-2005
Eliyahu,

That works fine. Thanks.

Ben

"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Materpage page_load event fired after content page_load? rockdale ASP .Net 1 11-16-2006 06:59 PM
How to avoid execution of page_load event before click event of a =?Utf-8?B?Sm9zZVZhbGVuY2lh?= ASP .Net 5 04-04-2006 11:00 AM
difference between PreRender event and Page_Load event Jimmy ASP .Net 5 04-27-2005 10:51 PM
in VB.NET Page_load of a base class called after the derived class Page_load ? z. f. ASP .Net 0 10-19-2004 12:01 PM
Why does page_load fire twice when inheriting from a common overridable Page_Load bminder ASP .Net 1 02-23-2004 08:54 PM



Advertisments