ASP.NET 2.0 创建母版页引来的麻烦

http://tech.ddvip.com   2007年11月24日    社区交流

内容摘要:本文将为大家介绍一下 ASP.NET 2.0 在创建母版页时引来的麻烦,并分析了问题产生的实质,大家在实际操作中多多注意一下。

  本文将为大家介绍一下 ASP.NET 2.0 在创建母版页时引来的麻烦,并分析了问题产生的实质,大家在实际操作中多多注意一下。

  一、问题提出

  由于总体排版和设计的需要,我们往往创建母版页来实现整个网站的统一性,最近我由于统一性的需要,把原来整个项目单独的页面全部套用了母版页。但是出现了一个错误……在我的Blog中记录一下,方便大家参考。

  二、 抽象模型

  由于整个页面内容过多,所以我把这个页面中最为本质的问题抽象出来。

  原来单一页面,就是利用按钮触发JS事件,在文本域中插入“(_)”功能,其实现代码如下:

以下是引用片段:
<%@PageLanguage="C#"AutoEventWireup="true" CodeFile="Default.aspx.cs"Inherits="_Default"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
  <title>单一页面抽象模型-YJingLee</title>
<scriptlanguage="javascript"type="text/javascript">
//<!CDATA[
functioninsert(){
     document.getElementById("txt").value=document.getElementById("txt").value+"(__)";
    return;
}
//]]>
</script>
</head>
<body>
  <formid="form1"runat="server">
  <div>
    <textareaid="txt"runat="server"name="txt"rows="10"cols="50"></textarea>
    <asp:ButtonID="btnInsert"runat="server"Text="服务器端插入(_)" OnClientClick="insert();"/>
    <inputid="btnInsert2"name="insert"onclick="insert();"type="button"value="客户端插入(_)"runat="server"/></div>
  </form>
</body>
</html>

来源:YJingLee'Blog    责编:豆豆技术应用

正在加载评论...