Paging Paging Paging

I am trying to do paging with my search results and it isnt working very well.  Here is what I've tried and I feel I've tried everything, lol, please help me out.


Sub DataGrid1_SortCommand(Sender as object, e as DataGridSortCOmmandEventArgs)
DataGrid1.DataBind()
End Sub

Sub Datagrid1_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs)
Dim ds as dataSet
DataGrid1.CurrentPageIndex = e.NewPageIndex
if Session("Search") is nothing then
'Session probably has expired, get the datasource from database

Datagrid1.DataSource = ds.Tables("tblItems")

else
ds = CType(Session("Search"), DataSet)
end if

End Sub


Sub Search(Sender as object, e as eventargs)

Dim strcol as String
Dim strQuery as String
strQuery = tbSearch.Text
Dim MyConnection as new oledbConnection("Provider=sqloledb;Data Source=KILLER-N68GZTBH\EMALL;Initial Catalog=EMALL;User Id=sa;Password=ma_rie1;")
Dim myCOmmand as new oledbDataAdapter("Select * FROM tblItems WHERE ItemKeywords LIKE '%" & strQuery & "%'", MyConnection)
Dim ds as Dataset = new dataset()
MyCommand.Fill(ds, "tblItems")
Session("SearchQuery") = ds
DataGrid1.Datasource = ds.Tables("tblItems").DefaultView
DataBind()
strCol = tbSearch.Text
Dim SearchcOmmand as New oledbCommand("INsert INTO tblSearch (SearchQuery) Values ('" & strcol & "')", MyCOnnection)


MyConnection.Open
SearchCommand.ExecuteNonQuery
MyConnection.CLose

End Sub

And my datagrid

<asp:DataGrid id="Datagrid1"
runat="server"
BorderColor="#6666ff"
Gridlines="Horizontal"
Cellpadding="0"
CellSpacing="0"
Width="75%"
Font-Names="Arial"
Font-Size="10pt"
ShowFooter="True"
HeaderStyle-BackCOlor="#6666ff"
FooterStyle-Backcolor="#6666ff"
ItemStyle-BackColor="#99ccff"
AlternatingItemStyle-BackCOlor="#CCCCFF"
AutoGenerateCOlumns="False"
ALLOWPaging="True"
PageSize="1"
PagerStyle="NextPrev"
OnPAgeIndexXhanged="Datagrid1_PageIndexChanged"
AllowSorting="True">
<Columns>
<asp:TemplateColumn HeaderTExt="Link">
<ItemTemplate>
<asp:HyperLink NavigateURL='<%# "items.aspx?UserID=" & Container.DataItem("UserID") & "&StoreID=" & Container.DataItem("StoreID") & "&ItemID=" & Container.DataItem("ItemID") %>' runat="server" Text="Check it out" />
</ItemTEmplate>
</asp:TemplateColumn>

<asp:templateColumn HeaderTExt="Image">
<ItemTemplate>
<asp:Image IMaGeUrl='<%# "~/Images/" & Container.DataItem("UserID") & "/" & Container.DataItem("ItemPicture") %>' Height="100" Width="100" runat="server" />
</ItemTEmplate>
</asp:TemplateColumn>
<asp:BoundColumn HeaderText="Item Name" Datafield="ItemName" />
<asp:TemplateColumn HeaderText="Description">
<ItemTEmplate>
<asp:label id="lblDescription" runat="server" Text='<%# Container.DataItem("ItemDescription") %>' />
</ItemTEmplate>
</asp:TemplateColumn>
<asp:BOundColumn HeaderTExt="Price" Datafield="ItemPrice" />
<asp:BoundCOlumn HeaderText="Quantity Left" DataField="ItemQuantity" />
</Columns>
</asp:DataGrid>

Free pixel advertising
0
markmil2002
12/20/2004 7:22:23 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
2925 Views

Similar Articles

[PageSpeed] 31

In the paging event, after you update it's currentPageIndex, the grid needs to be rebound to the datasource.  So you should write code to rebind it or call a function that binds the grid.
In this world there are 10 types of people, those that know binary and those who don't.
0
optik
12/20/2004 1:42:03 PM
I dont understand exactly what you mean
Free pixel advertising
0
markmil2002
12/20/2004 3:51:54 PM
Reply:

