Can the SelectedIndex of a Smart Search Filter be set dynamically?

Vic Carter asked on July 21, 2014 16:01

I have 3 smart search filters attached to my Smart Search dialog. One is for country with is either AU or NZ. The other two are for AU states and NZ islands which share the same custom table for display and searching purposes. The end goal of this page is to have the list of states/islands show/hide based on the country that has been selected. This was accomplished using the following code:

  protected override void OnLoad(EventArgs e) 
  { 
   base.OnLoad(e);
    CMSAbstractWebPart iFilter = RequestStockHelper.GetItem("iFilter") as CMSAbstractWebPart;
    CMSAbstractWebPart sFilter = RequestStockHelper.GetItem("sFilter") as CMSAbstractWebPart;
      string thisIndex = drpFilter.SelectedIndex.ToString();

      switch (thisIndex)
{
    case "1":
        iFilter.Visible = false;
        sFilter.Visible = true;
        break;
    case "2":
        iFilter.Visible = true;
        sFilter.Visible = false;
        break;
    default:
        iFilter.Visible = false;
        sFilter.Visible = false;
        break;
}  
  } 

This works as expected, however, I need to make sure that whichever search filter dropdown is hidden has been set to its default SelectedItem so that it is not included in the actual search. Is it possible to control this parameter in the same way as I am controlling the visibility? My country selction filter has autopostback set to true so that the page reloads when a value is selected. Any assistance is greatly appreciated.

   Please, sign in to be able to submit a new answer.