客户端有一复杂javascript数组,
function Circle(xPoint, yPoint, radius)
{
this.x = xPoint;
this.y = yPoint;
this.r = radius;
this.showDetail = CircleDetail;
this["description"] = "description for the circle...";
}
var PendingOperations=new Array();var op1 = new Object();
op1.Operation = 4;
op1.C = new Circle(50, 50, 100);
op1.Des = "aaa";PendingOperations.push(op1);
var op2 = new Object();
op2.Operation = 2;
op2.C = new Circle(6, 56, 1);
op2.Des = "b";PendingOperations.push(op2);var op3 = new Object();
op3.Operation = 77;
op3.C = new Circle(190, 45, 25);
op3.Des = "c";PendingOperations.push(op3);
document.getElementById("operations").value = PendingOperations;如何传递到服务器端(C#)中在进行处理?我在aspx页面放 <input id="operations" type="hidden" runat="server" /> ,然后C#中:protected void Button1_Click(object sender, EventArgs e)
{
string[] opValue = this.operations.Value.Split(',');
Response.Write("<br>value in hidden:<br>" + this.operations.Value);
}只能得到[Object],....字符串,如何得到 Circle 对象、Operation属性、Des属性等等???
function Circle(xPoint, yPoint, radius)
{
this.x = xPoint;
this.y = yPoint;
this.r = radius;
this.showDetail = CircleDetail;
this["description"] = "description for the circle...";
}
var PendingOperations=new Array();var op1 = new Object();
op1.Operation = 4;
op1.C = new Circle(50, 50, 100);
op1.Des = "aaa";PendingOperations.push(op1);
var op2 = new Object();
op2.Operation = 2;
op2.C = new Circle(6, 56, 1);
op2.Des = "b";PendingOperations.push(op2);var op3 = new Object();
op3.Operation = 77;
op3.C = new Circle(190, 45, 25);
op3.Des = "c";PendingOperations.push(op3);
document.getElementById("operations").value = PendingOperations;如何传递到服务器端(C#)中在进行处理?我在aspx页面放 <input id="operations" type="hidden" runat="server" /> ,然后C#中:protected void Button1_Click(object sender, EventArgs e)
{
string[] opValue = this.operations.Value.Split(',');
Response.Write("<br>value in hidden:<br>" + this.operations.Value);
}只能得到[Object],....字符串,如何得到 Circle 对象、Operation属性、Des属性等等???
解决方案 »
- fckeditor中插入图片,如何设置自动给图片加上链接~
- .net如何在后台调用前台页面的JavaScript函数?谢谢!
- 在.net中使用发布的web service时出现"枚举本地计算机上的服务时出错"
- 关于控件属性attribute的使用??
- RadioButtonList当我绑定后,从数据库中提取出绑定的selectvalue ,我想在相应的得到文字提示证明已经选择过......
- .Net的活力依然鼎盛
- treeview的字体颜色设置
- 用ASP作论坛时,注册前与注册后是通过什么来验证的?
- 大家使用水晶报表有没出现过使用次数的限制啊,如果有了怎么办,要是要交钱要交多少啊
- 高手帮忙,为什么我的属性窗口不见了?
- 如何在客户端把xml加载treeview控件上?
- 动态添加自定义控件的问题
js:
var oReq = new ActiveXObject("MSXML2.XMLHTTP");
var str = "xxx=123&yyy=789";
oReq.open("POST","url",false);
oReq.setRequestHeader("Content-Length",str.length);
oReq.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
oReq.send(str);
服务器直接解析就可以了,这个格式还是比较成熟的
var myJsonObject ={{"Operation":"2","Des":"aadbb"},{"Operation":"676","Des":"rtrtrtrtrtr"}};1. 通过什么方式传递到服务器端?
2. 服务器端怎么解析呢?请教akirya.