CSS Friendly ASP.NET 2.0 Control Adapters (Beta 2.0)在处理URL时的一个Bug

利用CSS Friendly ASP.NET 2.0 Control Adapters (Beta 2.0)开发时

例如在登陆控件,指定了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 >  

在运行后解析代码如下请注意红色背景处代码,这里对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(&quot;ctl00$ContentPlaceHolderMain$Login1$LoginButton&quot;, &quot;&quot;, true, &quot;ctl00$ContentPlaceHolderMain$Login1&quot;, &quot;&quot;, false, false))"   />
19       </ div >
20       < div  class ="AspNet-Login-CreateUserPanel" >
21           <href="/web/Secure/NewUserReg.aspx" title="Create user">新用户注册</a>
22       </ div >
23       < div  class ="AspNet-Login-PasswordRecoveryPanel" >
24           <href="~/Secure/PasswordRecovery.aspx" title="Password recovery">密码忘记</a>
25       </ div >
26  </ div >  
LoginAdapter.cs进行修改中的WriteCreateUserPanel部分修改代码如下:
 1   private   void  WriteCreateUserPanel(HtmlTextWriter writer, Login login)
 2          {
 3            if ((login.CreateUserUrl.Length > 0|| (login.CreateUserText.Length > 0))
 4            {
 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        }
其他控件的修改雷同

你可能感兴趣的:(asp.net)