Solved

Gridview UpdateProblem

Posted on 2013-01-14
4
298 Views
Last Modified: 2013-01-14
How to Update the values in gridview if it shows old values....

 FillData();
           
            GridViewRow gr1 = (GridViewRow)dgrData.Rows[e.RowIndex];
             
            TextBox tCategory=(TextBox)gr1.FindControl("txtCategory");
         
            //DataBind();
            string update = "update category set category='" + tCategory.Text + "' where cat_id=" + dgrData.DataKeys[e.RowIndex].Values[0].ToString() + "";
0
Comment
Question by:sarang8180
4 Comments
 
LVL 8

Expert Comment

by:deepu chandran
ID: 38773606
Hi,

Call the Load Grid function again,that means

1) Get the data from the DB
2) the List/Dataset/Datatable assign to Grid.Datasource
3) call Grid.Databind() again

-- Deepu
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 38773617
here you will get some good examples

http://forums.asp.net/t/1255252.aspx/1
0
 

Author Comment

by:sarang8180
ID: 38773687
if i call the data from database again and bind to gridview,it shows old data in textbox of gridview.

If i don't call,keep it in !IsPostBack.Then Gridview vanishes on click of update link
0
 
LVL 20

Accepted Solution

by:
informaniac earned 500 total points
ID: 38775388
You should call the code to retrieve the data after the call to update is complete. This way, the textbox value will be stored in the Database.

If I've got it completely wrong, please post some more of the code... i.e. how are you binding the code. update code.. etc..
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

830 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