Search:
Namespaces
Discussions
.NET v1.1
Feedback
Add a row to a datagrid
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngdatagridrepeaterdatalist' list
.
Dean Santillan
Hi,
I have this code it inserts a new row into my datagrid visually
thats working but when i go to update it nothing is happening!!
if(EvolusysKokugo.CurrentKokugo() == "En")
{
DataSet ds = ((DataSet)Session["NewData"]);
DataTable dt = ds.Tables["ControlData"];
DataRow dr = dt.NewRow();
dt.Rows.Add(dr);
Session["NewData"] = ds;
}
else
{
DataSet ds1 = ((DataSet)Session["NewDataLang"]);
DataTable dt1 = ds1.Tables["ControlLanguageData"];
DataRow dr1 = dt1.NewRow();
dt1.Rows.Add(dr1);
Session["NewDataLang"] = ds1;
}
int nNewItemIndex = EvolusysGrid.Items.Count;
if(nNewItemIndex >= EvolusysGrid.PageSize)
{
EvolusysGrid.CurrentPageIndex++;
nNewItemIndex = 0;
}
EvolusysGrid.EditItemIndex = nNewItemIndex;
this.BindData();
Is there something wrong with this???
Thanks Dean
Reply to this message...
Yannick Smits
I think that with the this line:
DataTable
dt = ds.Tables["ControlData"];
you only make a copy of the table that is inside your dataset, not a
reference (I didn't check this) so if you change the copy (dt) and than
update your session with the original your changes are not being applied.
So try something similar (not tested):
DataSet
ds = ((DataSet)Session["NewData"]);
DataRow
dr = ds.Tables["ControlData"].NewRow();
ds.Tables["ControlData"].Rows.Add(dr);
Session["NewData"] = ds;
hth,
Yannick Smits
"Dean Santillan" <
Click here to reveal e-mail address
> wrote in message
news:694862@aspngdatagridrepeaterdatalist...
[Original message clipped]
Reply to this message...
System.Data.DataRow
System.Data.DataSet
System.Data.DataTable
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com