Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Gridview UpdateProblem

Posted on 2013-01-14
4
Medium Priority
?
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

670 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