Implementing AutoPostBack on Infragistics WebCombo
I use Infragistics NetAdvantage control suite for UI development at work. If you hate UI development like me, these tools can help out tremendously. While working with their WebCombo control, a much more powerful version of the ASP.Net DropDownList control – I noticed the WebCombo was sorely missing is the AutoPostBack property.
I’ll be explaining how to implement an AutoPostBack property on a UserControl that contains a single Infragistics WebControl.
On your HTML page, add the following tag after the end of your opening WebCombo tag:
<CLIENTSIDEEVENTS AfterSelectChange="itgtbl_needPostBack('{0}')"></CLIENTSIDEEVENTS>
Create a basic AutoPostBack property on the codebehind of your UserControl.
protected bool autoPostBack;
public bool AutoPostBack
{
get{return this.autoPostBack;}
set{this.autoPostBack = value;}
}
Now you need to add a method that either sets up your WebCombo so that it automatically posts back, or does not generate any client code to post back. You can decide when you want to call this method in your code
private void SetupAutoPostback()
{
if(this.autoPostBack)
{
string gridClientID = string.Empty;
foreach(Control control in this.YOUR_COMBO_HERE.Controls)
{
Infragistics.WebUI.UltraWebGrid.UltraWebGrid grid = control as Infragistics.WebUI.UltraWebGrid.UltraWebGrid;
if(grid != null)
{
gridClientID = grid.ClientID;
break;
}
}
this.YOUR_COMBO_HERE.ClientSideEvents.AfterSelectChange = string.Format(this.YOUR_COMBO_HERE.ClientSideEvents.AfterSelectChange, gridClientID);
}
else
{
this.YOUR_COMBO_HERE.ClientSideEvents.AfterSelectChange = string.Empty;
}
}
Run your page – your combo should now post back automatically when the selected index changes.
Technorati Tags: Infragistics, AutoPostBack, WebCombo
December 4th, 2007 at 6:47 am
Hello sir,
Where can i call this function “SetupAutoPostback”.I call this function in ultrawebgrid click event but it is not working.
Actually i have webcombo1 which is placed inside ultrawebgrid in first cell.I need webcombo1_selectedindexchange during the postback.But it did’nt.What shall i do.& where can i call these functions such as SetupAutoPostback,AutoPostBack
December 6th, 2007 at 6:19 pm
Hi
I am having the oposite problem. The WebCombo posts back everytime I select an item from it. I am using NetAdvantage for .NET 2007 Volume 1 CLR 2.0.
Is there a way to turn off AutoPostback?
Thanks
Fred
January 23rd, 2008 at 11:44 am
I am using custom control hence not able add the following line html tag
How to implement the AutPost Back in custom control by inheriting the infragistics webcombo.
Any help is appreciated.
September 19th, 2008 at 7:39 am
See how confusing infragistics controls are,, the author says there is no autopostback then Fred says his posts back,,,, I want to screeeeeeeeeeem
October 22nd, 2009 at 4:25 am
if you don’t add clientsideevent for “AfterSelectChange” and add a server event handler the webcombo will auto postback
October 22nd, 2009 at 4:32 am
even if you just add server event handler it will auto postback unless you stop the postback in the client event