473,406 Members | 2,620 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,406 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 2743
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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,...
0
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...

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.