你这代码应该是在ASPX中吧?一个ASPX是一个类,你有见过在类中直接写这样代码的吗?所有的语句必须在方法中书写。
解决方案 »
- 大家对数据授权都是怎么实现的啊?
- 求助,这个EventHandler<cCheckStartedEventArgs>泛型,委托咋用的?
- 水晶报表的合并问题
- 基于fetionsdk的二次开发界面一直无法登陆
- 我可能远程获得别人主板的序列号吗?
- 怎样防止winform的datagrid中的某些行被删除
- setInterval问题,在线等......
- C#如何调用打印机
- 哪们大侠用过mutex类,或有没有人过mutex类同步进程?
- 100分求Borland Together Edition for MS VS.NET 1.0的序列号和注册码
- c#导入excel数据时的怪问题:有一列只能导入数字,汉字和字母都认为是null!!
- c#连接数据库求助
<%
DataTable dt=(DataTable)((ClassLibaray.ShopCar)Session["ShopCar"]).GetShopInfo();
for(int i=0;i<dt.Rows.Count-1;i++)
{
string strId="Login.aspx?id="+dt.Rows[i][6].ToString();
string strName=dt.Rows[i][0].ToString();
string strMyPrice=dt.Rows[i][3].ToString();
%>
<tr>
<td style="WIDTH: 109px" align="right"><b>商品名称:</b></td>
<td><a href='<%=strId%>'><%=strName%></a></td>
<tr>
<tr>
<td style="WIDTH: 109px" align="right"><b>我的价格:</b></td>
<td><%=strMyPrice%></td>
<tr>
<%
}
%>
in-line:
<FileList.aspx>
<%@ Page language="c#" Codebehind="FileList.aspx.cs" AutoEventWireup="false" Inherits="UpFile.FileList" %>
<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>FileList</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body ms_positioning="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:datagrid id="dg" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 24px" runat="server"
height="56px" width="608px" autogeneratecolumns="False">
<selecteditemstyle font-size="Larger" horizontalalign="Center"></selecteditemstyle>
<edititemstyle font-size="Smaller" horizontalalign="Center"></edititemstyle>
<alternatingitemstyle font-size="Smaller" horizontalalign="Center"></alternatingitemstyle>
<itemstyle font-size="Smaller" horizontalalign="Center"></itemstyle>
<headerstyle font-size="Smaller" horizontalalign="Center"></headerstyle>
<columns>
<asp:hyperlinkcolumn datanavigateurlfield="name" datanavigateurlformatstring="FileShow.aspx?file={0}"
datatextfield="name" headertext="名称"></asp:hyperlinkcolumn>
<asp:boundcolumn datafield="type" headertext="文件类型"></asp:boundcolumn>
<asp:boundcolumn datafield="createtime" headertext="创建时间"></asp:boundcolumn>
<asp:boundcolumn datafield="space" headertext="文件大小"></asp:boundcolumn>
</columns>
</asp:datagrid>
</form>
</body>
</html>
FileList.aspx.cssing System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;using System.IO;
using Microsoft.Web.UI.WebControls;namespace UpFile
{
/// <summary>
/// FileList 的摘要说明。
/// </summary>
public class FileList : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid dg;
private void Page_Load(object sender, System.EventArgs e)
{
TreeOP top=new TreeOP();
FileOP fop=new FileOP();
DataView dvFile; if (!Page.IsPostBack)
{
dvFile=(top.GetFile(fop.Path)).DefaultView;
dg.DataSource=dvFile;
dg.DataBind();
}
else
{
dvFile=(top.GetFile(Session["CurrPath"].ToString())).DefaultView;
dg.DataSource=dvFile;
dg.DataBind();
}
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load); }
#endregion }
}