?
Solved

Session variable is not resetting an Objectdatasource property

Posted on 2009-04-24
2
Medium Priority
?
259 Views
Last Modified: 2013-11-25
Hi;

I want to restore my gridview with filtered data but when I try to restore using my Session var
the code doesn't restore anything.

What I am doing wrong?

Thanks

If Session("holdFLtr") > "" Then
                GridView1.DataSourceID = "ObjectDatasource4"
                GridView1.DataBind()
                GridView1.PageIndex = Session("holdPgNo")
                ObjectDataSource4.FilterExpression = Session("holdFLtr").ToString

Open in new window

0
Comment
Question by:gggoddard
  • 2
2 Comments
 
LVL 2

Expert Comment

by:puneetdudeja
ID: 24226190
Use DataSource instead of DataSourceId :

 GridView1.DataSource = ObjectDatasource4

instead of

GridView1.DataSourceID = "ObjectDatasource4"

0
 
LVL 2

Accepted Solution

by:
puneetdudeja earned 2000 total points
ID: 24226233
If Session("holdFLtr") > "" Then
                GridView1.DataSource = ObjectDatasource4
                ObjectDataSource4.FilterExpression = Session("holdFLtr").ToString
                GridView1.PageIndex = Session("holdPgNo")
                GridView1.DataBind()

Also set the FilterExpression before binding the GridView.
               
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month17 days, 5 hours left to enroll

864 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