[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

asp.net gridview updating returns multiple values for same control

Posted on 2014-08-29
7
Medium Priority
?
164 Views
Last Modified: 2014-09-09
I have a gridview control that allows edit/updates.  After editing text in a textbox, I press the "update" button which triggers the gridview_onrowupdating() event.  I retrieve the value of the textbox using the "findcontrol" method.  Everything to this point is normal, nothing facy being done.

The problem is that when I have edited the text in the textbox, the TextBox.text value is old,new!  What's going on?
0
Comment
Question by:dhenderson12
  • 4
  • 3
7 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 40292754
Can you show the code in gridview_onrowupdating() event please.
0
 

Author Comment

by:dhenderson12
ID: 40292793
sure, here's the code:

protected void gvCallList_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
       int idx = gvCallList.EditIndex;
       GridViewRow row = gvCallList.Rows[idx];

       TextBox tbPID = (TextBox)gvCallList.Rows[idx].FindControl("txtCallID");
       string pid = tbPID.Text;  // this returns 0,123  (0=original value  123=new value)
}

Open in new window

0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 40292974
Is this the only code in the event?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:dhenderson12
ID: 40292987
yep, that's it.  I'm just starting this particular part of the project, and couldn't get past this multiple value issue.  I'll add code to update the database later.
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 40293256
I have tested your code in a test application and I am NOT getting the same type of results you are getting in yours. Can you put together a test application that exhibits the same issue you are having in your application and then zip that complete test application and upload to to EE.
0
 

Author Comment

by:dhenderson12
ID: 40293518
I can try but it will take some time;  this is part of a much larger larger project.  You have confirmed, however, that there is something screwy going on in my project.  A couple of other points that might be relevant:  
1.  this is a vs2010 project using .net 4.0.
2.  although the pages are using a master page, the master page is really pretty "vanilla" without any  special javascript or code behind.
0
 

Author Comment

by:dhenderson12
ID: 40312671
I found the problem:  I had a corrupted VS 2010 installation.  I re-installed and the issue I was seeing disappeared.  Thanks for the response, Fernando.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question