How to bind data to a cms in asp.net

Source: Internet
Author: User

Half a year ago, I wrote several articles about asp.net cms in the blog garden. At that time, my cms was not available yet. It's all a bit exaggerated. Now I have deleted those articles.

Today, I want to express my feelings for writing this article.

Now my CMS core is almost complete.

The cms version of c # is called anCms.

Basic Syntax of anCms:

1. Bind data

Copy codeThe Code is as follows:
Syntax description:
Start flag <! -- {An: method name filed = [Field 1, Field 2, field 3] sort = [field asc | desc] category = [category ID] id = [ID] keyword = [] page = [true | false] num = [number of display pages ]} -->

<! -- {/An} --> end tag

Example 1
<! -- {An: alist filed = [id, title, time] sort = [time desc]} -->
<P> No.: $ {0}, Title: $ {1}, time: $ {2} </p>
<! -- {/An} -->
Alist indicates the list of articles.
I also wrote some other methods: list, plist, llist...
Plist: list of products.
Llist indicates the list of links.
List: a general list (including articles, products, links)

Filed indicates the database field name. I believe everyone understands this.
In subsequent versions, I set the field id to the first by default.
That is: <! -- {An: alist filed = [title, time] sort = [time desc]} -->
<P> No.: $ {0}, Title: $ {1}, time: $ {2} </p>
<! -- {/An} -->
The time is often formatted.
So I wrote a method.
<! -- {An: alist filed = [title, time] sort = [time desc]} -->
<P> No.: $ {0}, Title: $ {1}, time: ${2 | yyyy-MM-dd} </p>
<! -- {/An} --> I believe everyone understands what time formatting means.

As the name suggests, category is classification. Enter the category ID.
List of articles whose category ID is equal to 1 <! -- {An: alist filed = [title, time] category = [1]} --> <p> No.: $ {0}, title: $ {1}, time: $ {2} </p> <! -- {/An} -->
Category id = # indicates the ID obtained from the Url <! -- {An: alist filed = [title, time] category = [#]} --> <p> No.: $ {0}, title: $ {1}, time: $ {2} </p> <! -- {/An} -->

Id is the same as above.

Page indicates whether to pagination. By default, pagination is not performed.
Num indicates the number displayed on each page. The default value is 10. If the value is 0, all are displayed.

Keyword indicates fuzzy search, that is, keyword search.
Now, the data binding example is almost the same.

It's a bit cold this evening. Write the bound data here.

Continue tomorrow night. I will post the implementation of each method in subsequent articles.

I hope you can communicate with each other. Let's work together to build a cms that belongs to our asp.net.

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.