|
saintfrosty, I'm not very deep in learning .net, I don't understand a lot of the principles, otherwise I can post the original code and give me some directions.
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ajax;
using ZhuJi.Common;
using ZhuJi.Facade;
using Globals = ZhuJi.Resources.Globals;
namespace ZhuJi.Web
{
/// <summary>
/// Summary description of WebForm2.
/// </ summary>
public class WebForm2: Page
{
protected PlaceHolder PlaceHolder1;
private void Page_Load (object sender, EventArgs e)
{
Utility.RegisterTypeForAjax (typeof (WebForm2));
CreateDownList ("0", "ddl0");
}
[AjaxMethod ()]
public void CreateDownList (string id, string ddlName)
{
PlaceHolder1.Controls.Add (EventControls.CreateControl ("System.Web.UI.WebControls.DropDownList", ddlName));
DropDownList ddl = (DropDownList) FindControl (ddlName);
Category category = new Category ();
string whereValue = string.Concat ("ParentId =", id);
ddl.DataSource = category.ListAll (whereValue, "Path");
ddl.DataTextField = "Title";
ddl.DataValueField = "Id";
ddl.DataBind ();
ddl.Items.Insert (0, new ListItem (Globals.ResMan ("Category.Root"), id));
ddl.Attributes.Add ("onChange", "LoadCategory (this)");
}
#region Web Form Designer Generated Code
protected override void OnInit (EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Forms designer.
//
InitializeComponent ();
base.OnInit (e);
}
/// <summary>
/// Designer supports required methods-don't use code editor to modify
/// The contents of this method.
/// </ summary>
private void InitializeComponent ()
{
Load + = new EventHandler (Page_Load);
}
#endregion
}
} |
|