Solved

Gridview UpdateProblem

Posted on 2013-01-14
4
300 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

636 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