ok, this is my code behind
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Asialife.Life.Data;
using Asialife.Shared;
using Asialife.Shared.Data;
using Asialife.Shared.Entity;
using Asialife.Common.Charts;
namespace Asialife.NetTools
{
public class LILPFUND_CN : System.Web.UI.Page
{
protected Label UserLabel, MessageLabel, TitleLabel;
protected HtmlForm GridForm;
protected DataGrid ILPListing, ILPFundListing;
protected System.Web.UI.WebControls.Image ChartImage;
protected DropDownList PeriodList;
private ILPData ilpData;
private void Page_Load(object sender, System.EventArgs e)
{
initField();
if ((string)Session["dataViewID"]!="LILPFUND")
{
Session["dataViewID"] = "LILPFUND";
GetData();
}
else
{
bindGrid(1);
bindGrid(2);
}
}
private void GetData()
{
ilpData = new ILPData(PeriodList.SelectedItem.Value);
ilpData.Connect();
ilpData.Retrieve();
ilpData.Disconnect();
if (ilpData.IsExist)
{
Session["dataView"] = new DataView(ilpData.ReportTable);
Session["dataView1"] = new DataView(ilpData.ReportTable);
((DataView)Session["dataView"]).RowFilter="Date > '" +
DateTime.Today.AddDays(-8) + "' AND Date < '" + DateTime.Today + "'";
((DataView)Session["dataView"]).RowStateFilter=
DataViewRowState.CurrentRows;
((DataView)Session["dataView1"]).RowFilter="Fund = '" +
((DataView)Session["dataView1"])[0]["Fund"] + "'";
((DataView)Session["dataView1"]).Sort="Date";
((DataView)Session["dataView1"]).RowStateFilter=
DataViewRowState.CurrentRows;
TitleLabel.Text =
((DataView)Session["dataView1"])[0]["Fund"].ToString();
MessageLabel.Text="";
}
else
{
MessageLabel.Text="No Records Found !";
}
bindGrid(1);
bindGrid(2);
}
public void ILPGridPageChanged(object sender,
DataGridPageChangedEventArgs e)
{
ILPListing.CurrentPageIndex = e.NewPageIndex;
bindGrid(1);
}
public void ILPFundGridPageChanged(object sender,
DataGridPageChangedEventArgs e)
{
ILPFundListing.CurrentPageIndex = e.NewPageIndex;
bindGrid(2);
}
public void fundSelected(object sender, DataGridCommandEventArgs e)
{
TitleLabel.Text = e.Item.Cells[1].Text;
((DataView)Session["dataView1"]).RowFilter="Fund = '" +
e.Item.Cells[1].Text + "'";
((DataView)Session["dataView1"]).RowStateFilter=
DataViewRowState.CurrentRows;
bindGrid(2);
}
public void PeriodChanged(object sender, System.EventArgs e)
{
initGrid(1);
initGrid(2);
GetData();
}
private void initGrid(int gridNo)
{
switch(gridNo)
{
case 1:
ILPListing.CurrentPageIndex=0;
ILPListing.DataSource = new DataView();
ILPListing.DataBind();
break;
case 2:
ILPFundListing.CurrentPageIndex=0;
ILPFundListing.DataSource = new DataView();
ILPFundListing.DataBind();
break;
}
}
private void bindGrid(int gridNo)
{
switch(gridNo)
{
case 1:
ILPListing.DataSource = (DataView)Session["dataView"];
ILPListing.DataBind();
break;
case 2:
ILPFundListing.DataSource = (DataView)Session["dataView1"];
ILPFundListing.DataBind();
break;
}
}
private void initField()
{
if (!IsPostBack)
{
PeriodList.Items.Add(new ListItem("Áù¸öÔÂ",
DateTime.Today.AddMonths(-6).ToString("yyyyMMdd")) );
PeriodList.Items.Add(new ListItem("Ò»Äê",
DateTime.Today.AddYears(-1).ToString("yyyyMMdd")) );
PeriodList.Items.Add(new ListItem("Á½Äê",
DateTime.Today.AddYears(-2).ToString("yyyyMMdd")) );
PeriodList.Items.Add(new ListItem("ÎåÄê",
DateTime.Today.AddYears(-5).ToString("yyyyMMdd")) );
}
initGrid(1);
initGrid(2);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!