473,746 Members | 2,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scrollable datagrid: dynamic paging

RJN
Hi

Sorry for posting again.

I have a datagrid which is put inside a div tag to make it scrollable. I
need to page the datagrid. The page numbers appear at the bottom of the
datagrid and has to be scrolled down completely to see the page number
links. The page number should always be visible outside the scroll bar.
Basically I want to create the paging links dynamically and on click of
this it should fire PageIndexChange d event.

The following link has an example of scrollable/sortable datagrid. I'm
trying to paging in the similar way.
http://www.extremeexperts.com/Net/Ar...ridwithSorting
.aspx

I introduce a table below the datagrid and this table will have all the
paging links.

In the ItemCreated event of the datagrid, I get the control collection
of the paging links and add it to the table.

If e.Item.ItemType = ListItemType.Pa ger Then
Dim i As Int16
For i = 0 To e.Item.Controls (0).Controls.Co unt - 1
--Create a new link button
--Get the e.Item.Controls (0).Controls(i) and assign
its properties to link button
--Add the link button to the table
Next
End if

Now I need to assign the events to the new paging links created. It
should fire PageIndexChange d event.

To do this , in the ItemDataBound event I add the
Page.GetPostBac kClientHyperlin k to the link button .

But in ItemDataBound I'm not able to execute the statements within the
below if condition.
If e.Item.ItemType = ListItemType.Pa ger

End if

This statement is not executed at all.

Any help is appreciated.

Regards

RJN


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
2 2584

Hi RJN,

Item_DataBound event will fire only if you do databinding in that datagrid.
If you send your code behind code, then it will be easier to find the issue.

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"RJN" <rj*@yahoo.co m> wrote in message
news:Ok******** ******@TK2MSFTN GP09.phx.gbl...
Hi

Sorry for posting again.

I have a datagrid which is put inside a div tag to make it scrollable. I
need to page the datagrid. The page numbers appear at the bottom of the
datagrid and has to be scrolled down completely to see the page number
links. The page number should always be visible outside the scroll bar.
Basically I want to create the paging links dynamically and on click of
this it should fire PageIndexChange d event.

The following link has an example of scrollable/sortable datagrid. I'm
trying to paging in the similar way.
http://www.extremeexperts.com/Net/Ar...ridwithSorting
aspx

I introduce a table below the datagrid and this table will have all the
paging links.

In the ItemCreated event of the datagrid, I get the control collection
of the paging links and add it to the table.

If e.Item.ItemType = ListItemType.Pa ger Then
Dim i As Int16
For i = 0 To e.Item.Controls (0).Controls.Co unt - 1
--Create a new link button
--Get the e.Item.Controls (0).Controls(i) and assign
its properties to link button
--Add the link button to the table
Next
End if

Now I need to assign the events to the new paging links created. It
should fire PageIndexChange d event.

To do this , in the ItemDataBound event I add the
Page.GetPostBac kClientHyperlin k to the link button .

But in ItemDataBound I'm not able to execute the statements within the
below if condition.
If e.Item.ItemType = ListItemType.Pa ger

End if

This statement is not executed at all.

Any help is appreciated.

Regards

RJN


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2
RJN

Hi Sarvana

Thanks for your reply. We have followed the similar approach that you
have given in one of your articles. In the ItemCreated event we created
all the links and in the ItemDataBound event we attached the events for
these links.

In the .aspx we have a created a table "tblPage" for showing the page
number links.

This is the code in .aspx.vb page in the ItemCreated event.

If e.Item.ItemType = ListItemType.Pa ger Then
tblPage.Rows(0) .Cells.Clear()
For ipage = 0 To e.Item.Controls (0).Controls.Co unt - 1
strType = e.Item.Controls (0).Controls(ip age).GetType.Fu llName
tblcell = New TableCell
Select Case strType
Case "System.Web.UI. LiteralControl"
Dim ltPage As New LiteralControl
ltPage.ID =
e.Item.Controls (0).Controls(ip age).ClientID
ltPage.Text = "&nbsp;"
tblcell.Control s.Add(ltPage)
Case "System.Web.UI. WebControls.Lab el"
Dim lblPage As New Label
lblPage.CssClas s = "MSPullDownCont ent"
lblPage.ID =
e.Item.Controls (0).Controls(ip age).ClientID
lblPage.Text =
CType(CType(e.I tem.Controls(0) .Controls(ipage ), System.Web.UI.C ontrol),
System.Web.UI.W ebControls.Labe l).Text
tblcell.Control s.Add(lblPage)

Case "System.Web.UI. WebControls.Dat aGridLinkButton "
Dim lnkbutton As New LinkButton
Dim ctl As
System.Web.UI.W ebControls.Data GridItem

