Related articles: teach you 30 seconds to build strong type ASP.net data binding, strongly typed ASP.net data binding improved version 2nd
Read Dragonpig wrote "teach you 30 seconds to build strong type ASP.net data binding," a bright, is really too much power, the original can also be data binding.
Immediately a small try, and made some improvements, has now been applied to the news column in the home. Let's share some of the improvements.
With the traditional asp.net data-binding approach, there are two places that have been uncomfortable:
1 lack of intelligent perception;
2 Force type conversion.
Let's take a look at the traditional ASP.net data binding:
Look at the above ToString (), (DateTime) ...
Dragonpig's strongly typed binding mentality already contains a way to solve both of these problems, but in the code he shows, the first problem (IntelliSense) is ignored, but the second problem (coercion type conversion) is omitted, and the original code is as follows:
I found in the use of forced type conversion, a bit uncomfortable, research, the original is the trouble of object, as long as the above code two object to TResult, the problem is solved.
In addition, I changed the Stu method name to Eval, which feels more friendly.
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.