Help!
I have a dynamically created page and in the 'Page_Load' event I create several WebCombos (and other controls) and add them to a WARP on the page. The WebCombos have 'EnableXmlHTTP' set TRUE, and are populated using associated 'InitializeDataSource' and 'DataBound' subroutines. The number of WebCombos and the amount of data displayed in each means that the Page_Load isn't too quick.
In the client-side 'BeforeDropDown' event I use 'selectWhere' to implement some filtering. However, when this is used it causes a full page postback which kicks off the Page_Load event, loading all WebCombos again, and kicking off their associated 'InitializeDataSource' and 'DataBound' subroutines all over again.
I can put up with a slow intial loading of the page, but not while the user is simply using the WebCombos. Can anyone suggest how I can improve things, or if I've got something wrong in my implementation? I thought using a WARP would prevent a full page postback.
Thanks
Hello
I would suggest making one step at a time
1) Create a simple web application project, put a WebCombo control, set 'EnableXmlHTTP' = true', populate a dataset during Page_Init
When the page is initially loaded, bind the dataset to the webCombo during the Page_Load() event
When selectWhere() is initiated from JavaScript, an Ajax postback occurs and in this case bind the dataset to the webCombo during the InitialiseDataSource() event
That's normal and that doesn't mean a full page load. It's just an Ajax load on demand (partial postback), if you look at the Back button of your browser, it should be greyed.
2) After you understand how selectWhere() works, then think about an WARP Panel, but leave this until you understand how the Ajax enabled webCombo works
See an example below:
protected void Page_Init(object sender, EventArgs e)
{
webCombo1.InitializeDataSource += new Infragistics.WebUI.WebCombo.InitializeDataSourceEventHandler(webCombo1_InitializeDataSource);
if (!IsPostBack)
//prepare the dataset as necessary
// maybe store the dataset in Session or Cache
mDSCustomers = new DataSet();
mDSCustomers.ReadXml(HttpContext.Current.Server.MapPath("~/Xml/Customers.xml"));
}
else
//prepare the dataset as necessary, maybe reload the dataset from Session or Cache
//in this example, just recreate the dataset
protected void Page_Load(object sender, EventArgs e)
//add the webCombo columns
//todo
webCombo1.DataSource = mDSCustomers;
webCombo1.DataMember = mDSCustomers.Tables[0].TableName;
webCombo1.DataValueField = "CustomerCode"; //column used for the code of the selected item
webCombo1.DataTextField = "CustomerName"; //column that will be displayed
webCombo1.DataBind();
private void webCombo1_InitializeDataSource(object sender, Infragistics.WebUI.WebCombo.WebComboEventArgs e)
if (webCombo1.DataSource == null && mDSCustomers != null)
webCombo1.DataSource = mDSCustomers.Tables[0];
protected void webCombo1_InitializeLayout(object sender, LayoutEventArgs e)
webCombo1.EnableXmlHTTP = true;
Thanks. Your suggestion, albeit with a little tinkering, seems to have helped.