The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Changing HTML Element Attributes in Codebehind

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Doug Thews

Posts: 866
Nickname: dougthews
Registered: Jul, 2003

Doug Thews is a software developer/manager for D&D Consulting Services with 18+ years of experience
Changing HTML Element Attributes in Codebehind Posted: Jul 24, 2003 10:14 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Doug Thews.
Original Post: Changing HTML Element Attributes in Codebehind
Feed Title: IlluminatiLand
Feed URL: http://apps5.oingo.com/apps/domainpark/domainpark.cgi?client=netw8744&s=JETBRAINS.COM
Feed Description: A technology blog for people enlightened enough to think for themselves
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Doug Thews
Latest Posts From IlluminatiLand

Advertisement
Sometimes, you'd like to manage the properties of plain HTML elements during the postback process. Well, you can by using the Attributes property of the HtmlGenericControl

For example, let's say you wanted to dynamically change the element's background color during postback. The first step would to be to manually define the BODY element in the codebehind (as we learned from a previous example, the VS.NET IDE does not do this for you). In your ASPX file, you would modify the element to look something like this:
  

Then, in your VB.NET codebehind file, you would add the reference:
  Protected body As
    System.Web.UI.HtmlControls.HtmlGenericControl


Now, to manipulate the background color attribute of this generic HTML control, just use the Attributes property:
  body.Attributes("bgcolor") = ""

Use this to provide more spice to your ASP.NET web applications when you use plain HTML controls.

Read: Changing HTML Element Attributes in Codebehind

Topic: Dye Out 3-6 Weeks Previous Topic   Next Topic Topic: Why The A's Are Fading in the AL West

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use