Hi.............
I am create a table frontend and I want to used the Row State properties in a operation of table.
please clarify all Row State propertie ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Nov 28, 2011, 1:44 PM
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
using System;
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 _Default : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.TableName = "Books";
DataColumn dc2 = new DataColumn();
dc2.ColumnName = "BookName";
dc2.DataType = typeof(string);
DataColumn dc3 = new DataColumn();
dc3.ColumnName = "Author";
dc3.DataType = typeof(string);
dt.Columns.AddRange(new DataColumn[] { dc2, dc3 });
dt.Rows.Add(new object[] { "Drupal Intranets with Open Atrium", "Tracy Smith" });
dt.Rows.Add(new object[] { "Drupal 7 First Look", "Mark Noble" });
dt.AcceptChanges();
GridView1.DataSource = dt;
GridView1.DataBind();
DataRow dr = dt.NewRow();
Label1.Text = "Now we make a new row....";
Label1.Text += "
RowState: " + dr.RowState.ToString();
dt.Rows.Add(dr);
Label2.Text = "Now we add new row to table....";
Label2.Text += "
RowState: " + dr.RowState.ToString();
dt.AcceptChanges();
GridView2.DataSource = dt;
GridView2.DataBind();
dr["BookName"] = "Drupal 6 Search Engine Optimization";
dr["Author"] = "Ben Finklea";
Label3.Text += "Now we edit the row ....";
Label3.Text += "
RowState: " + dr.RowState.ToString();
GridView3.DataSource = dt;
GridView3.DataBind();
}
}
Thanks
If this post helps you mark it as answer
VulpesPosted Nov 28, 2011, 12:51 PM
http://msdn.microsoft.com/en-us/library/system.data.datarowstate.aspx