向以前做过asp程序的.net程序员提问
美工给了个asp页面 让我转成.net
有这样 <!--#include file="../inc/header-zone.inc" -->
<!--include file="../inc/toolbar-zone.inc" -->
<%klksdfji="z_english"
klksdfji_href="en/survey.asp"
%>
我看../inc/header-zone.inc这个文件里有这样的code
HTML code
<p id="sitemap-link"><a href="<%=klksdfji_href%>" style="background-image: url(/_resources/img/<%=klksdfji%>.gif); width:80px;"><span class="access">Site Explorer</span></a></p>
我弄到VS里 <a href="<%=klksdfji_href%> 报错了
如何改成.net 的
------解决方案--------------------
include的文件可以用用户控件代替,或者直接把代码写在aspx中也行。
先说下边的那个:
web页面中
<script>
<asp:Literal ID="Ljcode" runat="server"></asp:Literal>
</script>
.cs中
protected void Page_Load(object sender, EventArgs e)
{
string path="";
string str="var path"+path;
Ljcode.Text=str;
}
------解决方案--------------------<p id="sitemap-link"><a href="<%=klksdfji_href%>" style="background-image: url(/_resources/img/<%=klksdfji%>.gif); width:80px;"><span class="access">Site Explorer</span></a></p>
<!--#include file="../inc/header-zone.inc" -->
===============================================
aspx文件
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="test_Default2" %>
<%@ Register src="header-zone.ascx" tagname="header" tagprefix="uc1" %>
<!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>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</head>
<body>
<form id="form1" runat="server">
<uc1:header ID="header1" Klksdfji_href="en/survey.aspx" Klksdfji="z_english" runat="server" />
</form>
</body>
</html>
---------------------------------------------------
其中的用户控件(代替header-zone.inc)
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="header-zone.ascx.cs" Inherits="test_header_zone" %>
<p id="sitemap-link">
<a href="<%=Klksdfji_href%>" style="background-image: url(/_resources/img/<%=Klksdfji%>.gif); width:80px;">
<span class="access">Site Explorer</span></a>
</p>
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class test_header_zone : System.Web.UI.UserControl
{
private string _klksdfji_href;
private string _klksdfji;
public string Klksdfji_href
{
get { return _klksdfji_href; }
set { _klksdfji_href = value; }
}
public string Klksdfji
{
get { return _klksdfji; }
set { _klksdfji = value; }