Similar Artilces:

i have 3 pages student information , i filled two pages ,then go to 3rd page . First Two pages iam having 100 controls.how to store that controls and how to send these controls into 3rd page in ?
i have 3 pages student information , i filled two pages ,then go to 3rd page . First Two pages iam having 100 controls.how to store that controls and how to send these controls into 3rd page in ?  There are a number of ways storing values. Check out: http://msdn2.microsoft.com/en-us/library/75x4ha6s.aspxhttp://www.csharphelp.com/archives/archive207.html Thanks,Karan~ Remember To Mark The Post(s) That Helped You As The ANSWER ~ Hi, Welcome to asp.net forums. Now as far as your requirements goes, the first thing that strikes me is that 100 controls are way too many to kee...

Page To Page
Hi How can i call to a Text that has been written in a different page(in a TextBox). I want to call him to make a SELECT quastion. Thank's....

Page Down / Page Up
I have tried this on the google groups - advanced search, but get nothing. So, here is what I am trying to do ... PB 11.1 / Postgres : List datawindow on top with all desired records. : Form Datawindow on bottom showing the detail information for the selected record : I share the datawindow buffer with the detail and manage the scrolling accordingly. Now, in the detail window, I have multiple line 'comment' fields. when the cursor is in the comment field (again multiple lines that usually scroll outside the 'box'), the user wants to be able to hit page down /...

page up / page down
Name: Kyle Morrison Email: kymorris_at_cisco.com Product: Deer Park Summary: page up / page down Comments: page up and page down do not work mac osx 10.3.9 Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+ ...

Control of the page and the controls on a page
I am building a web app that has some pages that are public and some that are only available based on subscription. Could someone explain the best way (infrastructure wise) how to control whether a server control is visible or enabledand how to control whether a page is viewable or not based on the user and whether or not the user is logged in (or not). If a user is not logged in I would like some controls to be visible but disabled. I also have to control the URL's in case a person learnsthe URL and tries to type it in. My question is more towards how to do this database wise. I am u...

Calling a method from a control page on the axpx page where the control page exists.
Hello,  I have an .aspx page that has a method called grdMain_DataBind().  I have a control page that loads within the aspx page which has its own logic.  I have a button on my control page called "SAVE".  How can I call the method grdMain_DataBind thats in my aspx logic from the control that exists on that page when I click SAVE button.  Is there a way? If I were you, I'd simply create a "Save" Event within your control. When the Button in your control is pressed, in the Click handler for that Button you can raise the event. Then, within t...

Problem Accessing Page Controls in a page that has a master page.
Hi,  I have a problem with accessing the controls of a page that has a masterpage. I am trying to access the Page.Controls from the code behind in the class file but no controls are returned.I can access single controls (ex. txtAddress.Text) but not the whole array of controls (ex. Page.Controls).  The controls structure is..                                 MasterPage  >  PlaceHolder > MyPage.aspx &n...

