…
Seriously, What the heck have you two done all your life?
Most lovely cats I’ve ever seen.
In the developing environment of C# and .NET, dynamic data binding isn’t anything new at all. I’m here just to make a summary of how to do the job to a TreeView object, and add a few contents depending on my practical experience.
Keywords: dynamic tree construction, user role, page.
Problem Description
In the classic three-layer architecture adopted by my project, we have
1. data tables that are dealt with by a DAL-located class database.cs;
2. a series of corresponding BLL classes to manipulate data retrieved from those tables;
3. aspx pages and aspx.cs code files in the presentation layer.
which means following elements are involved:
1. data table User, UserRole, RoleTree;
2. class User.cs, UserRole.cs, RoleTree.cs;
3. example page sampleTree.aspx and its code file sampleTree.aspx.cs.
A picture speaks more than a thousand words. Let’s first take a look at the chart below to get an overview of how this work is going to be done.
Solution Pt1: User Login
By the input username and password, we first get the userId, through which user role(s) are obtained and stored in a Session object. In case of more than one role for a specific user, we take an ArrayList as the role container.
Solution Pt2: Tree Construction
Then we take the RoleIDs of ArralyList above and some PageID of int as arguments to get the tree. Codes below are sample codes from sampleTree.aspx.cs:
Further Notice
//It is especially useful when applied to MasterPages.
//This solution does not take node’s parent into account, which means the TreeView object constructed is not a real tree, strictly speaking.
GIVE AND IT WILL BE GIVEN UNTO YOU
给予,你也终将得到
LUKE 6:38
Kindness and love to all I owe
No other debt doth God allow
Kindness and love then I must pay
To everybody every day.
将友善与爱给我所亏欠的,上帝不会允许你付出其它情义
友善与爱,给每个人,在每一天
-ANON
I’ve been working on an ASP.NET project lately, which means it’s high time I write something down to build up my own knowledge base and track down my trail of learning how to code effectively. Hence this article, just another ASP.NET record.
Whoever the author of Yimmys Yayo is, he’s a genius. I don’t know if he drew the cartoon below. Anyway, it’s thought-provoking.
(via)
Since Obama has made the first step, which means history has been rewritten. I start looking forward to the first female President now.
一直用一个域名管理两个博客实在不是办法,今天一狠心又买进一个域名,还是在 GoDaddy 。GoDaddy 的服务确实不错,可惜好端端的主页忽然被封了。生生祭起 Hotspot Shield 这杆 VPN 大旗才强行登录到其页面。说起来 Hotspot Shield 确实好用,在我这儿速度比 Vidalia + Firefox + FoxyProxy 要快得多,用 VFF 方案试过好几次都超时,HS一次性就搞定了,速度飞快。于是本站正式启用新域名 infia.org ,顺带把标题也改了,应景。
在 GoDaddy 购物一定记得使用 coupon ,不管是 buy 或者 renew 都能够省下不少银子,promo-code.net 上有很多现成的可用。如果还有其它分享优惠码的好站,大家尽管补充。
I’m not so satisfied to run 2 blog under one domain name, which means I have to use sub-domain or sub-directory. So I got a new domain infia.org today and assigned it to my other blog in Chinese. This way I got ralphdunn.com pointing back to this blog again, which was great. The only drawback is, the connection between these 2 blogs doesn’t seem to be that tense anymore.
Also, I changed the title used for half a year. No particular reason, I just need something fresh. Do you like the word “ralify”? ^^
Hope GoDaddy gets unblocked soon. It sucks that I can’t connect to the homepage directly.
GoDaddy’s homepage turned unreachable from yesterday, when I was just about to get a new domain name there. Then I realized it was high time I do something to retain my right surf the Internet freely. I don’t like being fooled again and again, or being another victim of the Great Wall, if you know what I mean.
Solution 1: Vidalia bundle + Firefox + FoxyProxy plugin
This one comes in handy if you were a user of Tor. When the tor circle is established, you just need to configure the FoxyProxy and add some URL patterns to use it. I used to use Torpark to do that, during which time IE-core based browser was my primary choice. To be honest, I was not content with the speed surfing with Torpark. Howerver, It’s not tor’s fault, since the network environment is so choky all along. Unfortunately, the low-speed connection still drives me crazy that I have to give it up. Pretty good project though, Vidalia.
BTW, you don’t need to install Privoxy in the bundle, Vidalia and Tor is enough for normal user to get FoxyProxy to work properly.
Solution 2: Hotspot Shield (VPN)
VPN = Virtual Private Network, which tends to create another wide-area network through Internet with users of this technology. This way you could stay secure and anonymous while being connected to the Net. Hotspot Shield is a typical application of VPN produced by AnchorFree. It not only hides your IP while you’re online, but also ensures your access to all the content without censorship. (Oh, yeah, that’s what I’m looking for. Break through the Wall!) What’s more, you don’t need to know how it works because no configuration is required at all. Install and run, that’s it!
BTW, I heard that there’s a bandwidth limit to this app: 3GB per month. I’m not quite sure if it is still the case, but 3GB is way more than enough as long as you’re not downloading media files through it.