Solved

Enable sorting on DataGrid and some other stuff

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get Reply from SSIS to intranet site when finished 3 34
Json and asp.net mvc 2 46
How to deploy to IIS 7 on 2008R2 server with DUO 2-step login? 2 37
Replace &lt; with < 14 57
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

862 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

23 Experts available now in Live!

Get 1:1 Help Now