472,980 Members | 2,022 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Carrying data for a Datagrid from page to page

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,

Tom
Nov 19 '05 #1
5 2705
You would write the code that goes to the database and gets the data in the
Not IsPostBack and let ViewState carry the data from that point forward.

Sub Page_Load
'Set DataGrid's data source

If Not IsPostBack Then
'Go to database and get data
'Bind DataGrid to data
End If
End Sub
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
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,

Tom

Nov 19 '05 #2
"Scott M." <s-***@nospam.nospam> wrote in message
news:eX*************@TK2MSFTNGP12.phx.gbl...
You would write the code that goes to the database and gets the data in the Not IsPostBack and let ViewState carry the data from that point forward.

Sub Page_Load
'Set DataGrid's data source

If Not IsPostBack Then
'Go to database and get data
'Bind DataGrid to data
End If
End Sub

But where is the data stored?

I am not putting all the data in the grid when I use paging with the
Datagrid.

Tom
"tshad" <ts**********@ftsolutions.com> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
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,

Tom


Nov 19 '05 #3
First, yes you are bringing all the data into the grid when you use paging
(unless you are using custom paging), you are only showing one page of data
at a time, but you are, in fact bringing all the data down to the grid.

All of the Web Form controls (DataGrid included) persist their own state
between page requests via ViewState. ViewState is a hidden form field that
contains the entire page's state encoded and compressed into this string.
After you go and get the data on the first page call, ALL of the data is
placed into the ViewState hidden form field. On the next page call, the
data is taken out of ViewState and placed back into the various controls
that had the data in the first place. This is why you only need to go to
the data on the first page call.

If you are using the Custom Paging feature, you are going to be only
retrieving one page of data at a time and so in this circumstance you would
have to go back to the database on each page call to get the next set of
records.

"tshad" <tf*@dslextreme.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Scott M." <s-***@nospam.nospam> wrote in message
news:eX*************@TK2MSFTNGP12.phx.gbl...
You would write the code that goes to the database and gets the data in

the
Not IsPostBack and let ViewState carry the data from that point forward.

Sub Page_Load
'Set DataGrid's data source

If Not IsPostBack Then
'Go to database and get data
'Bind DataGrid to data
End If
End Sub


But where is the data stored?

I am not putting all the data in the grid when I use paging with the
Datagrid.

Tom

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
> 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,
>
> Tom
>



Nov 19 '05 #4
"Scott M." <s-***@nospam.nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
First, yes you are bringing all the data into the grid when you use paging
(unless you are using custom paging), you are only showing one page of
data at a time, but you are, in fact bringing all the data down to the
grid.

All of the Web Form controls (DataGrid included) persist their own state
between page requests via ViewState. ViewState is a hidden form field
that contains the entire page's state encoded and compressed into this
string. After you go and get the data on the first page call, ALL of the
data is placed into the ViewState hidden form field. On the next page
call, the data is taken out of ViewState and placed back into the various
controls that had the data in the first place. This is why you only need
to go to the data on the first page call.

If you are using the Custom Paging feature, you are going to be only
retrieving one page of data at a time and so in this circumstance you
would have to go back to the database on each page call to get the next
set of records.

I'm not using the Custom Paging Feature, but I am calling my BindData
procedure to get the data each time. The following procedure is linked to
my first/next/previous/last links and sets the CurrentPageIndex accordingly.
The last line calls the BindData procedure and it works fine. But if what
you say is true, I am doing a lot of extra work (and slowing the page down,
I would assume). The problem is that if I comment out the BindData routine
the Datagrid comes back exactly the same as it did before post.

************************************************** ********
Sub PagerButtonClick(sender As Object, e As EventArgs)
trace.warn("in PagerButtonClick")
'used by external paging UI
Dim arg As String = sender.CommandArgument
Dim oGrid = DataGrid1

Select arg
Case "next": 'The next Button was Clicked
If (oGrid.CurrentPageIndex < (oGrid.PageCount - 1)) Then
oGrid.CurrentPageIndex += 1
End If

Case "prev": 'The prev button was clicked
If (oGrid.CurrentPageIndex > 0) Then
oGrid.CurrentPageIndex -= 1
End If

Case "last": 'The Last Page button was clicked
oGrid.CurrentPageIndex = (oGrid.PageCount - 1)

Case Else: 'The First Page button was clicked
oGrid.CurrentPageIndex = Convert.ToInt32(arg)
End Select

