|
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.
I'am a freelance software developer, located at Freiburg i. Br., Germany. My main domain is designing and developing Web applications based on the ASP.NET technology. Further main interests are. Sustainable and agile software architectures, Domain Driven Design (DDD). I'am a certified SCRUM Master.