473,662 Members | 2,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to call a cached session in PageIndexChange d event?

Hi experts,

I am having trouble calling the cached dataview session and
dataview.rowfil ter session in the pageIndexChange d 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 PageIndexChange d:
Exception Details: System.NullRefe renceException: Object reference not
set to an instance of an object.
on dv.RowFilter = Session("Cached Filter")

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.CommandT ext = "SELECT J.Job_ID, J.J_Open_Date,
J.J_Due_Date, J.J_Location FROM Job_Tracking_Ta ble J order by Job_ID
desc"

strSql.Connecti on = conHDDb

strSql.CommandT ype = CommandType.Tex t

dataAdapter.Sel ectCommand = strSql

dataAdapter.Fil l(dataSet, "Job_Tracking_T able")

Dim JobInfo As DataTable =
dataSet.Tables( "Job_Tracking_T able")

Dim dvJobInfo As New
DataView(dataSe t.Tables("Job_T racking_Table") )

Session("Cached Grid") = Source

dvJobInfo.Sort = strViewString

dvJobInfo.RowFi lter = strDMFiltering &
strLocFiltering & strDueDateFilte ring &
strPostedDateFi ltering & strCatgFilterin g

Session("Cached Filter") = dvJobInfo.RowFi lter

DataGrid1.DataS ource = dvJobInfo

Session("JobSes sion") = dvJobInfo

DataGrid1.DataB ind()

conHDDb.Close()

End If

End Sub

Sub DataGrid1_PageI ndexChanged(ByV al sender As System.Object, ByVal e
As DataGridPageCha ngedEventArgs) Handles DataGrid1.PageI ndexChanged

Dim dv As New DataView

dv = Session("Cached Grid")

dv.RowFilter = Session("Cached Filter")

DataGrid1.Curre ntPageIndex = e.NewPageIndex

BindTheData()

End Sub

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

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

Similar topics

0
2296
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
6761
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" runat="server" onpageindexchanged="dgErrorLog_OnPageIndexChanged" enableviewstate="False" allowpaging="True" pagesize="20"
3
1199
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 it, but I only bind one from the calling webform based on user selections. Behavior: Once the grid displays I can go from page 1 to page 2 without any problem. I can also do the same from 2 to 3, 3 to 4...etc. I can also go from 4 to 3 or 3...
0
1176
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 can't restrict this by not performing the data access on postbacks, as the postback may well be a request to drilldown through the data and require re-populating the grid. Ideally I would like to check for a datagrid pageIndexChanged event in the...
1
2033
by: Long Le | last post by:
I checked to see if its wired correctly: private void InitializeComponent() { this.DataGrid1.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGrid1_PageIndexChanged); this.DataGrid1.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCommand); this.Load += new System.EventHandler(this.Page_Load); }
2
1424
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 data again. I tested whether the event handling function is being called or not, it
0
1025
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. How can this be done? I am using framework 1.1 Thanks, abn
1
4154
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 workaround ? -- Rick Droske
1
1962
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 event I have tried to remove it using "HttpResponse.RemoveOutputCacheItem(path);" b but it doesn't work Thanks
0
8435
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.