'Now, bind the data!
' BindData(lastSortColumn)
End Sub
************************************************** ************
Here is my DataGrid
************************************************** *******
<asp:DataGrid AllowPaging="true"
AllowCustomPaging="false"
PageSize="10"
PagerStyle-Visible="false"
Visible=false
AllowSorting="True"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
GridLines="Both" BorderColor="#666666"
ID="DataGrid1"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
BorderWidth="1"
style="margin:auto; width:700px">
<headerstyle HorizontalAlign="center" BackColor="#6ce0f7"
ForeColor="#3EA2BC" Font-Bold="true" />
<itemstyle BackColor="#F2F2F2" />
<alternatingitemstyle BackColor="#E5E5E5" />
<footerstyle HorizontalAlign="center" BackColor="#E8EBFD"
ForeColor="#3D3DB6" Font-Bold="true" />
<pagerstyle BackColor="white" />
<columns>
<asp:BoundColumn DataField="Applied"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top">
<itemstyle ForeColor="red" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Rank"
HeaderText="Rank"
ReadOnly="true"
Visible="False" ItemStyle-VerticalAlign="Top"
SortExpression="Rank"> </asp:BoundColumn>
<asp:HyperLinkColumn DataTextField="JobTitle"
DataTextFormatString="{0}" DataNavigateUrlField="PositionID"
DataNavigateUrlFormatString="displayPositionOnly.a spx?PositionID={0}"
headertext="Job Title"
sortexpression="JobTitle" ItemStyle-VerticalAlign="Top"/>
<asp:BoundColumn DataField="Company"
HeaderText="Company"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="Company"/>
<asp:BoundColumn DataField="Location"
HeaderText="Location"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="Location"/>
<asp:BoundColumn DataField="Posted"
HeaderText="Date"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="DatePosted">
<itemstyle CssClass="datedisplay" />
</asp:BoundColumn>
<asp:BoundColumn DataField="lastUpdated"
HeaderText="Last Updated"
ReadOnly="true"
Visible="false" ItemStyle-VerticalAlign="Top"
SortExpression="p.DateUpdated">
<itemstyle CssClass="datedisplay" />
</asp:BoundColumn>
</columns>
</asp:DataGrid>
<asp:DataGrid AllowPaging="true"
AllowCustomPaging="false"
PageSize="4"
PagerStyle-Visible="false"
visible="false"
AllowSorting="True"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
GridLines="Both" BorderColor="#666666"
ID="DataGrid2"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
BorderWidth="1"
style="margin:auto;width:700px">
<HeaderStyle HorizontalAlign="center" BackColor="#6ce0f7"
ForeColor="#3EA2BC" Font-Bold="true" />
<ItemStyle BackColor="#F2F2F2" />
<AlternatingItemStyle BackColor="#E5E5E5" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD"
ForeColor="#3D3DB6" Font-Bold="true" />
<PagerStyle BackColor="white" />
<Columns>
<asp:BoundColumn DataField="Applied"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top">
<itemstyle ForeColor="red" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Rank"
HeaderText="Rank"
ReadOnly="true"
Visible="False" ItemStyle-VerticalAlign="Top"
SortExpression="Rank">
</asp:BoundColumn>
<asp:TemplateColumn SortExpression="JobTitle"
ItemStyle-VerticalAlign="Top" HeaderText="Job Title">
<itemtemplate>
<asp:hyperlink text='<%# Container.DataItem("JobTitle")%>'
NavigateUrl='<%# "displayPositionOnly.aspx?PositionID=" &
Container.DataItem("PositionID") %>' runat="server" /><br>
<asp:label text='<%# Container.DataItem("JobDescription")%>'
runat="server" />...[<asp:hyperlink text='more' NavigateUrl='<%#
"displayPositionOnly.aspx?PositionID=" & Container.DataItem("PositionID")
%>' runat="server" />]
<br><asp:Label Text="Job Category: " style="font-weight:bold"
runat="server" /><asp:label text='<%# Container.DataItem("Category")%>'
runat="server" />
<br><asp:Label Text="Compensation: " style="font-weight:bold"
runat="server" /><asp:label text='<%# Container.DataItem("SalaryMin")%>'
runat="server" />
<asp:Label Text="- " style="font-weight:bold" runat="server"
/><asp:label text='<%# Container.DataItem("SalaryMax")%>' runat="server" />
</itemtemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Company"
HeaderText="Company"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="Company"/>
<asp:BoundColumn DataField="Location"
HeaderText="Location"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="Location"/>
<asp:BoundColumn DataField="Posted"
HeaderText="Date"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="DatePosted">
<Itemstyle CssClass="datedisplay" />
</asp:Boundcolumn>
<asp:BoundColumn DataField="lastUpdated"
HeaderText="Last Updated"
ReadOnly="true"
Visible="false" ItemStyle-VerticalAlign="Top"
SortExpression="p.DateUpdated">
<Itemstyle CssClass="datedisplay" />
</asp:Boundcolumn>
</Columns>
</asp:DataGrid>
************************************************** **********

Even if I change the CurrentPageIndex, is there something I need to do to
tell the page to reposition based on it?

Thanks,

Tom

"tshad" <tf*@dslextreme.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Scott M." <s-***@nospam.nospam> wrote in message
news:eX*************@TK2MSFTNGP12.phx.gbl...
You would write the code that goes to the database and gets the data in

the
Not IsPostBack and let ViewState carry the data from that point forward.

Sub Page_Load
'Set DataGrid's data source

If Not IsPostBack Then
'Go to database and get data
'Bind DataGrid to data
End If
End Sub


But where is the data stored?

I am not putting all the data in the grid when I use paging with the
Datagrid.

Tom

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
> 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,
>
> Tom
>



Nov 19 '05 #5
Trust me, you do not need to go get your data on each page call, the data is
passed to the client and then back up to the server on each page call via
ViewState.

Try this: Run your page so that your grid is showing data. Now, view the
source code of the page that was delivered to your browser. See that large
amount of encoded crap at the top of the page? That is ALL of your database
data (as well as the state of your DataGrid and other Web Form controls you
are using on the page).

As for your code, I think that you are going about this all wrong.

This is a sample of how your Page_Load and DataGrid event handlers should
look:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
'First time page is loading...
'Run whatever code you are using that goes to the data source and
gets you your data
'Would be best to have that returned data stored in a DataSet

'Bind our DataGrid to the DataSet
dg.DataSource = ds.Tables(0)
dg.DataBind()
Else
'Not the first time page is loading so no need to go back to the
data source
'We don't want to call the DataGrid's DataBind method here because
the
'reason the page is loading again is because user wanted to sort or
change pages
'or edit or update, etc.
' --- WE WILL BIND THE GRID IN THOSE SPECIFIC EVENT HANDLERS

'We may have sorted on a previous Page_Load so re-establish the sort
here
'If we hadn't sorted on a previouse Page_Load, this will just show
the unsorted data
If Not IsNothing(viewstate("prevSort")) Then
Dim dv As New DataView(ds.Tables(0))
dv.Sort = CType(viewstate.Item("prevSort"), String)
'Bind the grid to the DataView
dg.DataSource = dv
End If
End If
End Sub

Private Sub dg_PageIndexChanged(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles
dg.PageIndexChanged
'This fires when someone attempts to go to a different page of data
dg.CurrentPageIndex = e.NewPageIndex
dg.SelectedIndex = -1
dg.EditItemIndex = -1
dg.DataBind()
End Sub

Private Sub dg_SortCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridSortCommandEvent Args) Handles
dg.SortCommand
'We need a DataView so that we can see the data in a different sequence
Dim dv As New DataView(ds.Tables(0))
dv.Sort = e.SortExpression

'Bind the grid to the DataView
dg.DataSource = dv
dg.DataBind()

'Store the sort for future page_load events
viewstate.Add("prevSort", e.SortExpression)
End Sub

Private Sub dg_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles dg.EditCommand
'Tell the grid which row you want to see in edit mode.
'When working with a DataGrid, the term "Item" indicates a row
dg.EditItemIndex = e.Item.ItemIndex
dg.SelectedIndex = e.Item.ItemIndex
dg.DataBind() ' <--- NOTICE THAT THIS WILL RE-CONNECT THE GRID TO THE
DATA
End Sub

Private Sub dg_CancelCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles dg.CancelCommand
'Get out of edit mode
dg.EditItemIndex = -1
dg.DataBind()
End Sub

Private Sub dg_SelectedIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles dg.SelectedIndexChanged
'Get out of edit mode (if we had been editing another row)
dg.EditItemIndex = -1
dg.DataBind()
End Sub

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eq**************@TK2MSFTNGP15.phx.gbl...
"Scott M." <s-***@nospam.nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
First, yes you are bringing all the data into the grid when you use
paging (unless you are using custom paging), you are only showing one
page of data at a time, but you are, in fact bringing all the data down
to the grid.

All of the Web Form controls (DataGrid included) persist their own state
between page requests via ViewState. ViewState is a hidden form field
that contains the entire page's state encoded and compressed into this
string. After you go and get the data on the first page call, ALL of the
data is placed into the ViewState hidden form field. On the next page
call, the data is taken out of ViewState and placed back into the various
controls that had the data in the first place. This is why you only need
to go to the data on the first page call.

If you are using the Custom Paging feature, you are going to be only
retrieving one page of data at a time and so in this circumstance you
would have to go back to the database on each page call to get the next
set of records.

I'm not using the Custom Paging Feature, but I am calling my BindData
procedure to get the data each time. The following procedure is linked to
my first/next/previous/last links and sets the CurrentPageIndex
accordingly. The last line calls the BindData procedure and it works fine.
But if what you say is true, I am doing a lot of extra work (and slowing
the page down, I would assume). The problem is that if I comment out the
BindData routine the Datagrid comes back exactly the same as it did before
post.

************************************************** ********
Sub PagerButtonClick(sender As Object, e As EventArgs)
trace.warn("in PagerButtonClick")
'used by external paging UI
Dim arg As String = sender.CommandArgument
Dim oGrid = DataGrid1

Select arg
Case "next": 'The next Button was Clicked
If (oGrid.CurrentPageIndex < (oGrid.PageCount - 1)) Then
oGrid.CurrentPageIndex += 1
End If

Case "prev": 'The prev button was clicked
If (oGrid.CurrentPageIndex > 0) Then
oGrid.CurrentPageIndex -= 1
End If

Case "last": 'The Last Page button was clicked
oGrid.CurrentPageIndex = (oGrid.PageCount - 1)

Case Else: 'The First Page button was clicked
oGrid.CurrentPageIndex = Convert.ToInt32(arg)
End Select

'Now, bind the data!
' BindData(lastSortColumn)
End Sub
************************************************** ************
Here is my DataGrid
************************************************** *******
<asp:DataGrid AllowPaging="true"
AllowCustomPaging="false"
PageSize="10"
PagerStyle-Visible="false"
Visible=false
AllowSorting="True"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
GridLines="Both" BorderColor="#666666"
ID="DataGrid1"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
BorderWidth="1"
style="margin:auto; width:700px">
<headerstyle HorizontalAlign="center" BackColor="#6ce0f7"
ForeColor="#3EA2BC" Font-Bold="true" />
<itemstyle BackColor="#F2F2F2" />
<alternatingitemstyle BackColor="#E5E5E5" />
<footerstyle HorizontalAlign="center" BackColor="#E8EBFD"
ForeColor="#3D3DB6" Font-Bold="true" />
<pagerstyle BackColor="white" />
<columns>
<asp:BoundColumn DataField="Applied"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top">
<itemstyle ForeColor="red" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Rank"
HeaderText="Rank"
ReadOnly="true"
Visible="False" ItemStyle-VerticalAlign="Top"
SortExpression="Rank"> </asp:BoundColumn>
<asp:HyperLinkColumn DataTextField="JobTitle"
DataTextFormatString="{0}" DataNavigateUrlField="PositionID"
DataNavigateUrlFormatString="displayPositionOnly.a spx?PositionID={0}"
headertext="Job Title"
sortexpression="JobTitle" ItemStyle-VerticalAlign="Top"/>
<asp:BoundColumn DataField="Company"
HeaderText="Company"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="Company"/>
<asp:BoundColumn DataField="Location"
HeaderText="Location"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="Location"/>
<asp:BoundColumn DataField="Posted"
HeaderText="Date"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="DatePosted">
<itemstyle CssClass="datedisplay" />
</asp:BoundColumn>
<asp:BoundColumn DataField="lastUpdated"
HeaderText="Last Updated"
ReadOnly="true"
Visible="false" ItemStyle-VerticalAlign="Top"
SortExpression="p.DateUpdated">
<itemstyle CssClass="datedisplay" />
</asp:BoundColumn>
</columns>
</asp:DataGrid>
<asp:DataGrid AllowPaging="true"
AllowCustomPaging="false"
PageSize="4"
PagerStyle-Visible="false"
visible="false"
AllowSorting="True"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
GridLines="Both" BorderColor="#666666"
ID="DataGrid2"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
BorderWidth="1"
style="margin:auto;width:700px">
<HeaderStyle HorizontalAlign="center" BackColor="#6ce0f7"
ForeColor="#3EA2BC" Font-Bold="true" />
<ItemStyle BackColor="#F2F2F2" />
<AlternatingItemStyle BackColor="#E5E5E5" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD"
ForeColor="#3D3DB6" Font-Bold="true" />
<PagerStyle BackColor="white" />
<Columns>
<asp:BoundColumn DataField="Applied"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top">
<itemstyle ForeColor="red" />
</asp:BoundColumn>
<asp:BoundColumn DataField="Rank"
HeaderText="Rank"
ReadOnly="true"
Visible="False" ItemStyle-VerticalAlign="Top"
SortExpression="Rank">
</asp:BoundColumn>
<asp:TemplateColumn SortExpression="JobTitle"
ItemStyle-VerticalAlign="Top" HeaderText="Job Title">
<itemtemplate>
<asp:hyperlink text='<%# Container.DataItem("JobTitle")%>'
NavigateUrl='<%# "displayPositionOnly.aspx?PositionID=" &
Container.DataItem("PositionID") %>' runat="server" /><br>
<asp:label text='<%# Container.DataItem("JobDescription")%>'
runat="server" />...[<asp:hyperlink text='more' NavigateUrl='<%#
"displayPositionOnly.aspx?PositionID=" & Container.DataItem("PositionID")
%>' runat="server" />]
<br><asp:Label Text="Job Category: " style="font-weight:bold"
runat="server" /><asp:label text='<%# Container.DataItem("Category")%>'
runat="server" />
<br><asp:Label Text="Compensation: " style="font-weight:bold"
runat="server" /><asp:label text='<%# Container.DataItem("SalaryMin")%>'
runat="server" />
<asp:Label Text="- " style="font-weight:bold" runat="server"
/><asp:label text='<%# Container.DataItem("SalaryMax")%>' runat="server"
/>
</itemtemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Company"
HeaderText="Company"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="Company"/>
<asp:BoundColumn DataField="Location"
HeaderText="Location"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="Location"/>
<asp:BoundColumn DataField="Posted"
HeaderText="Date"
ReadOnly="true"
Visible="True" ItemStyle-VerticalAlign="Top"
SortExpression="DatePosted">
<Itemstyle CssClass="datedisplay" />
</asp:Boundcolumn>
<asp:BoundColumn DataField="lastUpdated"
HeaderText="Last Updated"
ReadOnly="true"
Visible="false" ItemStyle-VerticalAlign="Top"
SortExpression="p.DateUpdated">
<Itemstyle CssClass="datedisplay" />
</asp:Boundcolumn>
</Columns>
</asp:DataGrid>
************************************************** **********

Even if I change the CurrentPageIndex, is there something I need to do to
tell the page to reposition based on it?

Thanks,

Tom

"tshad" <tf*@dslextreme.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Scott M." <s-***@nospam.nospam> wrote in message
news:eX*************@TK2MSFTNGP12.phx.gbl...
You would write the code that goes to the database and gets the data in
the
Not IsPostBack and let ViewState carry the data from that point
forward.

Sub Page_Load
'Set DataGrid's data source

If Not IsPostBack Then
'Go to database and get data
'Bind DataGrid to data
End If
End Sub
But where is the data stored?

I am not putting all the data in the grid when I use paging with the
Datagrid.

Tom

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
> 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,
>
> Tom
>



Nov 19 '05 #6

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

Similar topics

9
by: VMI | last post by:
We have this huge application that's based on storing tons of data on a dataTable. The only problem we're having is that storing LOTS of data (1 million records) into a datatable will slow down the...
3
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls...
0
by: lucas | last post by:
Hi, I have a simple input form that i use to add records to a sql server database. Bellow that is a datagrid that has one template column that I use to dispaly the 3 fields with some html...
1
by: Anonieko | last post by:
Here are some of the approaches. 1. Transform DataGrid http://www.dotnetjohn.com/articles.aspx?articleid=36 3. Use the Export approach ...
4
by: Matt | last post by:
I have the following in a page and I am trying to update a record on the next page but for some reason the form data is not carrying over. Any ideas why? <form name=nxtlupdate method=post...
5
nmm32
by: nmm32 | last post by:
I have a DataGrid which displays data with the aid of a procedure. I have tested the procedure inside the database and it is working fine. I have another procedure which adds another row to the...
0
by: cms3023 | last post by:
I have a DataGrid which displays data with the aid of a procedure. I have tested the procedure inside the database and it is working fine. The table inside the database has data that matches with...
4
cassbiz
by: cassbiz | last post by:
Could use some help here. This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working???? from the form I want to carry over two lines of...
8
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.