473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

How to call a cached session in PageIndexChanged event?

Hi experts,

I am having trouble calling the cached dataview session and
dataview.rowfilter session in the pageIndexChanged event.
Currently, if user goes to page 2, the datagrid displays data without
the rowfilter that user selected from 5 dropdownlists.

I received the exception error on the code I wrote for calling the
cached session in PageIndexChanged:
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
on dv.RowFilter = Session("CachedFilter")

Can someone show me how to correct the problem?

Thank you.
--------------------------------------------------------------
Sub BindTheData()

Dim strSql As New SqlCommand

Dim dtrDataGrid As SqlDataReader

Dim dataAdapter As New SqlDataAdapter

Dim dataSet As New DataSet

Dim Source As DataView

Source = CType(Session("CachedGrid"), DataView)

conHDDb.Open()

strSql.CommandText = "SELECT J.Job_ID, J.J_Open_Date,
J.J_Due_Date, J.J_Location FROM Job_Tracking_Table J order by Job_ID
desc"

strSql.Connection = conHDDb

strSql.CommandType = CommandType.Text

dataAdapter.SelectCommand = strSql

dataAdapter.Fill(dataSet, "Job_Tracking_Table")

Dim JobInfo As DataTable =
dataSet.Tables("Job_Tracking_Table")

Dim dvJobInfo As New
DataView(dataSet.Tables("Job_Tracking_Table"))

Session("CachedGrid") = Source

dvJobInfo.Sort = strViewString

dvJobInfo.RowFilter = strDMFiltering &
strLocFiltering & strDueDateFiltering &
strPostedDateFiltering & strCatgFiltering

Session("CachedFilter") = dvJobInfo.RowFilter

DataGrid1.DataSource = dvJobInfo

Session("JobSession") = dvJobInfo

DataGrid1.DataBind()

conHDDb.Close()

End If

End Sub

Sub DataGrid1_PageIndexChanged(ByVal sender As System.Object, ByVal e
As DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged

Dim dv As New DataView

dv = Session("CachedGrid")

dv.RowFilter = Session("CachedFilter")

DataGrid1.CurrentPageIndex = e.NewPageIndex

BindTheData()

End Sub

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 18 '05 #1
0 1058

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Hubert Baumeister | last post by:
Fifth International Conference on eXtreme Programming and Agile Processes in Software Engineering XP2004 June 6-10, 2004, Garmisch-Partenkirchen, Germany http://www.xp2004.org/
3
by: Rick Strahl [MVP] | last post by:
Hi all, I'm loosing my mind <g>... I have a datagrid and I can't for hte live of me not get the PageIndexChanged event to fire in my codebehind form. <asp:datagrid id="dgErrorLog"...
3
by: Rubble | last post by:
Ive been having some weird issues with the microsoft grid control and its paging feature. Overview: I have a webform that loads a custom user control. This user control has several datagrids on...
0
by: MikeG | last post by:
Hi, I have a web page with a datagrid wich shows a view on miltidimensional data from analysis server. I want to restrict the data access by not repopulating my datasource when changing page. I...
1
by: Long Le | last post by:
I checked to see if its wired correctly: private void InitializeComponent() { this.DataGrid1.PageIndexChanged += new...
2
by: Gopalan | last post by:
Hi I have got a Datagrid populated with a Dataset. The first time the datagrid shows the first page data. When I clicked the Next link to display the next page data it displays the same...
0
by: ABN | last post by:
Hi, I want to trap PageIndexChanged event of datagrid at clientside, and want to take some actions before page gets postback. Actual process of data bind will take place in code-behind only....
1
by: Rick Droske | last post by:
In the PageIndexChanged event of an ASP.Net 2.0 GridView the Rows property has rows but the DataKeys property has 0 Items ? This definitely seems like a bug to me. Has anyone come up with a good...
1
by: ABCL | last post by:
Hi All I have usercontrol on the page that I have added at design Time and cached it How can I remove the cached Usercontrol from outputcache. I want to remove cached version in session start...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.