ASP.NET2.0的模版页问题,大家帮帮忙哈~~ 一个注册文件,单独能好好的运行,嵌套进模版页以后,该文件提交的时候就不能够获取表单的值了,提示错误“未将对象引用设置到对象的实例”,去掉模版加上<form>则又好好的,能够正常运行,什么问题导致的啊? 大家帮帮忙哈~~~~~ 有谁碰到过这种问题哈~? 在线等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在模版页中取得控件的ID要通过FindControl 我需要的是在内容页提交后在内容页的.CS文件里获得内容页的表单值。。跟模版页一点关系都没,内容页要是单独存在的时候就能正常运行,如果去掉<form>后 嵌进模版页则不能够获取表单的值了。 TextBox CheckN = (TextBox)PreviousPage.Master.FindControl("Content").FindControl("yanzhengma");我这样用了,也不能获取到值啊~~~~ 下面是masterpage.master<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %><%@ Register Src="UserControl/TopLogin.ascx" TagName="TopLogin" TagPrefix="uc1" %><%@ Register Src="UserControl/top.ascx" TagName="top" TagPrefix="uc2" %><%@ Register Src="UserControl/CopyRight.ascx" TagName="CopyRight" TagPrefix="uc3" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>无标题页</title> <style type="text/css"> body{font-family:宋体;color:0000FF} img{border:0} td,p,div{font-size:12px;align:center} .gg{height:25px;color:#666666;align:center;valign:middle} a{text-decoration: none;line-height: 18px;} a:link{color:#009;} a:visited{color:#800080;} a:hover,a:active,a:focus{color:#c00;} </style></head><body> <form id="form1" runat="server"> <div> <uc1:TopLogin ID="TopLogin1" runat="server" /> <br /> <uc2:top ID="Top1" runat="server" /> <asp:contentplaceholder id="Content" runat="server"> </asp:contentplaceholder> </div> <uc3:CopyRight ID="CopyRight1" runat="server" /> </form></body></html>这里是zhuce.aspx<%@ Page Language="C#" autoeventwireup="true" codefile="zhuce.aspx.cs" Inherits="zhuce" MasterPageFile="~/MasterPage.master" Title = "注册用户"%><asp:Content runat="server" ContentPlaceHolderID="Content" ID = "zhuce"> <div><br/> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tbody> <tr> <td></td><td align="left" height="25"><b>会员注册</b></td> </tr> <tr> <td style="WIDTH: 203px; HEIGHT: 24px" align="right">用户名:</td> <td style="HEIGHT: 24px"> <asp:TextBox ID="UserName" runat="server" Width="80px"></asp:TextBox> <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="用户名不能为空" Display="Dynamic" ControlToValidate="UserName"></asp:RequiredFieldValidator> </td> </tr> <tr> <td style="WIDTH: 203px; HEIGHT: 28px" align="right">密码:</td> <td style="HEIGHT: 28px"> <asp:TextBox ID="PassWord" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ErrorMessage="密码不能为空" Display="Dynamic" ControlToValidate="PassWord"></asp:RequiredFieldValidator> </td> </tr> <tr> <td style="WIDTH: 203px; HEIGHT: 19px" align="right">确认:</td> <td style="HEIGHT: 19px"> <asp:TextBox ID="PWD" runat="server" TextMode="Password"></asp:TextBox> <asp:CompareValidator id="CompareValidator1" runat="server" ErrorMessage="两次输入的密码不一致" ControlToValidate="PWD" ControlToCompare="PassWord"></asp:CompareValidator> </td> </tr> <tr> <td style="WIDTH: 203px; HEIGHT: 19px" align="right">Email:</td> <td style="HEIGHT: 19px"> <asp:TextBox ID="Email" runat="server"></asp:TextBox> <asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" ErrorMessage="Email格式错误" Display="Dynamic" ControlToValidate="Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> </td> </tr> <tr> <td style="WIDTH: 203px; HEIGHT: 24px" align="right">验证码:</td> <td style="HEIGHT: 24px"> <asp:TextBox ID="yanzhengma" runat="server" Width="40px"></asp:TextBox> <asp:Label id="Label1" runat="server"></asp:Label> <asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" ErrorMessage="验证码不能为空" Display="Dynamic" ControlToValidate="yanzhengma"></asp:RequiredFieldValidator> </td> </tr> <tr> <td style="WIDTH: 203px; HEIGHT: 24px"></td> <td style="HEIGHT: 24px"> <asp:Button id="Button1" runat="server" Text=" 注 册 "></asp:Button> </td> </tr> </tbody> </table> <br/> </div></asp:Content>我现在要做的是在 zhuce.aspx.cs 里面获取 zhuce.aspx 里面的值,该怎样做呢? ASP.NET中有没有MVC的概念阿! html问题请教高手 datatable 绑定下拉菜单 这样的Url是什么意思. TreeViewList安装问题 关于电子邮箱的正则表达式 一個javascript的小問題 网站制作的问题!分不够再加 谁知道treeview加载时默认不要展开根节点?? 编辑器 Response.Write & ClientScript.RegisterStartupScript 存储过程接收多个参数问题 高手请进
<%@ Register Src="UserControl/TopLogin.ascx" TagName="TopLogin" TagPrefix="uc1" %>
<%@ Register Src="UserControl/top.ascx" TagName="top" TagPrefix="uc2" %>
<%@ Register Src="UserControl/CopyRight.ascx" TagName="CopyRight" TagPrefix="uc3" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<style type="text/css">
body{font-family:宋体;color:0000FF}
img{border:0}
td,p,div{font-size:12px;align:center}
.gg{height:25px;color:#666666;align:center;valign:middle}
a{text-decoration: none;line-height: 18px;}
a:link{color:#009;}
a:visited{color:#800080;}
a:hover,a:active,a:focus{color:#c00;}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:TopLogin ID="TopLogin1" runat="server" />
<br />
<uc2:top ID="Top1" runat="server" />
<asp:contentplaceholder id="Content" runat="server">
</asp:contentplaceholder>
</div>
<uc3:CopyRight ID="CopyRight1" runat="server" />
</form>
</body>
</html>
这里是zhuce.aspx
<%@ Page Language="C#" autoeventwireup="true" codefile="zhuce.aspx.cs" Inherits="zhuce" MasterPageFile="~/MasterPage.master" Title = "注册用户"%>
<asp:Content runat="server" ContentPlaceHolderID="Content" ID = "zhuce"> <div><br/>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td></td><td align="left" height="25"><b>会员注册</b></td>
</tr>
<tr>
<td style="WIDTH: 203px; HEIGHT: 24px" align="right">用户名:</td>
<td style="HEIGHT: 24px">
<asp:TextBox ID="UserName" runat="server" Width="80px"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="用户名不能为空" Display="Dynamic" ControlToValidate="UserName"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="WIDTH: 203px; HEIGHT: 28px" align="right">密码:</td>
<td style="HEIGHT: 28px">
<asp:TextBox ID="PassWord" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ErrorMessage="密码不能为空" Display="Dynamic" ControlToValidate="PassWord"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="WIDTH: 203px; HEIGHT: 19px" align="right">确认:</td>
<td style="HEIGHT: 19px">
<asp:TextBox ID="PWD" runat="server" TextMode="Password"></asp:TextBox>
<asp:CompareValidator id="CompareValidator1" runat="server" ErrorMessage="两次输入的密码不一致" ControlToValidate="PWD" ControlToCompare="PassWord"></asp:CompareValidator>
</td>
</tr>
<tr>
<td style="WIDTH: 203px; HEIGHT: 19px" align="right">Email:</td>
<td style="HEIGHT: 19px">
<asp:TextBox ID="Email" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" ErrorMessage="Email格式错误" Display="Dynamic" ControlToValidate="Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td style="WIDTH: 203px; HEIGHT: 24px" align="right">验证码:</td>
<td style="HEIGHT: 24px">
<asp:TextBox ID="yanzhengma" runat="server" Width="40px"></asp:TextBox>
<asp:Label id="Label1" runat="server"></asp:Label>
<asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" ErrorMessage="验证码不能为空" Display="Dynamic" ControlToValidate="yanzhengma"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="WIDTH: 203px; HEIGHT: 24px"></td>
<td style="HEIGHT: 24px">
<asp:Button id="Button1" runat="server" Text=" 注 册 "></asp:Button>
</td>
</tr>
</tbody>
</table>
<br/>
</div>
</asp:Content>
我现在要做的是在 zhuce.aspx.cs 里面获取 zhuce.aspx 里面的值,该怎样做呢?