Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use LinqDataSource control

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report