Use C # To operate the Asp.net imagebutton Control

Source: Internet
Author: User
<% @ Page Language = "C #" %> <% @ import namespace = "system. Drawing" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <SCRIPT runat = "server"> protected void imagebutton#click (Object sender, imageclickeventargs E) {response. write ("imagebutton1");} protected void page_load (Object sender, eventargs e) {// The HTML generated by imagebutton1 on the client Code // <Input type = "image" name = "imagebutton1" id = "imagebutton1" src = "" style = "border-width: 0px; "/> // Why does it respond to the mouse-clicked event, // I think it is back to form <input type = "image" name = "imagebutton1" id = "imagebutton1" src = "" style = "border-width: 0px; "/> // tag, <input type =" hidden "name =" _ eventvalidation "id =" _ eventvalidation "value = ".... ndgtx_yjgf "/> // This is the hidden domain, so it can respond to the working principle of the click event, which may contain the Click Event in imagebutton1, and the server code to be executed. // String name = request. Form ["_ eventvalidation"]; // If (name! = NULL) // {// response. write (name); //} protected void button#click (Object sender, eventargs e) {This. imagebutton1.alternatetext = "HEBEI quyang";} protected void button2_click (Object sender, eventargs e) {// The descriptionurl attribute is optional, it can enhance the accessibility of web browsers for text browsers. // It is mainly used for accessibility. IMG of HTML has a new longdesc attribute // only special browsers support this. imagebutton1.descriptionurl = "imagebuttondescription.htm";} protected void button3_click (Object sender, eventargs e) {This. imagebutton1.backcolor = system. drawing. color. aqua; this. imagebutton1.imageurl = "images/4_1_2_x.jpg";} protected void button4_click (Object sender, eventargs e) {This. imagebutton1.imagealign = imagealign. right ;} </SCRIPT> <HTML xmlns = "http://www.w3.org/1999/xhtml"> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.