各位大侠,用javascript怎么访问gridview绑定列里面的内容 我用.getElementById进行访问,提示不可以,难道必须是模版列才能访问吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是想通过javascript在客户端,读取gridview数据绑定列里的数据进行运算,数据绑定列不是在模板列里的 服务端写protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType = DataControlRowType.DataRow) { decimal decCol1=string.IsNullOrEmpty(e.Row.Cells[1].Text)?0.00M:Convert.ToDecimal(e.Row.Cells[1].Text); decimal decCol2=string.IsNullOrEmpty(e.Row.Cells[2].Text)?0.00M:Convert.ToDecimal(e.Row.Cells[2].Text); decimal amt=decCol1-decCol2; e.Row.Cells[0].Text = amt.ToString("N2"); } }客户端可以var txt =document.getElementById("grid1").rows[r].cells[0].innerText; e.Row.RowType = DataControlRowType.DataRow==>e.Row.RowType == DataControlRowType.DataRow 在服务器端写个方法 获取GridView中的值 然后再客户端调用服务器端的方法就是了 采集URL的正则表达式问题 判断是否登录 UpdatePanel的有关问题,急!!! 用ASP.NET往mysql中插入BLOB字段为什么总是"SYSTEM.BYTE[]"呢 .net操作GIS 表单验证问题,在线急! SqlDataReader问题 ASP.NET连接SQL2000的问题。 请问各位大虾,哪有中英文对照的书籍或是文章呀! 如此奇怪的问题:标准表达式中数据类型不匹配。 jquery 代码执行先后顺序问题. 用C#实现在线数据的加密传输
服务端写
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType = DataControlRowType.DataRow)
{
decimal decCol1=string.IsNullOrEmpty(e.Row.Cells[1].Text)?0.00M:Convert.ToDecimal(e.Row.Cells[1].Text);
decimal decCol2=string.IsNullOrEmpty(e.Row.Cells[2].Text)?0.00M:Convert.ToDecimal(e.Row.Cells[2].Text);
decimal amt=decCol1-decCol2;
e.Row.Cells[0].Text = amt.ToString("N2");
}
}客户端可以var txt =document.getElementById("grid1").rows[r].cells[0].innerText;