possible to manipulate pure HTML controls from code-behind?

J

Jeff

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 unique ID to boot. Is what
I'm trying impossible unless you are using a server side control?

Thanks
 
S

S Gopikrishna

Hi

You have to use the RUNAT = "SERVER" attribute for the
controls to be accessed from Server side.

The following link will be helpful to you in understandin
g the difference between HTML Controls and Server Con
trols. Note that both these controls require RUNAT
= "SERVER" for accessing them from Server side

-Gopi
 
G

Giorgio Parmeggiani

Hi

I think you can't manipulate HTML control unless are server-side control
(runat = server)

If your HTM pure controls contain the runat=server attribute you can find
the control in the "System.Web.UI.HtmlControls" namespace therefore in the
Page_Load event:

protected System.Web.UI.HtmlControls.HtmlInputButton button2;

private void Page_Load(object sender, System.EventArgs e)
{
button2.Value = "Go";
}

Ciao
Giorgio
 
B

Bucko

Keep in mind also you can use the generic html control for things such
as <body> tags. (if you wanted to programmatically change body tag
attributes)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top