首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

待!有关于vs2003有关问题及输出

2012-02-01 
在线等待!有关于vs2003问题及输出privatevoidPage_Load(objectsender,System.EventArgse){//在此处放置用

在线等待!有关于vs2003问题及输出


private   void   Page_Load(object   sender,   System.EventArgs   e)
{
//   在此处放置用户代码以初始化页面
if(   !   this.IsPostBack)
{
System.IO.DirectoryInfo   info=new   DirectoryInfo(@ "E:\c#示例 ");
foreach(System.IO.FileInfo   f   in   info.GetFiles( "*.cs "))
{
String   name=f.FullName;
long   size=f.Length;

string   s= "   <font   size=2   color=red> "+ " <input   type= 'button '       id= 'd '   onclick= 'alert( 'hello   world '); '     value= ' "+size.ToString()+ " '   </input> ";
Response.Write(s+ "&nbsp;&nbsp;&nbsp;&nbsp; "+name+ "&nbsp;&nbsp;&nbsp;&nbsp; "+f.CreationTime+ " <font> <br> <div   align= 'left '> <hr   color=blue   size=1   width= '50% '   > </div> ");
}


}
}

这段代码中的Button单击没有效果,我查看了HTML发现这样了一个问题,

  <font   size=2   color=red> <input   type= 'button '       id= 'd '   onclick= 'alert( 'hello   world '); '     value= '1334 '   </input> &nbsp;&nbsp;&nbsp;&nbsp;E:\c#示例\enum.cs&nbsp;&nbsp;&nbsp;&nbsp;2007-4-2   11:31:15 <font> <br> <div   align= 'left '> <hr   color=blue   size=1   width= '50% '   > </div>   <font   size=2   color=red> <input   type= 'button '       id= 'd '   onclick= 'alert( 'hello   world '); '     value= '370 '   </input> &nbsp;&nbsp;&nbsp;&nbsp;E:\c#示例\io.cs&nbsp;&nbsp;&nbsp;&nbsp;2007-4-2   11:50:12 <font> <br> <div   align= 'left '> <hr   color=blue   size=1   width= '50% '   > </div>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.0   Transitional//EN "   >
<HTML>
<HEAD>
<title> WebForm1 </title>
<meta   name= "GENERATOR "   Content= "Microsoft   Visual   Studio   .NET   7.1 ">
<meta   name= "CODE_LANGUAGE "   Content= "C# ">
<meta   name= "vs_defaultClientScript "   content= "JavaScript ">
<meta   name= "vs_targetSchema "   content= "http://schemas.microsoft.com/intellisense/ie5 ">
</HEAD>
<body   MS_POSITIONING= "GridLayout ">
<form   name= "_ctl0 "   method= "post "   action= "WebForm1.aspx "   id= "_ctl0 ">
<input   type= "hidden "   name= "__VIEWSTATE "   value= "dDwtNjU0MzcyMTk1Ozs+Q9Sem0vH0+DOKc3WsZdO/t2PrPE= "   />


</form>
<FONT   face= "宋体 "> </FONT>
</body>
</HTML>
为什么显示是这样的?

[解决办法]
按照你的做法是这样很合理啊, 你不要使用write, 你可以在适当的位置放个server div , 后人再吧html赋给div.
[解决办法]
Response.Write肯定是不对的,楼上说的是可以的,可以加一个DIV
或者在要显示的地方加一个label也可以,直接把内容赋给他label.text = content;


[解决办法]
Response.Write
如果你打出来的脚本在页面上没有输出的话,是没有问题的。
但如果有输出,则会出现你的这种情况。
输出到写到一个控件的text属性里就可以了。
[解决办法]
用asp.net的做法

热点排行
Bad Request.