lnkbutton.ID =
CType(e.Item.Co ntrols(0).Contr ols(ipage),
System.Web.UI.C ontrol).ClientI D
lnkbutton.Comma ndArgument =
CType(CType(e.I tem.Controls(0) .Controls(ipage ), System.Web.UI.C ontrol),
System.Web.UI.W ebControls.Link Button).Command Argument
lnkbutton.Comma ndName =
CType(CType(e.I tem.Controls(0) .Controls(ipage ), System.Web.UI.C ontrol),
System.Web.UI.W ebControls.Link Button).Command Name
lnkbutton.Text =
CType(CType(e.I tem.Controls(0) .Controls(ipage ), System.Web.UI.C ontrol),
System.Web.UI.W ebControls.Link Button).Text
lnkbutton.Style .Add("text-decoration", "none")
lnkbutton.Attri butes.Item("onc lick") =
Page.GetPostBac kClientHyperlin k(e.Item.Contro ls(0).Controls( ipage),
lnkbutton.Comma ndArgument)
tblcell.Control s.Add(lnkbutton )
End Select
tblPage.Rows(0) .Cells.Add(tblc ell)
Next
--In the Item databound event:

If e.Item.ItemType = ListItemType.Pa ger Then
Dim ipage As Int16
Dim strType As String

For ipage = 0 To e.Item.Controls (0).Controls.Co unt - 1
strType =
e.Item.Controls (0).Controls(ip age).GetType.Fu llName
If strType =
"System.Web.UI. WebControls.Dat aGridLinkButton " Then
Dim lnkbutton As LinkButton
Dim oControl As LinkButton
oControl = CType(e.Item.Co ntrols(0).Contr ols(ipage),
System.Web.UI.W ebControls.Link Button)
lnkbutton =
tblpage.Rows(0) .Controls(ipage ).Controls(0)
lnkbutton.Style .Add("text-decoration", "none")
lnkbutton.Attri butes.Add("href ",
Page.GetPostBac kClientHyperlin k(e.Item.Contro ls(0).Controls( ipage), ""))
End If
Next
End If

The links are being created but events are not attached to them. Will
you be able to tell where we are doing wrong?

Regards

Rjn

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

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

Similar topics

0
1348
by: Clement | last post by:
I have an user control(Control1) that dynamically adds another user control(Control2). In Control2, I am displaying data in a datagrid which I enable paging and sorting. When I click on the page number, there is a javascript error: Object Expected. I searched this group for solutions, I found a similar problem ...
2
4000
by: Ben | last post by:
Hi, I'd like to have a datagrid that has a dropdownlist in the pager control for setting the page size. I can get the control into the pager inside the datagrid itemcreated event by checking for ListItemType.Pager. The problem I'm having is subscribing to the selectedindex changed event. The datagrid doesn't even seem fire an itemcommand, but that's ok, just the selectedindex changed event would do... Any advice is greatly appreciated!
0
1130
by: RJN | last post by:
Hi I have a datagrid which is put inside a div tag to make it scrollable. I need to page the datagrid. The page numbers appear at the bottom of the datagrid and has to be scrolled down completely to see the page number links. The page number should always be visible outside the scroll bar. I'm trying to create a table dynamically below the datagrid with all the paging links. In the ItemCreated event of the datagrid, I have something...
1
2319
by: RJN | last post by:
Hi Sorry for posting again. I have a datagrid which is put inside a div tag to make it scrollable. I need to page the datagrid. The page numbers appear at the bottom of the datagrid and has to be scrolled down completely to see the page number links. The page number should always be visible outside the scroll bar. Basically I want to create the paging links dynamically and on click of this it should fire PageIndexChanged event.
6
1814
by: Shawn | last post by:
Hi. I already have a datagrid where I'm using paging. I have a stored procedure that fills a temp table with 200-500 rows and then sends back 10 records at the time. When I go to page 2 the SP fills the temp table again and returns rows 10-19. The temp table is dropped after each call to the SP, so it has to be created and filled every time the user changes page in the datagrid. My question is this: Would it be more efficient to...
5
2791
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
6
1532
by: coleenholley | last post by:
Hi All :-) I need to populate a table I created as a web form. Are there any links to show me how to do this? I CANNOT use a dtagrid for this, the table has to be laid out as follows: Header Row Header Row Static data Dynamic (read only) data <Break> Header Row Header Row Header Row Header Row
0
1108
by: ashish.dwivedi1 | last post by:
Hi, I am building a ASP .NET composite control containing a datagrid during which I am finding a problem while paging of the grid. The problem is for example if I am having three pages to be displayed in the datagrid, I have set the paging mode to be numeric.Now I am going to have
0
1319
by: rn5a | last post by:
In a shopping cart app, a user purchases 5 items on 31st March 2007. This is his 1st order. He places a 2nd order on 13th April in which he buys 8 items. Next he places his 3rd order on 16th April in which he buys 2 items. The details of the orders are displayed in a DataGrid but I want to display only 1 order in one page. In other words, I want the DataGrid to be paginated. This means that the DataGrid will display 3 paging links - 1, 2...
0
8800
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
9349
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
9285
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
9218
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
8227
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4575
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...
1
3292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.