首页 新闻 会员 周边 捐助

请教于 .net 母版页嵌套的问题

0
悬赏园豆:50 [已解决问题] 解决于 2012-12-19 12:02

最近开发一套系统 我使用了母版页的嵌套,父母版页,子母版页,内容 页的内容 都 显示 正常,但是很奇怪 的是在内容页中的表单无法提交 ,点击按钮之后就到了一个空白 页面,再无反应,

 

下页是部分代码 ,请各位大侠帮忙看看,谢谢

 

父母版页:

View Code
  1 <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Common.master.cs" Inherits="Templates_blue_index" %>
  2 
  3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4 
  5 <html xmlns="http://www.w3.org/1999/xhtml" >
  6 <head id="Head1" runat="server">
  7     <title>无标题页</title>
  8     <meta content="" name="keywords" />
  9     <link id="Link1" rel="stylesheet" type="text/css" runat="server" href="~/resourceFolder/css/style.css">
 10     <link id="Link2" rel="stylesheet" type="text/css" runat="server" href="~/resourceFolder/css/site.css">
 11 
 12     <script language="javascript" type="text/javascript" src="<%=ResolveUrl("~/resourceFolder/js/jquery.js") %>"></script>
 13 
 14     <script language="javascript" type="text/javascript">
 15     $(function(){
 16         $(".listA li").bind({
 17             "mouseenter":function(){$(this).addClass("current");},
 18             "mouseleave":function(){$(this).removeClass("current");}    
 19         });    
 20         $(".nav ul").find("ul").css("display","none");
 21         $(".nav>ul li").bind({
 22             "mouseenter":function(){$(this).children("ul").show();},
 23             "mouseleave":function(){$(this).children("ul").hide();}
 24         }).children("ul").css("display","none");
 25         
 26         $(".colList li").each(function(){
 27             $(this).bind({
 28                 "mouseenter":function(){$(this).addClass("licur");},
 29                 "mouseleave":function(){$(this).removeClass("licur");}
 30             });
 31         });
 32         
 33         $(".list01 li").each(function(){
 34             $(this).bind({
 35                 "mouseenter":function(){$(this).addClass("cr");},
 36                 "mouseleave":function(){$(this).removeClass("cr");}
 37             });
 38         });
 39         
 40         setInterval("timespan()",1000);
 41         
 42     });
 43     
 44     function timespan() {
 45         $timespan = $("#timespan");
 46         var d = new Date();
 47         var year = d.getFullYear();
 48         var month = d.getMonth();
 49         var day = d.getDate();
 50         var hour = d.getHours();
 51         var minutes = d.getMinutes();
 52         var seconds = d.getSeconds();
 53         
 54         var strTimespan = "今天是:" + year + "" + month + "" + day + "" + hour + ":" + minutes + ":" + seconds;
 55         $timespan.html(strTimespan);
 56     }
 57     
 58     </script>
 59 
 60     <style type="text/css">
 61     .nav ul li {position:relative; }
 62     .nav ul li ul{position:absolute;top:34px;left:10px; background:#000; z-index:100; }
 63     .nav ul li ul li {width:auto;white-space:nowrap; line-height:20px; height:20px;clear:both; padding:3px;  }
 64     .nav ul li ul li a {font-size:12px; font-weight:normal; }
 65     .nav ul li ul li ul {position:absolute; top:0; left:100%; }
 66     .nav ul li ul li ul li {}
 67 </style>
 68 </head>
 69 <body>
 70     <form id="form1" runat="server">
 71         <div style="height: 30px; background: #fffeee; line-height: 30px; border-bottom: 1px #ddd solid; display:none;">
 72             <div style="width: 1000px; margin: 0 auto; height: 30px;" runat="server" id="login">
 73                 登陆身份:<asp:DropDownList ID="rolelist" runat="server">
 74                     <asp:ListItem Text="学生登陆" Value="student"></asp:ListItem>
 75                     <asp:ListItem Text="教师登陆" Value="teacher"></asp:ListItem>
 76                 </asp:DropDownList>用户名:<asp:TextBox ID="username" runat="server"></asp:TextBox>密码:<asp:TextBox
 77                     ID="passwd" runat="server" TextMode="Password"></asp:TextBox>
 78                 &nbsp;&nbsp;<asp:Button ID="Button1" runat="server" Text="登陆" OnClick="Button1_Click" /><asp:HyperLink
 79                     ID="HyperLink1" runat="server" NavigateUrl="~/register.aspx">注册</asp:HyperLink>
 80                 <asp:Label ID="tips" runat="server"></asp:Label></div>
 81             <div style="width: 1000px; margin: 0 auto; height: 30px;" runat="server" id="welcome">
 82                 您好,<asp:Label ID="Label1" runat="server" Text=""></asp:Label>&nbsp; &nbsp;
 83                 <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/login.aspx?act=out">退出登陆</asp:HyperLink>
 84             </div>
 85         </div>
 86         <div class="Area" style="width:1000px; margin:0 auto;">
 87             <div class="head">
 88                 <asp:Image ID="headimg" runat="server" /></div>
 89         </div>
 90         <div class="Area" style="width:1000px; margin:0 auto;">
 91             <div class="nav" runat="server" id="nav">
 92               <%--  <ul>
 93                     <li class="first"><span>2010-05-12 12:12:45</span></li>
 94                     <li><a href="#">学校主页</a></li>
 95                     <li class="spar"></li>
 96                     <li><a href="#">行业资源</a></li>
 97                     <li class="spar"></li>
 98                     <li><a href="#">专业介绍</a></li>
 99                     <li class="spar"></li>
100                     <li><a href="#">标准资源</a></li>
101                     <li class="spar"></li>
102                     <li><a href="#">教学资源</a></li>
103                     <li class="spar"></li>
104                     <li><a href="#">在线考试</a></li>
105                     <li class="spar"></li>
106                     <li><a href="#">在线帮助</a></li>
107                 </ul>--%>
108             </div>
109             <div class="notice">
110                 <div class="h">
111                     公告:</div>
112                 <div class="cont notice2" style="overflow: hidden;">
113                     <marquee behavior="scroll" direction="left" scrolldelay="3" onmouseover="this.stop();"
114                         onmouseout="this.start();">
115                     <asp:Repeater ID="RpNotice" runat="server">
116                     <ItemTemplate>&middot;<a href="<%#Eval("url") %>"><%#Eval("n2") %></a></ItemTemplate>
117                     </asp:Repeater></marquee>
118                 </div>
119             </div>
120         </div>
121         <div class="blank10">
122         </div>
123         <div class="Area" style="width:1000px; margin:0 auto;">
124             <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
125             </asp:ContentPlaceHolder>
126             <div class="blank10">
127             </div>
128         </div>
129         <div class="Area">
130             <div class="footer" runat="server" id="copyRight">
131             </div>
132         </div>
133     </form>
134 </body>
135 </html>

 

子母版页:

View Code
  1 <%@ Master Language="C#" AutoEventWireup="true" CodeFile="rDetail.master.cs" Inherits="Templates_blue_rDetail"
  2     MasterPageFile ="~/Templates/blue/Common.master" EnableViewState="true" %>
  3 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
  4     <div class="currentPosition" runat="server" id="currentposition">
  5         当前位置:首页 >>
  6     </div>
  7     <div class="blank10">
  8     </div>
  9 
 10     <script type="text/javascript" charset="utf-8" src="Admin/editor/kindeditor-min.js"></script>
 11 
 12     <script type="text/javascript" charset="utf-8" src="Admin/editor/lang/zh_CN.js"></script>
 13 
 14     <script type="text/javascript">
 15             var editor;
 16             KindEditor.ready(function(K) {
 17                 editor = K.create('textarea[ID="ctl00_ctl00_ContentPlaceHolder1_commentBox"]', {
 18                     resizeType : 1,
 19                     allowPreviewEmoticons : false,
 20                     allowImageUpload : false,
 21                     items : [
 22                         'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
 23                         'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
 24                         'insertunorderedlist', '|', 'emoticons', 'image', 'link']
 25                 });
 26             });
 27             
 28             function search(){
 29                 var $keyword = $("#ctl00_ctl00_ContentPlaceHolder1_keywords").val();
 30                 var $type = $("#ctl00_ctl00_ContentPlaceHolder1_searchtype").val();
 31                 window.location.href = "search.aspx?keyword=" + $keyword + "&sType=" + $type;
 32             }
 33             
 34     </script>
 35 
 36     <%--<form id="form11" action="search.aspx" method="post">--%>
 37     关键词:<asp:TextBox ID="keywords" runat="server"></asp:TextBox>
 38     资源类型:<asp:DropDownList ID="searchtype" runat="server">
 39         <asp:ListItem Value="" Text="所有"></asp:ListItem>
 40         <asp:ListItem Value="picture" Text="图片"></asp:ListItem>
 41         <asp:ListItem Value="video" Text="视频"></asp:ListItem>
 42         <asp:ListItem Value="courseware" Text="课件"></asp:ListItem>
 43     </asp:DropDownList>&nbsp;&nbsp;<input type="button" id="btn_search" value="搜索" width="60" height="20" onclick="search();" />
 44     <%--</form>--%>
 45     <div class="blank10">
 46     </div>
 47     <div>
 48         <div class="baseinfo">
 49             <table class="tableList border01" width="100%">
 50                 <tr>
 51                     <td colspan="3">
 52                         当前课程:<asp:Label ID="curCourse" runat="server" Text="课程名" Font-Bold="True"></asp:Label></td>
 53                 </tr>
 54                 <tr>
 55                     <td colspan="3" style="font-size: 12px;">
 56                         资源标题:<asp:Label ID="resTitle2" runat="server" Text="标题" Font-Bold="True"></asp:Label>&nbsp;&nbsp;&nbsp;
 57                         资源类型:<asp:Label ID="resType" runat="server" Text="Label" Font-Bold="True"></asp:Label>
 58                         &nbsp;&nbsp; 浏览次数:<asp:Label ID="resViews" runat="server" ForeColor="#404040" Text="Label"></asp:Label></td>
 59                 </tr>
 60                 <tr>
 61                     <td width="250" style="background: #eee; font-weight: bold;">
 62                         课程简介
 63                     </td>
 64                     <td style="background: #eee; font-weight: bold;">
 65                         课程视频
 66                     </td>
 67                     <td width="250" style="background: #eee; font-weight: bold;">
 68                         课程作业
 69                     </td>
 70                 </tr>
 71                 <tr>
 72                     <td width="250" runat="server" id="courseIntro" valign="top" style="font-size: 12px;">
 73                         a
 74                     </td>
 75                     <td align="center">
 76                         <asp:Label ID="LbRes" runat="server" Text=""></asp:Label>
 77                         <div runat="server" id="nstv">
 78                             <object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
 79                                 id="Object1" style="border-bottom: rgb(192,192,192) 7px; border-left: rgb(192,192,192) 7px;
 80                                 border-right: rgb(192,192,192) 7px; border-top: 1px rgb(192,192,192) 7px; left: 0px;
 81                                 top: 0px; border: 1px #333 solid; background: #333;" type="application/x-oleobject"
 82                                 width="100%" standby="Loading Microsoft Windows Media Player components...">
 83                                 <param name="AudioStream" value="-1" />
 84                                 <param name="AutoSize" value="0" />
 85                                 <param name="AutoStart" value="false" />
 86                                 <param name="AnimationAtStart" value="0" />
 87                                 <param name="AllowScan" value="-1" />
 88                                 <param name="AllowChangeDisplaySize" value="-1" />
 89                                 <param name="AutoRewind" value="0" />
 90                                 <param name="Balance" value="0" />
 91                                 <param name="BaseURL" value="" />
 92                                 <param name="BufferingTime" value="6" />
 93                                 <param name="CaptioningID" value="" />
 94                                 <param name="ClickToPlay" value="-1" />
 95                                 <param name="CursorType" value="0" />
 96                                 <param name="CurrentPosition" value="-1" />
 97                                 <param name="CurrentMarker" value="0" />
 98                                 <param name="DefaultFrame" value="" />
 99                                 <param name="DisplayBackColor" value="0" />
100                                 <param name="DisplayForeColor" value="16777215" />
101                                 <param name="DisplayMode" value="0" />
102                                 <param name="DisplaySize" value="0" />
103                                 <param name="Enabled" value="-1" />
104                                 <param name="EnableContextMenu" value="-1" />
105                                 <param name="EnablePositionControls" value="-1" />
106                                 <param name="EnableFullScreenControls" value="0" />
107                                 <param name="EnableTracker" value="-1" />
108                                 <param name="Filename" value='<%=Session["Path"]%>' />
109                                 <param name="InvokeURLs" value="-1" />
110                                 <param name="Language" value="-1" />
111                                 <param name="Mute" value="0" />
112                                 <param name="PlayCount" value="1" />
113                                 <param name="PreviewMode" value="0" />
114                                 <param name="Rate" value="1" />
115                                 <param name="SAMILang" value="" />
116                                 <param name="SAMIStyle" value="" />
117                                 <param name="SAMIFileName" value="" />
118                                 <param name="SelectionStart" value="-1" />
119                                 <param name="SelectionEnd" value="-1" />
120                                 <param name="SendOpenStateChangeEvents" value="-1" />
121                                 <param name="SendWarningEvents" value="-1" />
122                                 <param name="SendErrorEvents" value="-1" />
123                                 <param name="SendKeyboardEvents" value="0" />
124                                 <param name="SendMouseClickEvents" value="0" />
125                                 <param name="SendMouseMoveEvents" value="0" />
126                                 <param name="SendPlayStateChangeEvents" value="-1" />
127                                 <param name="ShowCaptioning" value="0" />
128                                 <param name="ShowControls" value="-1" />
129                                 <param name="ShowAudioControls" value="-1" />
130                                 <param name="ShowDisplay" value="0" />
131                                 <param name="ShowGotoBar" value="0" />
132                                 <param name="ShowPositionControls" value="-1" />
133                                 <param name="ShowStatusBar" value="1" />
134                                 <param name="ShowTracker" value="-1" />
135                                 <param name="TransparentAtStart" value="-1" />
136                                 <param name="VideoBorderWidth" value="0" />
137                                 <param name="VideoBorderColor" value="0" />
138                                 <param name="VideoBorder3D" value="0" />
139                                 <param name="Volume" value="-60" />
140                                 <param name="WindowlessVideo" value="0" />
141                             </object>
142                         </div>
143                         <div runat="server" id="resContainer">
144                         </div>
145                     </td>
146                     <%--<td valign="top" runat="server" id="resContainer">
147                         b
148                     </td>--%>
149                     <td width="250" valign="top" style="font-size: 12px;">
150                         <asp:Repeater ID="homeworkList" runat="server">
151                             <HeaderTemplate>
152                                 <ul>
153                             </HeaderTemplate>
154                             <ItemTemplate>
155                                 <li>&middot;<a href="Homework.aspx?id=<%#Eval("id") %>">
156                                     <%#Eval("hw_name") %>
157                                 </a></li>
158                             </ItemTemplate>
159                             <FooterTemplate>
160                                 </ul></FooterTemplate>
161                         </asp:Repeater>
162                     </td>
163                 </tr>
164             </table>
165             <div class="clear">
166             </div>
167         </div>
168         <div class="blank10">
169         </div>
170         <div style="width: 213px; display: inline; float: left; border: 1px #4C9DE0 solid;">
171             <div class="colTitle">
172                 <span class="t">相关资源</span></div>
173             <div style="padding: 5px;">
174                 <asp:Repeater ID="Repeater1" runat="server">
175                     <HeaderTemplate>
176                         <ul class="list01">
177                     </HeaderTemplate>
178                     <ItemTemplate>
179                         <li><a style="color: <%#Eval("color") %>" href="?id=<%#Eval("resourceid") %>">
180                             <%#Eval("restitle") %>
181                         </a></li>
182                     </ItemTemplate>
183                     <FooterTemplate>
184                         </ul></FooterTemplate>
185                 </asp:Repeater>
186                 <div class="" style="text-align: center; line-height: 24px;">
187                     <asp:LinkButton ID="pbtn" runat="server" CommandName="pbtn" OnClick="ntbtn_Click">上一页</asp:LinkButton>
188                     <asp:LinkButton ID="ntbtn" runat="server" CommandName="ntbtn" OnClick="ntbtn_Click">下一页</asp:LinkButton>
189                 </div>
190                 <div class="clear">
191                 </div>
192             </div>
193         </div>
194         <div style="width: 775px; display: inline; float: right;">
195             <div class="ptit">
196                 <asp:Label ID="Label1" runat="server" Text="资源信息"></asp:Label></div>
197             <%--
198         <fieldset>
199             <legend style="color: Blue; font-weight: bold;">资源信息</legend>--%>
200             <div class="resContent" runat="server" id="resContent" style="min-height: 200px;
201                 _height: 200px;">
202                 bsfgdsf
203             </div>
204         </div>
205         <%--
206         </fieldset>--%>
207         <div class="blank10">
208         </div>
209         <div style="width: 700px;">
210             <div class="ptit">
211                 <asp:Label ID="Label2" runat="server" Text="学生评论"></asp:Label></div>
212             <%--<div class="colTitle"><span class="t">学生评论</span></div>--%>
213             <asp:Repeater ID="commentList" runat="server" OnItemDataBound="showreply">
214                 <HeaderTemplate>
215                     <dl class="comment">
216                 </HeaderTemplate>
217                 <ItemTemplate>
218                     <dt>#
219                         <%#Eval("floor") %>
220 221                         <%#Eval("commentTime","{0:yyyy-MM-dd HH:mm:ss}") %>
222                     </dt>
223                     <dd>
224                         <%#Eval("comment") %>
225                         <asp:Repeater ID="Repeater2" runat="server">
226                             <HeaderTemplate>
227                             </HeaderTemplate>
228                             <ItemTemplate>
229                                 <div class="reply">
230                                     <div style="padding: 10px;">
231                                         <div style="color: Blue;">
232                                             <%#Eval("commentTime","{0:yyyy-MM-dd hh:mm:ss}") %>
233                                         </div>
234                                         <%#Eval("comment") %>
235                                     </div>
236                                 </div>
237                             </ItemTemplate>
238                             <FooterTemplate>
239                             </FooterTemplate>
240                         </asp:Repeater>
241                     </dd>
242                 </ItemTemplate>
243                 <FooterTemplate>
244                     </dl></FooterTemplate>
245             </asp:Repeater>
246             <%--
247             <dl class="comment">
248                 <dt>#1楼 基本信息</dt>
249                 <dd>
250                     评论内容</dd>
251             </dl>--%>
252             <div style="padding: 8px 0;">
253                 共有<asp:Label ID="total" runat="server" Text=""></asp:Label>条评论 共<asp:Label ID="pagecount"
254                     runat="server" Text=""></asp:Label>页 当前第<asp:Label ID="curpage" runat="server" Text="1"></asp:Label>255                 <asp:LinkButton ID="firstbtn" runat="server" CommandName="firstbtn" OnClick="Btn_Click">首页</asp:LinkButton>
256                 <asp:LinkButton ID="prebtn" runat="server" CommandName="prebtn" OnClick="Btn_Click">上一页</asp:LinkButton>
257                 <asp:LinkButton ID="nextbtn" runat="server" CommandName="nextbtn" OnClick="Btn_Click">下一页</asp:LinkButton>
258                 <asp:LinkButton ID="lastbtn" runat="server" CommandName="lastbtn" OnClick="Btn_Click">尾页</asp:LinkButton></div>
259             <%--<div class="colTitle"><span class="t">发表评论</span></div>--%>
260             <div class="ptit">
261                 <asp:Label ID="Label3" runat="server" Text="学生评论"></asp:Label></div>
262             <table width="100%">
263                 <%-- <tr>
264                     <td>
265                         用户名:<asp:TextBox ID="username" runat="server"></asp:TextBox>密码:<asp:TextBox ID="password"
266                             runat="server"></asp:TextBox><asp:Button ID="loginbtn" runat="server" Text="登陆" />&nbsp;&nbsp;<asp:HyperLink
267                                 ID="HyperLink1" NavigateUrl="~/sjt/register.aspx" runat="server">注册</asp:HyperLink></td>
268                 </tr>--%>
269                 <tr>
270                     <td>
271                         <asp:TextBox ID="commentBox" runat="server" Height="80px" TextMode="MultiLine" Width="100%"></asp:TextBox></td>
272                 </tr>
273                 <tr>
274                     <td>
275                         <asp:Button ID="Button1" runat="server" Text="发表" Height="30px" Width="80px" OnClick="Button1_Click1" /></td>
276                 </tr>
277             </table>
278         </div>
279     </div>
280 </asp:Content>

控制代码 :

View Code
 1     protected void Button1_Click1(object sender, EventArgs e)
 2     {
 3         if (commentBox.Text == "")
 4         {
 5             Response.Write("<script>alert('请填写评论内容'); history.back();</script>");
 6             Response.End();
 7         }
 8         CommentService cs = new CommentService();
 9         Comment comment = new Comment();
10 
11         comment.commentTime = DateTime.Now;
12         if (Session["username"] == null || Session["username"] == "")
13         {
14             comment.nickname = "游客";
15             comment.stuId = "";
16         }
17         else
18         {
19             comment.nickname = Session["username"].ToString();
20             comment.stuId = Session["username"].ToString();
21         }
22         comment.resourceId = Convert.ToInt32(Request.Params["id"].ToString());
23         comment.title = cs.getResourceTitle(comment.resourceId);
24         comment.comLevel = 1;
25         comment.comment = commentBox.Text.Replace("'", "\''");
26         if (cs.save(comment))
27         {
28             Response.Write("<script>alert('评论成功!');location.href='?id=" + Request.Params["id"].ToString() + "';</script>");
29         }
30     }
31     protected void showreply(object sender, RepeaterItemEventArgs e)
32     {
33         try
34         {
35             Repeater r = (Repeater)e.Item.FindControl("Repeater2");
36             DataRowView drv = (DataRowView)e.Item.DataItem;
37 
38             string sql = "select * from rp_comment where comparent=" + drv["commentid"].ToString();
39             DataTable deDept = DAL.DataAccess.nGetDataSet(sql, new SqlParameter[] { }).Tables[0];
40 
41             r.DataSource = deDept.DefaultView;
42             r.DataBind();
43         }
44         catch { }
45     }

 

内容页:

分两个部份

1.

View Code
1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="rDetail.aspx.cs" Inherits="rDetail" %>
2 <%-- 在此处添加内容控件 --%>

2.

View Code
 1 public partial class rDetail : System.Web.UI.Page
 2 {
 3     ConfigManager cm = new ConfigManager();
 4     protected void Page_PreInit(object sender, EventArgs e)
 5     {
 6         if (!IsPostBack)
 7         {
 8             this.MasterPageFile = "~/Templates/" + cm.GetValueOfPara("template") + "/rDetail.master" ;
 9         }
10     }
11 }

程序执行之后内容显示正常,但点击

子母版页的<asp:Button ID="Button1" runat="server" Text="发表" Height="30px" Width="80px" OnClick="Button1_Click1" />时就到了一个空白 页面,,,

 

请各位大侠帮忙 看看,

liyg02的主页 liyg02 | 初学一级 | 园豆:169
提问于:2012-12-17 21:23
< >
分享
最佳答案
0
Response.Write("<script>alert('评论成功!');location.href='?id=" + Request.Params["id"].ToString() + "';</script>");这句话是啥意思,路径是哪。。。。??
收获园豆:50
羽商宫 | 老鸟四级 |园豆:2490 | 2012-12-18 08:39

这个是跳转到本页,不用嵌套模板的时候  这个是可行的,现在嵌套之后写上完整路径 也不起作用

liyg02 | 园豆:169 (初学一级) | 2012-12-19 09:02

@kf_1634: 

我做的为啥没问题。。。

子母版
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="wlzUI.SiteMaster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form runat="server">
    <div class="page">
        <div class="header">
            <div class="title">
                <h1>
                    我的 ASP.NET 应用程序
                </h1>
            </div>
            <div class="loginDisplay">
                <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                    <AnonymousTemplate>
                        [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">登录</a> ]
                    </AnonymousTemplate>
                    <LoggedInTemplate>
                        欢迎使用 <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
                        [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="注销" LogoutPageUrl="~/"/> ]
                    </LoggedInTemplate>
                </asp:LoginView>
            </div>
            <div class="clear hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="主页"/>
                        <asp:MenuItem NavigateUrl="~/About.aspx" Text="关于"/>
                    </Items>
                </asp:Menu>
            </div>
        </div>
        <div class="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
        </div>
        <div class="clear">
        </div>
    </div>
    <div class="footer">
        
    </div>
    </form>
</body>
</html>
代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace wlzUI
{
    public partial class NestedMasterPage1 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Write("<script>alert('非指定类型,不允许上传!');location.href='default.aspx'; </script>");

        }
    }
}

父母般用的是vs自带的site.master,没问题啊。。。

羽商宫 | 园豆:2490 (老鸟四级) | 2012-12-19 11:00

@王凌志: 

解决了,

IsPostBack 惹的祸!

liyg02 | 园豆:169 (初学一级) | 2012-12-19 12:01
其他回答(2)
0

master 文件使用多了速度慢,适当使用

jason2013 | 园豆:1998 (小虾三级) | 2012-12-18 09:23
0

location.href='?id=" + Request.Params["id"].ToString() + "'你这跳转的url都没写当然没反应

茂茂 | 园豆:2902 (老鸟四级) | 2012-12-18 17:01

我测试过了,这个写了也没用,只要是 写在这个事件方法体内的语名一句也不执行

支持(0) 反对(0) liyg02 | 园豆:169 (初学一级) | 2012-12-19 09:00
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册