Solved

Enable sorting on DataGrid and some other stuff

Posted on 2006-06-26
2
579 Views
Last Modified: 2008-01-09
How can I do the following in my DataGrid using VB.NET:

1) Enable sorting by ID, FirstName, LastName
2) Cache for 15 minutes
3) Display only 5 records at at ime


My code-behind (which is calling a method from my class to fill the dataset):


Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim da As New TestShoppingCart.User
DataGrid1.DataSource = da.GetActiveUsers
DataGrid1.DataBind()
End Sub

Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChanged
End Sub

End Class
0
Comment
Question by:dba123
2 Comments
 
LVL 15

Accepted Solution

by:
justinbillig earned 300 total points
ID: 16985607
read this article from 4guysfromrolla about the asp data grid

http://aspnet.4guysfromrolla.com/articles/040502-1.aspx

it is a long read but it is well worth it and you will be well versed in the datagrid.

0
 
LVL 26

Assisted Solution

by:Rejojohny
Rejojohny earned 200 total points
ID: 16989217
have a look at www.datagridgirl.com/articles.aspx for all kinds of examples on datagrid .. it contains many examples of sorting and paging datagrids which is what u require

as for caching for 15 minutes... use cache.insert .. and set the slidingexpiration property to 15 minutes .. i do not have MSDN on this machine and so cannot give u the exact syntax ..
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Code works but it's slow 28 70
ck editor is taking too much time to be loaded in asp 1 16
imap read mail 1 27
asp enable view state 1 23
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now