AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Problem when using the code given in the article - 'Simple Insert, Update, Delete in GridView'
Posted by Anandi.A on  7/18/2007 11:17:46 PM Category: ADO.NET
Add to my favorites
Email to friend
Hi,

I have tried using the code given in the article. When I click on Edit link, Update and Cancel links are appearing and the drop down list is also appearing which I have put in the Edit Template column. But after I select a value from the dropdown list and click update, the dropdown list is still visible. But after if I click Cancel, list disppears and the GridView is bound with the updated value.

When I debugged it, I saw that after the Rowupdating method is called, Row data bound event is also called and there the Dropdownlist is not null. So data binding happens to the Dropdownlist.Is this a problem?

But the Cancel link is working fine. (There when it goes to RowDataBound method is called the Dropdownlist is null.)

Please help.


Post Your Reply Post New Question

 Viewer's Reply
Add GridView1.EditIndex = -1;
Answered By Moderator1 on 7/19/2007 11:15:37 AM
Hi,

In your GridView1_RowUpdating event, after updating your record into database and before fetching it again to fill the GridView control, you have to add the following code

GridView1.EditIndex = -1;

We hope it will work. Otherwise inform us.. sure we will guide you.

Thanks
 
Post Your Reply If you still have problem, post it again under this reply for better response.

 
Sponsored by
Website Magazine
Sexy Web Design - Free 71 Page Preview!
Simply JavaScript - Free 150 Page Preview!