例如在登陆控件,指定了CreateUserUrl="~/Secure/NewUserReg.aspx"和PasswordRecoveryUrl="~/Secure/PasswordRecovery.aspx"
1
<
asp:Login
ID
="Login1"
runat
="server"
CreateUserText
="新用户注册"
CreateUserUrl
="~/Secure/NewUserReg.aspx"
2 Width ="232px" OnLoggingIn ="Login1_LoggingIn" PasswordRecoveryText ="密码忘记" PasswordRecoveryUrl ="~/Secure/PasswordRecovery.aspx" >
3 </ asp:Login >
2 Width ="232px" OnLoggingIn ="Login1_LoggingIn" PasswordRecoveryText ="密码忘记" PasswordRecoveryUrl ="~/Secure/PasswordRecovery.aspx" >
3 </ asp:Login >
在运行后解析代码如下请注意红色背景处代码,这里对Url没有转换(绿色部分是我将WriteCreateUserPanel修改后的运行结果),:
1
<
div
class
="AspNet-Login"
>
2 < div class ="AspNet-Login-TitlePanel" >
3 < span > 登录 </ span >
4 </ div >
5 < div class ="AspNet-Login-UserPanel" >
6 < label for ="ctl00_ContentPlaceHolderMain_Login1_UserName" > 用户名: </ label >
7 < input type ="text" id ="ctl00_ContentPlaceHolderMain_Login1_UserName" name ="ctl00$ContentPlaceHolderMain$Login1$UserName" value ="" />< span id ="ctl00_ContentPlaceHolderMain_Login1_UserNameRequired" style ="color:Red;visibility:hidden;" > * </ span >
8 </ div >
9 < div class ="AspNet-Login-PasswordPanel" >
10 < label for ="ctl00_ContentPlaceHolderMain_Login1_Password" > 密码: </ label >
11 < input type ="password" id ="ctl00_ContentPlaceHolderMain_Login1_Password" name ="ctl00$ContentPlaceHolderMain$Login1$Password" value ="" />< span id ="ctl00_ContentPlaceHolderMain_Login1_PasswordRequired" style ="color:Red;visibility:hidden;" > * </ span >
12 </ div >
13 < div class ="AspNet-Login-RememberMePanel" >
14 < input type ="checkbox" id ="ctl00_ContentPlaceHolderMain_Login1_RememberMeCheckBox" name ="ctl00$ContentPlaceHolderMain$Login1$RememberMeCheckBox" />
15 < label for ="ctl00_ContentPlaceHolderMain_Login1_RememberMeCheckBox" > 下次记住我。 </ label >
16 </ div >
17 < div class ="AspNet-Login-SubmitPanel" >
18 < input type ="submit" value ="登录" id ="ctl00_ContentPlaceHolderMain_Login1_LoginButton" name ="ctl00$ContentPlaceHolderMain$Login1$LoginButton" onclick ="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolderMain$Login1$LoginButton", "", true, "ctl00$ContentPlaceHolderMain$Login1", "", false, false))" />
19 </ div >
20 < div class ="AspNet-Login-CreateUserPanel" >
21 <a href="/web/Secure/NewUserReg.aspx" title="Create user">新用户注册</a>
22 </ div >
23 < div class ="AspNet-Login-PasswordRecoveryPanel" >
24 <a href="~/Secure/PasswordRecovery.aspx" title="Password recovery">密码忘记</a>
25 </ div >
26 </ div >
LoginAdapter.cs进行修改中的WriteCreateUserPanel部分修改代码如下:
2 < div class ="AspNet-Login-TitlePanel" >
3 < span > 登录 </ span >
4 </ div >
5 < div class ="AspNet-Login-UserPanel" >
6 < label for ="ctl00_ContentPlaceHolderMain_Login1_UserName" > 用户名: </ label >
7 < input type ="text" id ="ctl00_ContentPlaceHolderMain_Login1_UserName" name ="ctl00$ContentPlaceHolderMain$Login1$UserName" value ="" />< span id ="ctl00_ContentPlaceHolderMain_Login1_UserNameRequired" style ="color:Red;visibility:hidden;" > * </ span >
8 </ div >
9 < div class ="AspNet-Login-PasswordPanel" >
10 < label for ="ctl00_ContentPlaceHolderMain_Login1_Password" > 密码: </ label >
11 < input type ="password" id ="ctl00_ContentPlaceHolderMain_Login1_Password" name ="ctl00$ContentPlaceHolderMain$Login1$Password" value ="" />< span id ="ctl00_ContentPlaceHolderMain_Login1_PasswordRequired" style ="color:Red;visibility:hidden;" > * </ span >
12 </ div >
13 < div class ="AspNet-Login-RememberMePanel" >
14 < input type ="checkbox" id ="ctl00_ContentPlaceHolderMain_Login1_RememberMeCheckBox" name ="ctl00$ContentPlaceHolderMain$Login1$RememberMeCheckBox" />
15 < label for ="ctl00_ContentPlaceHolderMain_Login1_RememberMeCheckBox" > 下次记住我。 </ label >
16 </ div >
17 < div class ="AspNet-Login-SubmitPanel" >
18 < input type ="submit" value ="登录" id ="ctl00_ContentPlaceHolderMain_Login1_LoginButton" name ="ctl00$ContentPlaceHolderMain$Login1$LoginButton" onclick ="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolderMain$Login1$LoginButton", "", true, "ctl00$ContentPlaceHolderMain$Login1", "", false, false))" />
19 </ div >
20 < div class ="AspNet-Login-CreateUserPanel" >
21 <a href="/web/Secure/NewUserReg.aspx" title="Create user">新用户注册</a>
22 </ div >
23 < div class ="AspNet-Login-PasswordRecoveryPanel" >
24 <a href="~/Secure/PasswordRecovery.aspx" title="Password recovery">密码忘记</a>
25 </ div >
26 </ div >
1
private
void
WriteCreateUserPanel(HtmlTextWriter writer, Login login)
2![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
3
if ((login.CreateUserUrl.Length > 0) || (login.CreateUserText.Length > 0))
4![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
5
WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-Login-CreateUserPanel");
6
WebControlAdapterExtender.WriteImage(writer, login.CreateUserIconUrl, "Create user");
7
//WebControlAdapterExtender.WriteLink(writer, login.HyperLinkStyle.CssClass, login.CreateUserUrl, "Create user", login.CreateUserText);
8
WebControlAdapterExtender.WriteLink(writer, login.HyperLinkStyle.CssClass,Page.ResolveUrl(login.CreateUserUrl), "Create user", login.CreateUserText);
9
WebControlAdapterExtender.WriteEndDiv(writer);
10
}
11
}
其他控件的修改雷同
![None.gif](/Images/OutliningIndicators/None.gif)
2
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](/Images/dot.gif)
3
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
4
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](/Images/dot.gif)
5
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
6
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
7
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
8
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
9
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
10
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
11
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)