Wrox Programmer Forums
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 28th, 2007, 04:27 AM
Authorized User
Join Date: Jan 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview Losing Filter on Edit


I have a gridview, and I have a search textbox and button which sets the filter on the SqlDataSource that the gridview uses.

It all works fine, until you try to Edit (i'm assuming that Delete and Update wont work either while its filtered) a record while it is filtered.

Has anyone else faced this problem?

Old January 28th, 2007, 05:55 AM
Authorized User
Join Date: Jan 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

Ok i found a solution for this.

Basically you need to reset the filter on page load.

What i did is i added a hidden text box that holds the SqlDataSource1.FilterExpression value. And on page load if its a postback, i just re apply it...

SqlDataSource1.FilterExpression = txtFilter.Text;

and viola! fixes the edit and also the paging problem (caused by the same thing).

found the solution here:



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not Edit gridview having TemplateField coolcoder2007 .NET Framework 2.0 4 March 6th, 2008 06:36 AM
Filter results by value in a gridview field cesemj ASP.NET 2.0 Basics 2 February 20th, 2008 11:39 PM
Filter GridView Results by date range srinredd59 ASP.NET 2.0 Basics 0 December 27th, 2006 03:53 PM
edit gridview anurag_ur ASP.NET 2.0 Basics 3 June 21st, 2006 03:21 AM
edit gridview anurag_ur ASP.NET 2.0 Basics 0 June 20th, 2006 07:57 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.