473,804 Members | 3,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 DataSourceObjec t 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(objec t sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
else
{
if (ViewState["BestellingAfde ling"] != null)
_BeBestellingAf deling =
(BEBestellingAf deling)ViewStat e["BestellingAfde ling"];
}
}
protected void grvCategorie_Up datingCommand(o bject sender,
GridViewUpdateE ventArgs e)
{
int _CategorieId =
Convert.ToInt32 (grvCategorie.D ataKeys[e.RowIndex]["fldCategorieId "]);
BEBestellingAfd eling.tblCatego rieRow _drCategorieRow =
_BeBestellingAf deling.tblCateg orie.FindByfldC ategorieID(_Cat egorieId);

if (_drCategorieRo w != null)
{
_drCategorieRow .BeginEdit();
_drCategorieRow .fldOmschrijvin g =
((TextBox)grvCa tegorie.Rows[e.RowIndex].FindControl("t bxOmschrijving" )).Text;
_drCategorieRow .fldStatus =
((CheckBox)grvC ategorie.Rows[e.RowIndex].FindControl("c bxStatus")).Che cked;
_drCategorieRow .EndEdit();
}

grvCategorie.Ed itIndex = -1;
ReBindDataToCon trol();
}

Dec 12 '06 #1
1 9016
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_RowCom mand. 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/
684ca465e9bcdba c/b712f23981099d1 7?lnk=st&q=Grid view+editing+wi thout+ObjectDat aSource&rnum=7# b712f23981099d1 7

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
2730
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
2778
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) datakeynames property set b) I am using template fields in my gridview and have "EVAL" for ItemTemplate and "BIND" for EditItemTemplate
3
9808
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
26928
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 error message. I put a breakpoint on the RowUpdating event handler and found that the event is not fired. Right now, I have not written code for the Update event. I am just wondering why the event is not firing. Here Person_ID is the primary key....
1
2939
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 return no value, which I am assuming they aren't finding the fields. is anyone having the same problem? I can't figure out what I am doing wrong. Any help would be appreciated.
1
9568
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 in advance!
4
12540
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 selected row. I've tried: e.Keys.Count, e.OldValues.Count, e.NewValues.Count -----------> all give zero Some said if TemplateField is used, e.Keys and Oldvalues, NewValues are all empty. Then what suppose to be used in such case? Thanks for any...
3
4869
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 why RowUpdating just doesn't fire.
0
2508
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 control) for comparision purpose. However; I got null string everytime. On the other hand, I'm able to retrieve the dropdownbox value in the TemplateField. I would like to know what I did wrong with the BoundField. Thanks. Code fragment:
0
9591
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10087
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9166
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.