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") %>'>