possible to manipulate pure HTML controls from code-behind?

  • Thread starter Thread starter Jeff
  • Start date Start date
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
 
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
 
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
 
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)
 
Back
Top