if page = current page redirect to other page
 hi ppl.. i wan to redirect my page to another page once read the page display is not the correct page. For example. once it reads the page is page1.aspx it will automatically redirect to page2.aspx  In your page load you can do the following: if(Request.Url.Contains("page1.aspx") { Response.Redirect("~/page2.aspx"); }    i tried but if(Request.Url.contains ... url does not have contains .. i am using C#i tried Request.Url.Equals ... also not working.. ...

convertion from page to content page or from user control to content page
Hi, I have converted an asp.net 1.1 application to 2.0.  Now what I am looking for some enhancement.  I added a master page and now I want to add other pages as content pages. but those pages which I am converting into content have some user control. Now either I can convert those user control to content pages ( which i want to look for if it is possible),  Or I am thinking i shouldn't convert those user control to content pages cause they might be just good. So looking for some of those people opinion who have worked through this so can I get opinion here please.thanks&nb...

Content controls have to be top-level controls in a content page or a nested master page that references a master page.
Why in the world am I getting this error? The solutions I have seen either don't apply or don't work.  Here is my master page code:<%@ Master Language="C#" AutoEventWireup="false" CodeFile="TechLMSMasters/MainSide.master.cs" Inherits="MainSide" %> <%@ Register TagPrefix="usercontrol" TagName="Search" Src="~/library/uc/Search.ascx" %> <%@ Register TagPrefix="usercontrol" TagName="UserName" Src="~/library/uc/UserNameDisplay.ascx" %><!DOCTYPE html PUBLI...

Passing a variable from page to page, OPTIONS? From VB page to C# page.
I currently use a querystring... would like this to be in the background however... can't (or would like to avoid) post because of how page 1 creates the variable... (its done with an old embeded activeX object - I'm grabbing an NDS login name, so the page has to post to create the variable, which is done via javascript)... suggestions? I looked into viewstate... but cant seem to get it to work... I'm guessing because its page only, yes?Thanks, JKC- Be a good developer, follow the W3C whenever you can. You can use a session variable.On page 1 set the session variable li...

cannot view controls in mastre page and other pages with master page vwd 2008
I have written web application in visual web developer 2005. when I open this application in V W D 2008 I cannot view controls in master page. when open Masterpage and click on desgin it display images , tree, lables  and etc. then disappeared   same thing happend for pages with master page. why this is happening. in source code some cssclass are underlined says class or css value not defined. Does this the origin of the problem   It is difficult to say without seeing page markup. Can you post page HTML here?Thanks--------------------------------------------------...

ERROR Content controls have to be top-level controls in a content page or a nested master page that references a master page.
This all used to work until about 5 minutes ago. Did I change something? For some reason I am now getting this error: Content controls have to be top-level controls in a content page or a nested master page that references a master page. What I have:  I have a masterpage inside of a directory. That directory is a first level directory with its own web.config file....The whole thing is protected by the web.config file above it (in the main public directory). That main public directory has a masterpage as well. I am not currently linking the two masterpages together becuase...

Error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.
when I make a directory on my root, and in that directory I put a masterpage and a web form ... I get always an error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.   Does somebody know what the problem is ? Is it possible you can't set a masterpage in a directory ... ?Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) i've founded ... I had to nest my masterpage ...Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) Hi Joeri Pansaerts, I am receiving the same error as the one posted her...

Web resources about - Paging Paging Paging - asp.net.presentation-controls

Paging - Wikipedia, the free encyclopedia
In computer operating systems , paging is one of the memory-management schemes by which a computer can store and retrieve data from secondary ...

Gang Gang: Paging Harry Hockley, the hero of Queanbeyan's 1915 fatal fire
On August 26, 1915, Harry Hockley ran into a burning house in Queanbeyan and snatched an 18-month-old child to safety. The child, Eunice Freebody, ...

Fortune 500 Issue Boasts Record Ad Paging
The economy may still be in recovery, but the indicators are good for Fortune magazine: this year's Fortune 500 has the most ad pages of any ...

Cloud-Paging Start-Up Numecent Emerges From Stealth, Spins Off Gaming Unit Approxy
... I’m told there are 107 individual shareholders in the company. So what does Numecent’s Technology do? It calls its technology “cloud paging,” ...

Paging Orwell
Robert Colls, who recently wrote a book on the author, sighs , “Orwell, you should be living at this hour”: A medium ranking, 30 something year ...

Paging Tom Cruise: With Wifarer, Indoor Mapping Becomes A Reality
... be used by the masses. Still, I find it exciting, in a purely futurist way. For more information on Wifarer, visit their website . Paging ...

Paging scientist Ringwald: Could quasars become standard candles?
Composite optical and X-ray image of quasar 3C 186, one of the most distant yet observed. Regular fluctuations in quasar light production could ...

Paging Mr. Vader: Gemballa creates the Mirage GT Matte Edition
Gemballa Mirage GT Matte Edition Click above for a high-res galleryFirst, there was the Gemballa Mirage GT Carbon Edition, soon followed by the ...

Paging Jesus Christ in Terminal 3
[caption id="attachment_63964" align="alignleft" width="392"] Are you there, Jesus? A floor tile at Phoenix Sky Harbor International Airport. ...

Paging the Graphically Inclined
Is there anyone out there with some artistic skills who would like to fix the current banner and rework the balloon man for the new website? ...

Resources last updated: 12/9/2015 8:45:15 AM