Implementing AutoPostBack on Infragistics WebCombo

Posted by andy gaskell on Apr 1st, 2006

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: , ,

Making the webbrowser control synchronous

Posted by andy gaskell on Apr 1st, 2006

Here’s a little trick if you need to make the WebBrowser control behave synchronously instead of having to hookup to the DocumentCompleted event. Attaching/unattaching from that event makes code pretty messy. Anyway, here’s my solution – it works :)

this.webBrowser.Navigate(url);

while (this.webBrowser.ReadyState != WebBrowserReadyState.Complete)
{
     Application.DoEvents();
}

So simpo.

Technorati Tags: ,

Variable variables in PHP

Posted by andy gaskell on Apr 1st, 2006

While learning PHP I came across a feature that’s completely new to me – variable variables. With variable variables you can dynamically assign variable names and reference those dynamic names. I understand how they work, I’m just not sure how useful they’d be. I suppose an array of variable variables could pass as a poor man’s Hashtable or NameValueCollection.

Here’s some code that demonstrates variable variables:

<?php
     $recipe = "beans";
     $$recipe = "& big ideas";

     echo("$recipe $beans");
     echo("<br/>");
     echo("$recipe ${$recipe}");
?>

Here’s the output:

beans & big ideas
beans & big ideas

Technorati Tags: ,

« Prev

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 Buy Generic Methotrexate No Prescription Viagra Walmart Best Online Pharmacy For Cialis Generic Buying Femara Canadian Pharmacy No Prescription Needed Alesse Purchase No Prescription Mircette Cheapest Levitra From India Buy Tablets Actonel Online No Prescription Antibiotics Online Ordina Viagra Tricor No Prescription Acheter Diabecon Viagra Ou Equivalentes Amoxil Buy Online Cheap Cafergot Order Buy Best Generic Baclofen Tablets Without a Prescription Seroquel Order Online No Perscription Purchase Lexapro Online Without Prescription Buy Viagra Online Tabs Cheap Generic Substitute Viagra Purchase Lexapro Purchase Viagra In Australia Buy Viagra In Canada Fast Canadian Pharmacy Toronto Zithromax Order Bupropion Next Day Delivery Canadianlab Viagra Tablets Buy VentolinZovirax And Cost Levitra 20mg Tablets Generic Viagra Free Pills Viagra Professional Buy