|
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Pages_Default : System.Web.UI.Page
{
private Base Orders;
protected void Page_Load(object sender, EventArgs e)
{
Pages_MasterGrid myMaster = (Pages_MasterGrid)this.Master;
myMaster.mainTitle = "Order Information";
Orders = myMaster.myObject;
}
protected void Page_Init(object sender, System.EventArgs e)
{
Pages_MasterGrid myMaster = (Pages_MasterGrid)this.Master;
myMaster.GridChanged += FillControls;
myMaster.ChildGridChanged +=FillChildInfo;
}
protected void FillControls(object sender, MasterGridEventArgument e)
{
MultiView1.ActiveViewIndex = 0;
DataSet dsOrders ;
if (Session["Orders"] == null)
{
dsOrders = Orders.getParentData();
Session.Add("Orders", dsOrders);
}
else
{
dsOrders = (DataSet)Session["Orders"];
}
ClearView();
FillView(View1, dsOrders.Tables["orders"].Select("OrderID = " + e.ParentGridInfo));
}
protected void FillChildInfo(object sender, DetailGridEventArgument e)
{
MultiView1.ActiveViewIndex = 1;
//MenuImageChange(1);
DataSet dsProduct = Orders.getChildData(e.ParentGridInfo);
if (dsProduct == null)
{
ClearView(View2);
}
else
{
FillView(View2, dsProduct.Tables["Products"].Select("ProductID = " + e.detailGridInfo));
}
}
public static void FillView(View view, DataRow[] dr)
{
foreach (Control control in view.Controls)
{
if (control.GetType() == typeof(TextBox))
{
string fieldName = control.ID.Trim();
GeneralFunctions.SetTextBoxValue((TextBox)control, dr[0][fieldName]);
}
}
}
public void ClearView(View view)
{
foreach (Control control in view.Controls)
{
if (control.GetType() == typeof(TextBox))
{
GeneralFunctions.SetTextBoxValue((TextBox)control, "");
}
else if (control.GetType() == typeof(CheckBox))
{
GeneralFunctions.SetCheckBoxValue((CheckBox)control,false);
}
}
}
public void ClearView()
{
foreach (View view in MultiView1.Views)
{
ClearView(view);
}
}
}
|
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 have graduated from SirSyed university of engineering and technology in year 2005. Working on Microsoft Platform for 3 years.
I like to work on new technologies. Always keen to learn new orientation in software design. Design patterns is the area for which i am looking to work on.