ASPxGridView 单元格、数据行动态操作
2012-11-20 16:49
344 查看
对于单元格的操作,只需在事件HtmlDataCellPrepared添加事件 。
.cs
/// <summary>
/// 单元格单击处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void InputByBatchIndexList_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
{
string rows = e.VisibleIndex.ToString();
string cols = e.DataColumn.Index.ToString();
string rowAndCols = rows + "," + cols;
e.Cell.Attributes.Add("onmousedown", "PieceNumberClicked('" + rowAndCols + "');this.style.backgroundColor='#FFE7A2';");
e.Cell.Attributes.Add("ondblclick", "this.style.backgroundColor='#FFFFFF';");
}
.aspx
<script type="text/javascript" src="../js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
function PieceNumberClicked(value)
{
values=value;
var nowTime=(new Date()).getTime();
var strs= new Array(); //定义一数组
strs=values.split(","); //字符分割
var row=strs[0];
var col=strs[1];
if(col>6)
{
$.getJSON("data/AjaxGetMethod.aspx", { "param": values,"timestamp":nowTime}, function(data, textStatus)
{
$("#F_JDCLJG").html(data[0].F_JDCLJG);
$("#F_PDJGFH").html(data[0].F_PDJGFH);
$("#F_PDYJ").html(data[0].F_PDYJ);
$("#F_ValueAVG").html(data[0].F_ValueAVG);
$("#F_AVGValPDJGFH").html(data[0].F_AVGValPDJGFH);
$("#F_ValueDIF").html(data[0].F_ValueDIF);
$("#F_DeviateType").html(data[0].F_DeviateType);
$("#F_DifJudgeBound").html(data[0].F_DifJudgeBound);
});
}
else
{
$("#F_JDCLJG").html("");
$("#F_PDJGFH").html("");
$("#F_PDYJ").html("");
$("#F_ValueAVG").html("");
$("#F_AVGValPDJGFH").html("");
$("#F_ValueDIF").html("");
$("#F_DeviateType").html("");
$("#F_DifJudgeBound").html("");
}
}
</script>
对于行数据的操作,后续待添加
.cs
/// <summary>
/// 单元格单击处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void InputByBatchIndexList_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
{
string rows = e.VisibleIndex.ToString();
string cols = e.DataColumn.Index.ToString();
string rowAndCols = rows + "," + cols;
if (e.DataColumn.Caption=="Name") { if (e.GetValue("Name")!=null) e.Cell.ToolTip = Convert.ToString(e.GetValue("Name")); //对Name列的单元格,增加tooltip的显示 }
e.Cell.Attributes.Add("onmousedown", "PieceNumberClicked('" + rowAndCols + "');this.style.backgroundColor='#FFE7A2';");
e.Cell.Attributes.Add("ondblclick", "this.style.backgroundColor='#FFFFFF';");
}
.aspx
<script type="text/javascript" src="../js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
function PieceNumberClicked(value)
{
values=value;
var nowTime=(new Date()).getTime();
var strs= new Array(); //定义一数组
strs=values.split(","); //字符分割
var row=strs[0];
var col=strs[1];
if(col>6)
{
$.getJSON("data/AjaxGetMethod.aspx", { "param": values,"timestamp":nowTime}, function(data, textStatus)
{
$("#F_JDCLJG").html(data[0].F_JDCLJG);
$("#F_PDJGFH").html(data[0].F_PDJGFH);
$("#F_PDYJ").html(data[0].F_PDYJ);
$("#F_ValueAVG").html(data[0].F_ValueAVG);
$("#F_AVGValPDJGFH").html(data[0].F_AVGValPDJGFH);
$("#F_ValueDIF").html(data[0].F_ValueDIF);
$("#F_DeviateType").html(data[0].F_DeviateType);
$("#F_DifJudgeBound").html(data[0].F_DifJudgeBound);
});
}
else
{
$("#F_JDCLJG").html("");
$("#F_PDJGFH").html("");
$("#F_PDYJ").html("");
$("#F_ValueAVG").html("");
$("#F_AVGValPDJGFH").html("");
$("#F_ValueDIF").html("");
$("#F_DeviateType").html("");
$("#F_DifJudgeBound").html("");
}
}
</script>
对于行数据的操作,后续待添加
相关文章推荐
- gridview 动态数据操作
- AspxGridView控件定时动态显示数据
- 在ASP.NET 2.0中操作数据之六十四:GridView批量添加数据
- GridView 动态添加模板列并绑定数据 实现从外部直接传入控件 和 绑定字段参数
- 如何使用动态创建模板列并绑定数据(GridView,Repeater,DataGrid)
- ASP.NET2.0中Gridview中数据操作技巧
- GridView动态添加模板列(数据绑定)
- ASPxGridview必须设置ShowVerticalScrollBar为true才能动态改变高度。。。
- 一个使用GridView显示数据,并且可以进行添加、修改、删除操作的例子
- flex datagird 动态刷新单元格数据
- ASP.NET2.0中用Gridview控件操作数据的代码
- GridView中给DropDownList动态绑定数据,及选择列表值后自动更新数据库
- 如何在ASPXGridView绑定数据不满一页时自动添加空行
- 动态创建模板列并绑定数据(GridView,Repeater,DataGrid)
- DevExpress ASPXGridView 主从表 master detail 动态绑定数据
- ADO.NET 2.0 大批量数据操作和多个动态的结果集
- ASP.NET2.0中用Gridview控件操作数据
- AspxGridView客户端多列汇总勾选的数据
- (DevExpress2011控件教程)ASPxGridView 范例4 :ASPxGridView 行选择、多表头设计、数据导出、主表细表等功能实现
- 对Table的操作(赋值、动态新增行、删除行、保存table中多行数据对象