get row data value& datatable filter & new datatable from datatable
来源:互联网 发布:盛科网络上市没 编辑:程序博客网 时间:2024/06/08 13:38
1. RowDataBound
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{if (e.Row.RowType == DataControlRowType.DataRow)
{
DefaultValue = ((GridView)sender).DataKeys[e.Row.RowIndex].Value.ToString();
}}
2. Checkbox CheckedChanged Event
protected void ckbBillable_CheckedChanged(object sender, EventArgs e)
{
GridViewRow row = ((GridViewRow)((CheckBox)sender).NamingContainer);
CheckBox ckbBillable = (CheckBox)row.FindControl("ckbBillable");
Guid accountId = new Guid(gvAccountBillable.DataKeys[row.RowIndex]["account_id"].ToString());
// Filter in datatable
DataRow[] rows = dtAccountBillable.Select("account_id='" + accountId + "'");
//Update in View state Data table
if (rows.Length > 0)
{
rows[0]["is_billable"] = ckbBillable.Checked;
}
//if checkbox is checd, change the row color
if (ckbBillable.Checked)
{
row.CssClass = "SelectRowStyle";
}
else
{
row.CssClass = "";
}
}
3. in the button click event
protected void btnSubmit_Click(object sender, EventArgs e)
{
Guid rootAccountID = new Guid(gvAccount.DataKeys[0]["root_account_id"].ToString());
DataView dvAccountBilllingInfo = dtAccountBillable.DefaultView;
// new table just has id and is_billable columns. These two field values are from datatable dtAccountBillable.
DataTable dtAccountBillingUpdate = dvAccountBilllingInfo.ToTable(true, " id", "is_billable");
}
- get row data value& datatable filter & new datatable from datatable
- import export data from DataTable
- DataTable
- DataTable
- DataTable
- DataTable
- datatable
- DataTable
- DataTable
- DataTable
- DataTable
- datatable???
- DataTable
- dataTable
- DataTable
- datatable
- dataTable
- datatable
- 黑马程序员——JAVA面向对象(一)
- GIT和SVN之间的五个基本区别
- 如何在JNI编程中使用logCat
- 懒汉模式与饿汉模式
- 删除.svn文件(windows和linux)
- get row data value& datatable filter & new datatable from datatable
- 不同语言写出来的pe文件不相同
- POJ-1860(Bellman()重要应用)
- 动态规划 - 最长公共子序列
- 【解题报告】 POJ 1611 The Suspects 并查集基础 (一点自己的感悟)
- 多分方法的再讨论
- POJ 2528 – Mayor's posters
- getDefinitionByName巧妙应用
- JSONHelper