Solved

Enable sorting on DataGrid and some other stuff

Posted on 2006-06-26
2
581 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

789 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