This tutorial we will demonstrate how to access ASP.NET controls located in the LoggedInTemplate of a LoginView Control from the C# code behind class.
Adding the LoginView Control
At this point in the tutorial I have created a new ASP.NET Empty Web Site and have added in a new blank Web Form named Default.aspx. What we need to do now is add a LoginView Control to the Web Form. To do this open up Default.aspx to Design mode and:
Yes, it is possible to find a good web host. Sometimes it takes a while. After trying several, we went with Server Intellect and have been very happy. They are the most professional, customer service friendly and technically knowledgeable host we've found so far.
Now that we have added the LoginView Control, we have the option of adding ASP.NET controls in either the AnonymousTemplate or the LoggedInTemplate appropriately. Either way, when you add a control to a template it goes out of the scope of our Default.aspx.cs code behind class. Let’s add some controls to the LoggedInTemplate and see what happens when we try to access them in C# from our code behind class. To do this:

We moved our web sites to Server Intellect and have found them to be incredibly professional. Their setup is very easy and we were up and running in no time.
Accessing Our Control
Right now we will leave the names of these controls default, Label1 and Button1. Normally, when you drop something onto a Web Form you can access the controls directly from the code behind class. However, with the controls in a template, this is not the case. To test this out open up the Default.aspx.cs code behind file and add in the following code to the Page_Load event method:
Label1.Text = "Hello World"; |

((Label)LoginView1.FindControl("Label1")).Text = "Hello World"; |
If you're looking for a really good web host, try Server Intellect - we found the setup procedure and control panel, very easy to adapt to and their IT team is awesome!
What this will do, is call the FindControl method of the LoginView and find the Label we added named Label1. Then, we will cast that as a Label type so that we can access the Text property of it and change that to 'Hello World’. Go ahead and load up the website and click the button to make sure that it works.
The Default.aspx source looks like this:
<body> |
using System; |
本日志由 flyinweb 于 2011-07-15 09:07:37 发表,目前已经被浏览 3058 次,评论 2 次;
作者添加了以下标签: LoginView,Templated Controls;
引用通告:http://www.517sou.net/Article/632/Trackback.ashx
而且直接配置文件是效率最高的,通过其它驱动效率都相对较低,BDB
这个测试不太准确,看官方的测试结果:http://bind-dlz.sourceforg
为什么使用BDB时QPS这么低? 我在bind版本基本相似的环境中测试的
It is quite useful and interesting too.
VIRT 的上限是64G,也就是36位, cat /proc/cpuinfo的结果是:addre
昨天要准备用线程重写webbench,试验了下Fedora Linux 2.6.35.14
不明白您的具体的意思是什么?
已经发送到你QQ邮箱