问题描述
这是前台的代码:<body><formid="form2"runat="server"><divid="header"><divclass="logo"style="font-size:xx-large;font-family:GungsuhChe;height:85px;width:370px;"> Christina's<br/><br/> <br/> FavouriteBlog</div><divclass="site-nav"> <spanclass="style3"> </span><ahref="Home.aspx"><spanclass="style1"><spanclass="style3">主页</span></span></a> <ahref="About.aspx"class="style1"><spanclass="style3">日志</span></a><br/></div></div><divid="content"><divclass="bot"><divclass="inner"><divclass="inner_copy"><divclass="inner_copy"></div></div><h2> WelcometomyBlog!</h2><fieldset><divstyle="margin:30px0040px"><asp:LabelID="Label1"runat="server"Text="名字:"style="font-size:large"></asp:Label> <asp:LoginViewID="LoginView0"runat="server"><AnonymousTemplate><asp:TextBoxID="cname"runat="server"Text="游客"Width="417px"></asp:TextBox></AnonymousTemplate><RoleGroups><asp:RoleGroupRoles="admin"><ContentTemplate><asp:LabelID="cname1"runat="server"Text="admin"style="font-size:large"></asp:Label></ContentTemplate></asp:RoleGroup></RoleGroups></asp:LoginView><asp:LabelID="Label6"runat="server"Text="*用户名不能为空"ForeColor="Red"></asp:Label></div><divstyle="margin:30px0040px"><asp:LabelID="Label4"runat="server"Text="评论:"style="font-size:large"></asp:Label></div><divstyle="margin:-15px00110px"><asp:TextBoxID="ccon"runat="server"Height="282px"Width="436px"></asp:TextBox><asp:LabelID="Label2"runat="server"Text="Label"ForeColor="Red">*内容不能为空</asp:Label></div><divstyle="margin:20px00220px"><asp:ButtonID="Button1"runat="server"Text="提交"onclick="Button1_Click0"Height="40px"Width="72px"/> <asp:ButtonID="Button2"runat="server"Text="返回"PostBackUrl="~/About.aspx"Height="39px"Width="78px"/></div></fieldset></div></form></body>后台:publicpartialclassWtitecom:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){}protectedvoidButton1_Click0(objectsender,EventArgse){stringname,name1;stringcontext=Request.Form["ccon"];stringid=Request["no"];Createcreate=null;if(LoginView0.FindControl("cname")!=null){TextBoxtb=(TextBox)LoginView0.FindControl("cname");name=tb.Text;create=newCreate(name,context,id);}else{Labellb=(Label)LoginView0.FindControl("cname1");name1=lb.Text;create=newCreate(name1,context,id);}Response.Redirect("~/About.aspx");}}但是在后台那里一直显示当前上下文不存在loginview0,这是为什么呢?
解决方案
解决方案二:
该回复于2011-12-14 09:07:54被版主删除
解决方案三:
重建个试试