Use button in Repeater

Source: Internet
Author: User

Not much nonsense.Code

Front-end code:

 
<Asp: repeater id = "repeater3" runat = "server"> <itemtemplate> <Div class = "line_item"> <a href = "line. aspx? Line_id = <% # eval ("ID") %> "> <% # eval (" title ") %> </a> <span style =" color: RGB (136,136,136); float: Right; margin-Right: 90px; "> <% # eval (" price ") %> RMB/person </span> <asp: hiddenfield id = "lineid" runat = "server" value = '<% # eval ("ID") %>'/> <asp: button id = "button1" onclick = "advance" style = "float: Right; margin-Right:-120px; margin-top:-4px; "runat =" server "text =" Reservation "/> </div> </itemtemplate> </ASP: repeater>

Background code:

 # region protected void advance (Object sender, eventargs e) {button bt = sender as button; repeateritem rI = BT. parent as repeateritem; hiddenfield Tx = Ri. findcontrol ("lineid") as hiddenfield; If (! Object. Equals (TX, null) {response. Write (TX. Value) ;}# endregion 

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.