473,396 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

GridView RowUpdating not retrieving newvalues (only oldvalues)

Hi, I have been struggling with the GridView the whole day, but can not
get this solved.

The rowupdating event in my Gridview doesn't give me the new values
only the old ones.
In my GridView I do not use a DataSourceObject and can therefore not
use e.NewValues or e.OldValues
The columns used are template columns
Thx

Below some codesnippets I use:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
else
{
if (ViewState["BestellingAfdeling"] != null)
_BeBestellingAfdeling =
(BEBestellingAfdeling)ViewState["BestellingAfdeling"];
}
}
protected void grvCategorie_UpdatingCommand(object sender,
GridViewUpdateEventArgs e)
{
int _CategorieId =
Convert.ToInt32(grvCategorie.DataKeys[e.RowIndex]["fldCategorieId"]);
BEBestellingAfdeling.tblCategorieRow _drCategorieRow =
_BeBestellingAfdeling.tblCategorie.FindByfldCatego rieID(_CategorieId);

if (_drCategorieRow != null)
{
_drCategorieRow.BeginEdit();
_drCategorieRow.fldOmschrijving =
((TextBox)grvCategorie.Rows[e.RowIndex].FindControl("tbxOmschrijving")).Text;
_drCategorieRow.fldStatus =
((CheckBox)grvCategorie.Rows[e.RowIndex].FindControl("cbxStatus")).Checked;
_drCategorieRow.EndEdit();
}

grvCategorie.EditIndex = -1;
ReBindDataToControl();
}

Dec 12 '06 #1
1 8988
Nevermind, see below for the problem.

In my GV I use ImageButton to handel edit, cancel and update logic. In
my codebehind file I have a procudure checking for the e.command
argument in the GridView_RowCommand. The problem was that in this
particular procedure I did a ReBind from the GV, which means, I lost
all my changes and could only see the old (original) values.

The next link helped me a lot:

http://groups.google.nl/group/micros...se_frm/thread/
684ca465e9bcdbac/b712f23981099d17?lnk=st&q=Gridview+editing+without +ObjectDataSource&rnum=7#b712f23981099d17

In summary: due to rebinding on the wrong moment I lost my changes.

Dec 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alex A. | last post by:
I've got an unbound gridview that I'm late binding. The RowUpdating isn't firing when the gridview's update button is clicked. What am I missing? Thanks
0
by: loga123 | last post by:
Hi All, I am using asp.net 2.0. I have a gridview with AutoGenerateEditButton="True" . I am trying to access newValues in rowupdating event. It gives me "oldvalues" collection. I have a)...
3
by: slemen | last post by:
The controls (textboxes) in the gridview row being updated have the old, pre user updated values in the RowUpdating event. Does anyone have an idea why? Thank you, Scott
9
by: John007 | last post by:
I am using a SQLDataSource to populate my gridview in ASP.Net 2.0. When I hit Edit, the textboxes appear and I am able to edit my values. When I hit Update, the changes are not saved, and there is no...
1
by: vertigo262 | last post by:
Hello all, I have used sqldatasource many times calling e.newvalues, and e.oldvalues in the iteminserting, itemupdating, itemdeleting subs. When I try using them with the objectdatasource they...
1
by: Steve Kershaw | last post by:
Hi, I'm using the RowUpdating() event of an updatable GridView. I need to see the values of the columns in the updated row. There has got to be a way to do this! Any suggestions? Thanks...
4
by: anniebai | last post by:
Please help me with writing a RowUpdating function in C#, I don't know how to grab the current field's value and also get the old value for one of keys (which is ProjectName for editing) of the...
3
by: nick chan | last post by:
Hi i run into some difficulties getting rowupdating to fire when clicking Update link/button on gridview I set datasource at runtime, basically a datatable Edit and Cancel works. I don't know...
0
by: E. Kwong | last post by:
In a Gridview control, I have several BoundFields, and also a couple of TemplateFields. In the Rowupdating event, I try to retrieve one of the BoundFields (i.e. 4th column of the Gridview...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.