Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image alt tags...

Status
Not open for further replies.

mattbold

Programmer
Oct 5, 2001
45
0
0
GB
Hello all,

Can anyone tell me how to add image alt tags to webform images if this is possible? i couldn't find a property for it...

Also I tried using an HTML image instead, but when i referred to it in my VB code behind i kept getting the error message "Object reference not set to an instance of an object". I've checked that the name in my html matches the name in the code and it does, and i've declared it at the top of my code file with "Protected WithEvents htimg1 As System.Web.UI.HtmlControls.HtmlImage"... am i missing something out?

Any help on this would be ace because i'm stumped!

cheers,
matt
 
I don't know if the imagebutton got an alt somewhere, but you can set any attribute with the attributes.add. If you want to add client script to an event you should use attributes.add.
You can put something like this in the page.load:

Dim objImage As System.Web.UI.WebControls.ImageButton
objImage.Attributes.Add("alt", "alt here")
objImage.Attributes.Add("you can use anything here", "with any value you like")
objImage.Attributes.Add("onClick", "myOnClickFunction(this);")




Then Microsoft said, "Let there be .net"; and there was .net.


Greetings, Harm Meijer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top