A flexible grasp of the use of the GridView in asp.net mvc-practical tips

Source: Internet
Author: User
Tags button type constant static class actionlink

This tutorial for you to share the GridView control of the use and specific implementation code, for your reference, the specific contents are as follows

Entity classes under Models files:

 public class Customer
 {public
 int Id {get; set;} 
 public string CompanyName {get; set;} 
 public string ContactTitle {get; set;}
 public string Address {get; set;}
 public string City {get; set;}  
 public string Country {get; set;}
 public string Phone {get; set;}
 Public DateTime founded {get; set;}
 }

 public class Customersviewmodel

 {public
 iqueryable<customer> Customers {get; set;}

 Public Paginginfo Paginginfo {get; set;}

 public string Jsonpaginginfo {get; set;}
 }

 public static class Expresssionbuilder {private static readonly MethodInfo Containsmethod = typeof (String).
 GetMethod ("Contains"); private static readonly MethodInfo Startswithmethod = typeof (String).
 GetMethod ("StartsWith", new type[] {typeof (String)}); private static readonly MethodInfo Endswithmethod = typeof (String).


 GetMethod ("EndsWith", new type[] {typeof (String)}); public static expression&lt;func&lt;t,bool&gt;&gt; getexpression&lt;t&gt; (ilist&lt;filterobject&gt; filters) {if ( Filters.

  Count = 0) return null;
  ParameterExpression param = Expression.parameter (typeof (T), "T");

  Expression exp = null; if (filters.
  Count = = 1) exp = getexpression&lt;t&gt; (param, filters[0]); else if (filters.
  Count = = 2) exp = getexpression&lt;t&gt; (param, filters[0], filters[1]); else {while (filters).
   Count &gt; 0) {var f1 = filters[0];

   var F2 = filters[1];
   if (exp = NULL) exp = getexpression&lt;t&gt; (param, filters[0], filters[1]); else Exp = EXPRESSION.ANDALSO (exp, getexpression&lt;t&gt; (param, filters[0), filters[1]); Filters.
   Remove (F1); Filters.

   Remove (F2); if (filters.
   Count = = 1) {exp = expression.andalso (exp, getexpression&lt;t&gt; (param, filters[0)); Filters.
   RemoveAt (0);
 }} return expression.lambda&lt;func&lt;t, bool&gt;&gt; (exp, param);  private static Expression getexpression&lt;t&gt; (parameterexpression param, filterobject filter) {memberexpression member = Expression.property (param, filter.
  Column); CONSTANTEXPRESSION constant = expression.constant (filter.

  Value);
  New logic to handle nullable decimal and datetime values Unaryexpression constant = NULL; if (member.
  Type = = typeof (Decimal?)) {constant = Expression.convert (Expression.constant (Decimal.Parse) (filter. Value)), member.
  Type); else if (member.
  Type = = typeof (DateTime)) {constant = Expression.convert (Expression.constant (DateTime.Parse) (filter. Value)), member.
  Type); else {constant = Expression.convert (ExpressiOn. Constant (filter. Value), member.
  Type); } switch (filter.

  Operator) {case FilterOperator.Equals:return expression.equal (member, constant);

  Case FilterOperator.GreaterThan:return Expression.greaterthan (member, constant);

  Case FilterOperator.GreaterThanOrEqual:return expression.greaterthanorequal (member, constant);

  Case FilterOperator.LessThan:return Expression.lessthan (member, constant);

  Case FilterOperator.LessThanOrEqual:return expression.lessthanorequal (member, constant);

  Case FilterOperator.Contains:return Expression.call (member, Containsmethod, constant);

  Case FilterOperator.StartsWith:return Expression.call (member, Startswithmethod, constant);

  Case FilterOperator.EndsWith:return Expression.call (member, Endswithmethod, constant);
  Case FilterOperator.NotEqual:return Expression.negate (expression.equal (Member, constant));
 return null; private static Binaryexpression getexpression&lt;t&gt; (parameterexprEssion param, Filterobject filter1, Filterobject filter2) {Expression bin1 = getexpression&lt;t&gt; (param, filter1);

  Expression bin2 = getexpression&lt;t&gt; (param, filter2);
 Return Expression.andalso (Bin1, bin2);

 }
 }

 public class Paginginfo {public list&lt;int&gt; pageoptions {get; set;}

 public bool Showpageoptions {get; set;}
 public int TotalItems {get; set;}
 public int ItemsPerPage {get; set;}

 public int CurrentPage {get; set;} public int TotalPages {get {return (int) math.ceiling (decimal) TotalItems/(itemsperpage!= 0?) Itemsperpage:1));

 Sortobject Sort {get; set;}

 Public ilist&lt;filterobject&gt; Filters {get; set;}
 public string Searchterm {get; set;}

 public class Sortobject {public String sortcolumn {get; set;}
 Public SortDirection Direction {get; set;} 

 public class Filterobject {public string Column {get; set;}

 public string Value {get; set;}

 Public Filteroperator Operator {get; set;}
 Public filterconjunction conjunction {get; set;} }/********* ENUMS *************/public enum SortDirection {NotSet, ascending, descending} public enum Filte Roperator {Contains, GreaterThan, GreaterthAnorequal, LessThan, Lessthanorequal, StartsWith, EndsWith, Equals, notequal} public enum Filterconjunction {  
  And, or} public class Extensions {public static string Getwhereclause (Filterobject filterobj, Type valuetype) {
  String whereclause = "true"; if (ValueType!= typeof (DateTime)) {switch (filterobj.operator) {case FilterOperator.Contains:if (Valuetyp E = = typeof (String) Whereclause + = string. Format (' {0} {1} '.
   Contains (\ "{2}\") ", Filterobj.conjunction, Filterobj.column, Filterobj.value);
   Break Case FilterOperator.GreaterThan:if (ValueType!= typeof (String)) Whereclause + = string.
   Format ("{0} {1} &gt; {2}", Filterobj.conjunction, Filterobj.column, Filterobj.value);
   Break Case FilterOperator.GreaterThanOrEqual:if (ValueType!= typeof (String)) Whereclause + = string.
   Format ("{0} {1} &gt;= {2}", Filterobj.conjunction, Filterobj.column, Filterobj.value);
   Break
 Case Filteroperator.lessthan:  if (ValueType!= typeof (String)) Whereclause + = string.
   Format ("{0} {1} &lt; {2}", Filterobj.conjunction, Filterobj.column, Filterobj.value);
   Break Case FilterOperator.LessThanOrEqual:if (ValueType!= typeof (String)) Whereclause + = string.
   Format ("{0} {1} &lt;= {2}", Filterobj.conjunction, Filterobj.column, Filterobj.value);
   Break Case FilterOperator.StartsWith:if (ValueType!= typeof (String)) Whereclause + = string. Format (' {0} {1} '.
   StartsWith (\ "{2}\") ", Filterobj.conjunction, Filterobj.column, Filterobj.value);
   Break Case FilterOperator.EndsWith:if (ValueType!= typeof (String)) Whereclause + = string. Format (' {0} {1} '.
   EndsWith (\ "{2}\") ", Filterobj.conjunction, Filterobj.column, Filterobj.value);
   Break Case FilterOperator.Equals:whereClause = string. Format (valuetype = = typeof (String)?
   ' {0} {1} = = = = ' {2}\ ': ' {0} {1} = = {2} ', Filterobj.conjunction, Filterobj.column, Filterobj.value);
 Break  Case FilterOperator.NotEqual:whereClause = string. Format (valuetype = = typeof (String)?
   ' {0} {1}!= \ ' {2}\ ': ' {0} {1}!= {2} ', Filterobj.conjunction, Filterobj.column, Filterobj.value);
   Break
  Default:throw new ArgumentOutOfRangeException ();
  } else {DateTime dt;

  Datetime.tryparse (Filterobj.value, out DT);
   Switch (filterobj.operator) {case FilterOperator.Contains:break; Case FilterOperator.GreaterThan:whereClause = string.
   Format ("{0} {1}" &gt; DateTime (\ "{2}\") ", Filterobj.conjunction, filterobj.column, DT);
   Break Case FilterOperator.GreaterThanOrEqual:whereClause = string.
   Format (' {0} {1} ' &gt;= DateTime (\ ' {2}\ ') ', filterobj.conjunction, filterobj.column, DT);
   Break Case FilterOperator.LessThan:whereClause = string.
   Format ("{0} {1}" &lt; DateTime (\ "{2}\") ", Filterobj.conjunction, filterobj.column, DT);
   Break Case FilterOperator.LessThanOrEqual:whereClause = string. Format (' {0} {1} ' &lt;= DateTime (\ "{2}\") ", Filterobj.conjunction, filterobj.column, DT);
   Break
   Case FilterOperator.StartsWith:break;
   Case FilterOperator.EndsWith:break; Case FilterOperator.Equals:whereClause = string.
   Format ("{0} {1} = = DateTime (\" {2}\ ")", Filterobj.conjunction, filterobj.column, DT);
   Break Case FilterOperator.NotEqual:whereClause = string.
   Format (' {0} {1} '!= DateTime (\ ' {2}\ ') ', filterobj.conjunction, filterobj.column, DT);
   Break
  Default:throw new ArgumentOutOfRangeException ();
 } return whereclause;

 }
 }

 

 public class Gridviewmodelprovider {internal static Customersviewmodel Getcustomersviewmodel (Mydbcontext db, Pagingi
  NFO pagingdata) {int totalitems = 0; var model = new Customersviewmodel () {Customers = getresources (db. Customers.asqueryable (), PagingData, out totalitems), Paginginfo = new Paginginfo () {currentpage = Pagingdata.cu Rrentpage, ItemsPerPage = pagingdata.itemsperpage, pageoptions = new list&lt;int&gt; () {Ten, M, MB}, SHOWP  
  Ageoptions = true, Searchterm = pagingdata.searchterm, Sort = pagingdata.sort, Filters = pagingdata.filters}

  }; Model.
  Paginginfo.totalitems = TotalItems; Model. Jsonpaginginfo = Json.encode (model.

  Paginginfo);
 return model; private static iqueryable&lt;customer&gt; getresources (iqueryable&lt;customer&gt; Customers, Paginginfo PagingData,

  out int totalitems) {var customers = customers; Search if (!string. IsNullOrEmpty (Pagingdata.searchterm)) {customers = customers. Where (x =&gt; (X.companyname.contains (pagingdata.searchterm) | | x.contacttitle.contains (PAGINGDATA.SEARCHTERM))); }//filter if (pagingdata.filters!= null) {foreach (var filterobj in pagingdata.filters) {switch (filte Robj.column) {case ' city ': if (FilterObj.Value.ToLower ()!= "All") Customers = Customers.
    Where (Extensions.getwhereclause (Filterobj, typeof (String));

   Break ADD other Filter Columns here}} TotalItems = Customers.

  Count (); Sort Customers = Customers.
  By (x =&gt; x.id); if (pagingdata.sort!= null) {switch (PagingData.Sort.Direction) {case SortDirection.Ascending:if (Pagingda Ta. Sort.sortcolumn = = "CompanyName") {customers = customers.
   By (x =&gt; x.companyname); else if (PagingData.Sort.SortColumn = = "ContactTitle") {customers = customers.
   By (x =&gt; x.contacttitle);
   } break; Case SortDirection.Descending:if (PagingData.Sort.SortColumn = = "CompanynaMe ") {customers = customers.
   OrderByDescending (x =&gt; x.companyname); else if (PagingData.Sort.SortColumn = = "ContactTitle") {customers = customers.
   OrderByDescending (x =&gt; x.contacttitle);
   } break;
  Case SortDirection.NotSet:default:break; } customers = Customers. Skip ((pagingdata.currentpage-1) * pagingdata.itemsperpage).

  Take (Pagingdata.itemsperpage);
 return customers;

 } 
 }

 &lt;summary&gt;///enables efficient, dynamic combination of query predicates.
 &lt;/summary&gt; public static class Predicatebuilder {///&lt;summary&gt;///creates a predicate that evaluates to true.

 &lt;/summary&gt; public static expression&lt;func&lt;t, bool&gt;&gt; true&lt;t&gt; () {return param =&gt; True;} &lt;summary&gt;///Create a predicate that evaluates to false///&lt;/summary&gt; public static expression&lt;func&lt;t, bool&gt;&gt; Fals

 E&lt;t&gt; () {return param =&gt; false;}
 &lt;summary&gt;///creates a predicate expression from the specified lambda expression. &lt;/summary&gt; public static expression&lt;func&lt;t, bool&gt;&gt; create&lt;t&gt; (Expression&lt;func&lt;t,

 Bool&gt;&gt; predicate) {return predicate;}
 &lt;summary&gt;///combines the second first predicate with the logical "and". &lt;/summary&gt; public static expression&lt;func&lt;t, bool&gt;&gt; and&lt;t&gt; (This expression&lt;func&lt;t,
 Bool&gt;&gt;, Expression&lt;func&lt;t, bool&gt;&gt; second) {return first.compose (second, expression.andalso);
 ///&lt;summary&gt;///combines the second first predicate with the logical "or". &lt;/summary&gt; public static expression&lt;func&lt;t, bool&gt;&gt; or&lt;t&gt; (this expression&lt;func&lt;t, bool&gt;&gt;
 Expression&lt;func&lt;t, bool&gt;&gt; second) {return first.compose (second, expression.orelse); }///&lt;summary&gt;///negative predicate///&lt;/summary&gt; public static expression&lt;func&lt;t, bool&gt;&gt; not&lt;t&gt; (T His expression&lt;func&lt;t, bool&gt;&gt; Expression) {var negated = Expression.not (Expression.
  body); Return expression.lambda&lt;func&lt;t, bool&gt;&gt; (negated, Expression.
 Parameters); ///&lt;summary&gt;///merges the second and first expression///&lt;/summary&gt; static expression&lt;t&gt; compose&lt;t&gt; using the specified merge function (this Expression&lt;t&gt;, expression&lt;t&gt; Second, func&lt;expression, Expression, expression&gt; merge) {//second parameter mapping To the first parameter var map = i. Parameters. Select ((f, i) =&gt; new {f, s = second. Parameters[i]}).

  ToDictionary (P =&gt; p.s, p =&gt; p.f); Parameter substitution of the first lambda expression in the second lambda expression parameter var secondbody = Parameterrebinder.replaCeparameters (map, second.

  body); Creates a merged LAMBDA expression with a parameter from the first expression return expression.lambda&lt;t&gt; (A. Body, secondbody), the
 Parameters); Class Parameterrebinder:expressionvisitor {readonly dictionary&lt;parameterexpression, parameterexpression&gt; m

  Ap Parameterrebinder (dictionary&lt;parameterexpression, parameterexpression&gt; map) {This.map = map?? new DICTIONARY&L T
  ParameterExpression, parameterexpression&gt; (); public static Expression ReplaceParameters (dictionary&lt;parameterexpression, parameterexpression&gt; map, Expression exp) {return new Parameterrebinder (map).
  VISIT (exp);

  } protected override Expression Visitparameter (ParameterExpression p) {ParameterExpression replacement; if (map.
  TryGetValue (p, out replacement)) {p = replacement; Return to base.
  Visitparameter (P);

 }
 }
 }

MyDbContext.CS Code:

 public class Mydbcontext:dbcontext
 {public
 mydbcontext ()
  : Base ("DefaultConnection")
 {

 }

 Public dbset<customer> Customers {get; set;}

 protected override void Onmodelcreating (Dbmodelbuilder modelbuilder)
 {  
  modelbuilder.entity<customer> (). Property (c => c.companyname). Hasmaxlength ();
  Modelbuilder.entity<customer> (). Property (c => c.contacttitle). Hasmaxlength (+);
 }
 

HomeController.cs Controller:

 public class Homecontroller:controller
 {public
 actionresult Index ()
 {
  var model = new Customersviewmodel ()
  {
  Customers = null,
  paginginfo = new Paginginfo ()
  {
   currentpage=1,
   itemsperpage=,
   pageoptions = new list<int> () {10,25, MB,
   showpageoptions= true,
   Totalitems=1
  }
  };
  return View (model);
 }

 Public ActionResult GetCustomers (paginginfo pagingdata)
 {
  var db = new Mydbcontext ();
  var model = Gridviewmodelprovider.getcustomersviewmodel (db, pagingdata);  
  Return Partialview ("_customerspartial", model);
 }

 Public ActionResult About ()
 {
  Viewbag.message = "Your application description page." ";

  return View ();
 }

 Public ActionResult Contacts ()
 {
  viewbag.message = "Your contact page." ";

  return View ();
 }
 

Home View folder:

_customerspartial.cshtml

@model Mesoft.gridview.Models.CustomersViewModel @* here to write down the details of the returned data *@ &lt;span class= "Gridview-data-details" Display:none; " &gt; @Html. Raw (model.jsonpaginginfo) &lt;/span&gt; &lt;table class= "table table-bordered table-striped" &gt; &lt;thead &gt; &lt;tr class= "Gridview-list-header" &gt; &lt;th&gt; @ html.displaynamefor (x =&gt; x.customers.firstordefault (). Id) &lt;/th&gt; &lt;th class= "sortable" data-sort= "CompanyName" &gt; @ html.displaynamefor (x =&gt; x.customers.first Ordefault (). CompanyName)) &lt;/th&gt; &lt;th class= "sortable" data-sort= "ContactTitle" &gt; @ (html.displaynamefor (x =&gt; x.custo Mers. FirstOrDefault (). ContactTitle) &lt;/th&gt; &lt;th&gt; @ (html.displaynamefor x =&gt; x.customers.firstordefault (). Country) &lt;/th&gt; &lt;th&gt; @ (html.displaynamefor x =&gt; x.customers.firstordefault (). City) &lt;/th&gt; &lt;th&gt; @ (html.displaynamefor x =&gt; x.customers.firstordefault (). Address) &lt;/th&gt; &lt;th&gt; @ (HTML.DISPLAYNAMEFor (x =&gt; x.customers.firstordefault (). Phone) &lt;/th&gt; &lt;th&gt; @Html. Displaynamefor (x=&gt; x.customers.firstordefault (). Founded) &lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody id= "customerstable" class= "Gridview-list-items" &gt; @if ( Model.Customers.Any ()) {foreach (var c in model.customers) {&lt;tr&gt; &lt;td class= ' value ' &gt;@c.id&lt;/td&gt
   ; &LT;TD class= "value" &gt;@c.CompanyName&lt;/td&gt; &lt;td class= "value" &gt;@c.ContactTitle&lt;/td&gt; &lt;td class= " Value "&gt;@c.Country&lt;/td&gt; &lt;td class=" value "&gt;@c.City&lt;/td&gt; &lt;td class=" Description "&gt;@c.
 address&lt;/td&gt; &lt;td class= "value" &gt;@c.Phone&lt;/td&gt; &lt;td&gt;@c.Founded&lt;/td&gt; &lt;/tr&gt;}} else {&lt;tr&gt; &lt;td colspan= "8" &gt; &lt;div class= "alert alert-warning alert-dismissable" &gt; &lt;button Type= "button" class= "Close" data-dismiss= "alert" aria-hidden= "true" &gt;x&lt;/button&gt; &lt;strong&gt; warning!
   &lt;/strong&gt; no customers to find! ,;/div&gt; &lt;/td&gt; &lt;/tr&gt; @Html. Raw (viewbag.script) &lt;/tbody&gt; &lt;/table&gt;

 

_gridviewpartial.cshtml

@model Mesoft.gridview.Models.CustomersViewModel &lt;!--gridview--&gt; &lt;div class= "GridView GridView1" &gt; &lt;!-
  -GridView header--&gt; &lt;div class= "Gridview-header" &gt; &lt;!--the left portion of the head of the GridView--&gt; &lt;div class= "Col-sm-6" &gt; &lt;div class= "Gridview-search" &gt; &lt;div class= "Search Input-group" &gt; &lt;input class= "Form-control" Placehold er= "Search" type= "search" &gt; &lt;span class= "input-group-btn" &gt; &lt;button class= "btn btn-default" type= "button" &
    Gt &lt;span class= "fa fa-search" &gt;&lt;/span&gt; &lt;span class= "sr-only" &gt;Search&lt;/span&gt; &lt;/button&gt; & lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!--the head right part of the GridView--&gt; &lt;div class= "Col-sm-6 Text-righ T "&gt; &lt;!--Add any filtering actions here--&gt; @{string[] cityfilters = {" Istanbul "," Trabzon "," Ankara "," Izmir "," Samsun "," Erzu "
  Rum "}; Filter by City: &lt;div class= "Btn-group" &gt; &lt;button type= "button" class= "btn btn-primary dropdown-toggle" Data-togg Le= "DropdoWN "&gt; Select City &lt;span class=" caret "&gt;&lt;/span&gt; &lt;/button&gt; &lt;ul class=" Dropdown-menu filter-pare NT "role=" menu &gt; @foreach (var city in cityfilters) {&lt;li&gt;&lt;a href= "#" class= "filter" data-filter-
    column= "City" data-filter-value= "@city" data-filter-operator= "@mesoft. Gridview.Models.FilterOperator.Equals" Data-filter-conjunction= "@mesoft. Gridview.Models.FilterConjunction.And" &gt; @city &lt;/a&gt;&lt;/li&gt;} &lt;li cl
     ass= "Divider" &gt;&lt;/li&gt; &lt;li class= "active" &gt;&lt;a href= "#" class= "filter" data-filter-column= "City" Data-filter-value= "All" &gt;All&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!--Gr Idview viewport--&gt; &lt;div class= "Gridview-viewport" id= "ViewPort" @Url. Action (" GetCustomers "," Home ")" data-default-pagesize= "&gt; &lt;div class=" Gridview-canvas "style=" min-height:400px; " &gt; @*data'll Load here*@ &lt;/div&gt;
 &lt;div class= "Loading GridView Gridview-loader" &gt; &lt;img src= "~/content/images/loading.gif"/&gt; &lt;/div&gt; & Lt;/div&gt; &lt;!--The paging area of the GridView--&gt; &lt;div class= "Gridview-footer" &gt; @Html. Displayfor (x =&gt; x.paginginfo, "Pa

 Ger ") &lt;/div&gt; &lt;/div&gt;

About.cshtml

@{
 viewbag.title = "about";
}
 
 

Contact.cshtml

@{
 viewbag.title = "Contact";
}
 
 

Index.cshtml

@model Mesoft.gridview.Models.CustomersViewModel

@{
 viewbag.title = "Home Page";
}

<div class= "Jumbotron" >
  
 

Shared folder:

_layout.cshtml

&lt;! DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= "Utf-8"/&gt; &lt;meta name= "viewport" content= "Width=devic" E-width, initial-scale=1.0 "&gt; &lt;title&gt; @ViewBag. Title-gridview Usage Example Application &lt;/title&gt; @Styles. Render (" ~/ Content/css ") @Scripts. Render (" ~/bundles/modernizr ") &lt;/head&gt; &lt;body&gt; &lt;div class=" NavBar navbar-inverse Navbar-fixed-top "&gt; &lt;div class=" container "&gt; &lt;div class=" Navbar-header "&gt; &lt;button type=" button "class= "Navbar-toggle" data-toggle= "collapse" data-target= "Navbar-collapse" &gt; &lt;span class= "Icon-bar" &gt;&lt;/span &gt; &lt;span class= "Icon-bar" &gt;&lt;/span&gt; &lt;span class= "Icon-bar" &gt;&lt;/span&gt; &lt;/button&gt; @Html . ActionLink ("GridView", "Index", "Home", new {area = "}, new {@class =" Navbar-brand "}) &lt;/div&gt; &lt;div class = "Navbar-collapse collapse" &gt; &lt;ul class= "Nav navbar-nav" &gt; &lt;li&gt; @Html. ActionLink ("Home", "Index", "Home") &lt;/li&gt; &lt;li&gt; @Html. actioNlink ("About", "about", "Home") &lt;/li&gt; &lt;li&gt; @Html. ActionLink ("Contacts", "Contact", "Home") &lt;/li&gt; &lt;/ Ul&gt; @* @Html. Partial ("_loginpartial") *@ &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class= "Container Body-cont
 Ent "&gt; @RenderBody () &lt;hr/&gt; &lt;footer&gt; &lt;p&gt;© @DateTime .now.year-wulex&lt;/p&gt; &lt;/footer&gt; &lt;/div&gt; @Scripts. Render ("~/bundles/jquery") @Scripts. Render ("~/bundles/bootstrap") @RenderSection ("Scripts",

 Required:false) &lt;/body&gt; &lt;/html&gt;

Run the results as shown in figure:

3 wonderful topics to be attached:

Asp. NET Control Usage Manual

Asp. NET data-bound controls using totals

Asp. NET controls use totals

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Related Article

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.