请教aspnet C#页面如何向javascript传递数据,请教大家!!希望大家帮一下忙
大家好,这个页面是利用javascript画一个简单的图,现在是静态的写了三行数据,数据已经定死了,可以成功画出
testgante.aspx文件代码
但是现在要动态的生成页面,testgante.aspx.cs的pageload()里
有八个字符串,str1 str2.....str8
请教大家在testgante.aspx.cs里如何将这八个字符串的值传递给JS函数
testgante.aspx.cs文件代码
希望大家帮帮忙
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;
///?????接下来应该怎么写????
}
}
希望大家帮帮忙
...全文
相关推荐
ASP.NET 页面刷新的实现方法(包括html,js)
在***中实现页面刷新,可以分为在服务器端代码中实现(主要使用C#语言)以及在客户端实现(主要使用HTML和JavaScript)。下面详细介绍这些实现方法。首先是使用C#实现页面刷新的方法:1.
前端开源库-barteh-aspnet-make
对于那些使用ASP.NET框架并且希望提升前端开发效率的团队和个人,这是一个值得关注和研究的资源。
aspnet用javascript或者是HTML调用CS文件中的方法
void btnCallServerMethod_Click(object sender, EventArgs e){ // 在这里实现你的方法逻辑}```二、使用AJAX和UpdatePanel如果希望在不刷新整个页面的情况下调用服务器方法
pizza-ghost-pizzeria:使用Typescript和Webpack的aspnet核心剃刀页面应用程序(不包含任何其他tsjs前端框架)
提及“没有任何其他ts/js前端框架”意味着此项目可能采用了原生的TypeScript和JavaScript代码,而不是依赖像React、Angular或Vue这样的流行前端框架。
ASPNET+WebService+获取天气
总的来说,"ASPNET+WebService+获取天气"的项目涵盖了ASP.NET Web服务的创建、HTTP请求与响应的处理、JSON数据的解析、C#类的设计以及可能的数据库交互。


