请教aspnet C#页面如何向javascript传递数据,请教大家!!希望大家帮一下忙

snowouldance snowouldance 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
大家好,这个页面是利用javascript画一个简单的图,现在是静态的写了三行数据,数据已经定死了,可以成功画出
testgante.aspx文件代码

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testgante.aspx.cs" Inherits="testgante" %>

<!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>
<style>
th{color:#FFF;background-color:#F89807;}
td{color:#000;background-color:#FDEDCC;height:16}
input,textarea,th,td{font-size:9pt}
</style>
<script language=javascript src="gante.js"></script>
</head>
<body onload="show.innerHTML=gt.getShow() + gt.getDataShow()">
<script language=javascript>
var gt=new gante2();
gt.Data=[['TV','TCL','A1','pt','W1031','W1038', 30, 'this is A1prototype'],['TV','TCL','A2','pt','W1032','W1038', 30, 'this is A2prototype'], ['TV','TCL','A1','fo','W1039','W1046', 30, 'this is A1first-off']];
gt.setDate();
</script>
<form id="form1" runat="server">
<div id=show>

</div>

</form>
</body>
</html>


但是现在要动态的生成页面,testgante.aspx.cs的pageload()里
有八个字符串,str1 str2.....str8
请教大家在testgante.aspx.cs里如何将这八个字符串的值传递给JS函数
testgante.aspx.cs文件代码

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class testgante : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string str1, str2, str3, str4, str5, str6, str7, str8;
///?????接下来应该怎么写????
}
}

希望大家帮帮忙
...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
snowouldance
.NET社区 62,271 成员 668,968 内容