Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use LinqDataSource control

Shulou Source: shulou.com Published: 2022-06-02 09:02:13 09月23日 Update

This article mainly shows you "how to use LinqDataSource controls", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use LinqDataSource controls" this article.

Someone in the forum asked the LinqDataSource control how to combine field data to display in the following list, in fact, it is very simple, is to use new to generate a temporary class. Here is the complete code.

C # code

Using System

Using System.Collections.Generic

Using System.Web

/ / /

/ Summary description of Books

/ / /

Public class Books

{

Public int Id {get; set;}

Public String Author {get; set;}

Public String Title {get; set;}

Public DateTime PunDate {get; set;}

Public Books () {}

Public List GetBooks

{

Get

{

Return this.GetInternalBooks ()

}

}

Internal List GetInternalBooks ()

{

List bs = new List ()

Bs.Add (new Books {Id = 1, Author = "Meng Xianhui", Title = "ASP.NET 2.0 Application Development Technology"

PunDate = System.DateTime.Now.AddMonths (- 10)})

Bs.Add (new Books {Id = 2, Author = "Meng Xianhui", Title = "Eric Meyer on CSS (Volume 2)"

PunDate = System.DateTime.Now})

Bs.Add (new Books {Id = 3, Author = "Meng Xianhui", Title = "Eric Meyer on CSS (Volume 1)"

PunDate = System.DateTime.Now.AddMonths (+ 10)})

Return bs

}

}

ASPX code

The execution result of * * will look like the following:

HTML code

1Mak-Meng Xianhui-- "ASP.NET 2.0 Application Development Technology"-- 2008-07-31 2 Meng Xianhui-- "Eric Meyer talking about CSS (Volume 2)"-- 2009-05-31 313 Meng Xianhui-- "Eric Meyer talking about CSS (Volume 1)"-- 2010-03-31 is all the contents of this article entitled "how to use LinqDataSource controls". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Controls code content articles development techniques techniques caching learning help applications development fields that is abstracts data ease of understanding more organization appearance knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux macOS Xiaomi Huawei NVidia