Ask a Question related to ASP.NET General, Design and Development.
-
Linus Martinsson #1
change attribute in html elements
How can I change attribute in html elements from my aspx.cs page?
For example if I want to change the src-attribute in an iframe.
//Linus
Linus Martinsson Guest
-
Adding a change event to a Date attribute of a customcomponent.
How do I add a change event for a custom attribute on a custom component? Example code: ... -
Web Custom Control, design-time property doesn't change attribute
Hi, This seems to be a simple problem, but I am unable to figure out what is wrong: I have a Web Custom Control, with two properties (both are... -
how to add class attribute to html code?
Hi, I have a control that has a property. The property is a class type. I have made it expandable in property grid like fontinfo class. But I... -
Change <link> href attribute dynamically
Hello Amir, "Amir Eshterayeh" <aeshterayeh@hotmail.com> schrieb im Newsbeitrag news:epFJJx5AEHA.2632@TK2MSFTNGP12.phx.gbl... I'd use a... -
Specifying string array as an attribute in HTML tag
This might be obvious, but I can't quite figure out the syntax to do it. How does one specify a string array in the actual HTML for a control? For... -
suzy #2
Re: change attribute in html elements
when i want to change the attribute of a htmlcontrol in c#, i use:
HtmlControl.Attributes["attributename"] = "attributevalue"
eg: oHtmlTableCell.Attributes["class"] = "headercell";
hope this helps you.!
"Linus Martinsson" <Linus.martinsson@swipnet.se> wrote in message
news:epG2GAbVDHA.2104@TK2MSFTNGP10.phx.gbl...> How can I change attribute in html elements from my aspx.cs page?
>
>
>
> For example if I want to change the src-attribute in an iframe.
>
>
>
> //Linus
>
>
suzy Guest
-
S. Justin Gengo #3
Re: change attribute in html elements
Make the html object into a server side control.
1) Add and id="myobject" and runat="server" attributes to the object in the
html code:
<iframe id="MyIframe" runat="server"></iframe>
2) Dim the object in your codebehind page as a
System.Web.UI.HtmlControls.HtmlGenericControl:
Protected MyIframe As System.Web.UI.HtmlControls.HtmlGenericControl
3) Now you may add attibutes dynamically as suzy suggests.
MyIframe.Attributes.Add("[Attribute Name]", "[Attribute Value]")
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
[url]www.aboutfortunate.com[/url]
"Out of chaos comes order."
Nietzche
"Linus Martinsson" <Linus.martinsson@swipnet.se> wrote in message
news:epG2GAbVDHA.2104@TK2MSFTNGP10.phx.gbl...> How can I change attribute in html elements from my aspx.cs page?
>
>
>
> For example if I want to change the src-attribute in an iframe.
>
>
>
> //Linus
>
>
S. Justin Gengo Guest



Reply With Quote

