Common set controls in ASP. NET

Source: Internet
Author: User

1. gridview.

View code

1 <asp: gridview 2 id = "gridview name" 3 runat = "server" 4 autogeneratecolumns = "false" 5 allowpaging = "true" 6 Height = "160px" 7 width = "868px" 8 borderstyle = "NONE" 9 pagesize = "13" 10 onpageindexchanging = "Paging change event name" 11 onrowdatabound = "gvywy_rowdatabound" 12 onrowcommand = "gvywy_rowcommand"> 13 <! -- Column definition --> 14 <columns> 15 <! -- Common label --> 16 <asp: boundfield datafield = "corresponding field" headertext = "column header display name" visible = "false"/> 17 <! -- Customizable cells --> 18 <asp: templatefield headertext = "column header display name"> 19 <itemtemplate> 20 <asp: label id = "label1" runat = "server" text = '<% # method name ("corresponding field") %>'> </ASP: label> 21 </itemtemplate> 22 </ASP: templatefield> 23 <asp: templatefield headertext = "edit"> 24 <itemtemplate> 25 <asp: linkbutton id = "lbtnedit" 26 runat = "server" 27 forecolor = "#996600" 28 commandname = "Ed" 29 commandargument = '<% # eval ("corresponding to 30 characters ") %> '> 31 edit 32 </ASP: linkbutton> 33 </itemtemplate> 34 </ASP: templatefield> 35 <asp: templatefield headertext = "delete"> 36 <itemtemplate> 37 <asp: linkbutton id = "lbtndelete" 38 runat = "server" 39 forecolor = "#996600" 40 commandname = "de" 41 commandargument = '<% #42 eval ("ywybh ") %> '> 43 Delete 44 </ASP: linkbutton> 45 </itemtemplate> 46 </ASP: templatefield> 47 </columns> 48 

The preceding Code defines the edit and delete templates. The edit itemtemplate is the ASP: linkbutton control,

ASP: commandname = "command name" of the linkbutton Control"

Bind the expression to pass the value:

Commandargument = '<% # eval ("a field in a single element of the bound collection object") %>'>

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.