大家好,这个页面是利用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;
///?????接下来应该怎么写????
}
}希望大家帮帮忙
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;
///?????接下来应该怎么写????
}
}希望大家帮帮忙
解决方案 »
- vs2005中开发ASP.net网站,怎样进行页面布局
- asp调试显示问题
- 一个关于数据导出的问题 希望哪位大侠能帮帮我谢谢了
- 论坛里,怎么原封不动记录用户的回复(字体、超级链接等),入库,再取出来照原样显示?
- Datatable批量更新数据库对应表DataAdapter 方法如何实现
- 新手问题一个
- 一个项目只能有一个名称空间吗?
- 有这个控件吗?
- DropDownlist传递参数后产生的分页问题
- 执行完SqlDbCommand.ExecuteReader()后,如何得到SqlDbDataReader中的每字段的数据?
- IIS6.0访问站点需要输入用户名与密码
- VS 2008 中 Page_Load事件不执行
{
// 在这里个变量赋值
} <script language=javascript>
function fun()
{
var str1=<%=str1%>;
alter(str1);
.....
}
</script>
然后写个共有的方法。
[AjaxPro.AjaxMethod]public List<string> GetStringList()
{
List<string> strList=new List<string>();
strList.Add(str1); strList.Add(str2);
strList.Add(str3); strList.Add(str4);
strList.Add(str5); strList.Add(str6);
strList.Add(str7); strList.Add(str8);
return strList;
}
然后在JS里面 获取这个集合 var strList=testgante.GetStringList().value;
然后你就可以把这集合里面的8个值,按索引取出来。
小弟菜鸟,你看是不是要这样,即使不是的话,给点分,都没分发问了。
因为这八个数据是从数据库里读出来的,输入到JS那边去,JS里面是按照recordset读取的
那我页面这边从的数据形式是Dataset,输出到JS的recordset 应该怎么写呢??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']];