Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » Ajax » Controls » Downloads
 
Add your own
alternative version
Go to top

A lightweight AJAX.NET-enabled grid control

, 28 Jun 2008
A lighweight approach to creating AJAX.NET-enabled grids, with advanced functionality built in.
SampleDB.zip
Tackle.mdf
Source.zip
SCRUM2
App_Code
App_Data
Bin
AjaxControlToolkit.dll
AJAXExtensionsToolbox.dll
Microsoft.Web.Preview.dll
System.Web.Extensions.dll
css
img
add.GIF
cancel.GIF
cog.gif
cogwarning.gif
magnifyingglass.gif
save.GIF
sortdown.gif
sortup.gif
Thumbs.db
wait.gif
warning.gif
Script
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;


public partial class Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // uncomment the following line to always choose the default profile
        //Session["GridProfile"] = AjaxGrid.DefaultProfile;
        List<AjaxGrid.GridProfileData> profile = (List<AjaxGrid.GridProfileData>)Session["GridProfile"];
        if (profile == null)
        {
            // normally, the code to load profile data would be done from a login page
            // where the user could be uniquely identified and their profile loaded from the database
            // if a null profile in the session is detected in this page, normally redirect to the login page 
            BinaryFormatter formatter = new BinaryFormatter();
            using(MemoryStream memStream = new MemoryStream())
            {
                // example serialise to a memory stream
                formatter.Serialize(memStream,AjaxGrid.DefaultProfile);
                memStream.Seek (0, SeekOrigin.Begin);
                // example deserialise from a memory stream
                profile = (List<AjaxGrid.GridProfileData>)formatter.Deserialize(memStream);
                Session["GridProfile"] = profile;
            }
        }
        profile[AjaxGrid1.GridId].SelectProc = OnSelect;
        profile[AjaxGrid1.GridId].ValidateProc = OnValidate;
    }

    // a link cell has been seleted
    public static void OnSelect(int databaseId)
    {
        // do some actions when a link has been selected...
    }

    // a cell has been updated
    public static string OnValidate(string columnName, string value)
    {
        return null; // validation accepted
    }

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Simon Gulliver
CEO
United Kingdom United Kingdom
Check me out at LinkedIn: http://uk.linkedin.com/pub/simon-gulliver/20/303/251

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 28 Jun 2008
Article Copyright 2008 by Simon Gulliver
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid