WebCombo 4 Client Calls SetSelectedIndex And SetSelectedRowByValue Fail Crash

1 reply. Last post: January 11, 2010 5:13 AM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
A YousifMember

I have a custom date control made of 3 components: WebCombo and two WebInput calendars.  The WebCombo gives the user a preset number of options that automatically set the calendars, i.e., Yesterday, Last Week, This Month, etc.

When the user directly sets the dates via the calendars, then we want to automatically set the combo's range type selection to our "Custom" selection.  I'm doing that via a workaround using the code below:

oIsCbo.SelectedIndex = i;
oIsCbo.SetValue(oDRT.dateRangeTypeId);
oIsCbo.SetTextBoxValue(oDRT.dateRangeTypeName);

I'm using this workaround because both SetSelectedIndex and SetSelectedRowByValue crash when called.  Both calls cause the javascript runtime error of "'this.Column.BaseFieldName' is null or not an object."  I'm using an unbound combo and all the UI elements do not post back so everything is done client-side.  We don't want a simple control like this to constantly post back on every little user change.

Here's how our PrismComboBox (derives from ISNet.WebUI.WebCombo.WebCombo) is set up:

this.AllowWildCardSearch = true;
this.EnableViewState = true;
this.Items = new PrismComboBoxItems();
this.Items.ComboBox = this;
this.SelectedItem = new PrismComboBoxSelectedItem();
this.SelectedItem.ComboBox = this;
this.LayoutSettings.AllowAddItem = false;
this.LayoutSettings.AllowFloatingText = false;
this.LayoutSettings.AllowNavigationOnMouseWheel = true;
this.LayoutSettings.AllowTextWrapping = false;
this.LayoutSettings.AlwaysShowAllRowsOnDropdown = true;
this.LayoutSettings.AlwaysShowColumnHeaders = false;
this.LayoutSettings.AlwaysShowHelpButton = false;
this.LayoutSettings.AlwaysShowResultBox = false;
this.LayoutSettings.AlwaysShowSearchButton = true;
this.LayoutSettings.AutoColumnOrdering = false;
this.LayoutSettings.ComboMode = ISNet.WebUI.WebCombo.Mode.SingleColumn;
this.LayoutSettings.EnableAnimation = true;
this.LayoutSettings.EnableSlidingAnimation = true;
this.LayoutSettings.EntryMode = ISNet.WebUI.WebCombo.EntryMode.AutoComplete;
this.LayoutSettings.NoResultFoundAction = ISNet.WebUI.WebCombo.NoResultFoundAction.RevertSelection;
this.LayoutSettings.SearchIconMode = ISNet.WebUI.WebCombo.SearchMode.Text;
this.LayoutSettings.TextBoxMode = ISNet.WebUI.WebCombo.TextboxMode.Editable;
this.UseDefaultStyle = false;
this.SelectionRequired = false;

Here's how the combo box is further configured and populated in our PrismDateRange control:

m_ComboboxRangeType.ID = "ComboBoxRangeType";
m_ComboboxRangeType.AutoPostBack = AutoPostBack;
m_ComboboxRangeType.SelectedIndexChanged += new EventHandler(m_ComboboxRangeType_SelectedIndexChanged);
m_ComboboxRangeType.PreRender += new EventHandler(m_ComboboxRangeType_PreRender);
m_ComboboxRangeType.Enabled = this.Enabled;
m_ComboboxRangeType.DropDownRows = 50;

m_ComboboxRangeType.Width = Unit.Percentage(100);
m_ComboboxRangeType.LayoutSettings.StatusBoxVisible = false;

m_ComboboxRangeType.LayoutSettings.ResultBoxShadow = false;
m_ComboboxRangeType.LayoutSettings.ResultBoxWindowType = ISNet.WebUI.DisplayType.Normal;

m_ComboboxRangeType.Enabled = true;
m_ComboboxRangeType.insertBlankRow = false;
m_ComboboxRangeType.DataValueField = "dateRangeTypeID";
m_ComboboxRangeType.DataTextField = "dateRangeTypeName";

ISNet.WebUI.WebCombo.WebComboColumn colText = new ISNet.WebUI.WebCombo.WebComboColumn();
colText.BaseFieldName = m_ComboboxRangeType.DataTextField;
colText.Bound = false;
colText.ColumnType = ISNet.WebUI.WebCombo.ColumnType.Text;
colText.DataType = "System.String";
colText.Hidden = false;
colText.Name = m_ComboboxRangeType.DataTextField;

ISNet.WebUI.WebCombo.WebComboColumn colValue = new ISNet.WebUI.WebCombo.WebComboColumn();
colValue.BaseFieldName = m_ComboboxRangeType.DataValueField;
colValue.Bound = false;
colValue.ColumnType = ISNet.WebUI.WebCombo.ColumnType.Text;
colValue.DataType = "System.String";
colValue.Hidden = true;
colValue.RenderOnHidden = true;
colValue.Name = m_ComboboxRangeType.DataValueField;

m_ComboboxRangeType.Columns.Add(colText);
m_ComboboxRangeType.Columns.Add(colValue);

m_ComboboxRangeType.PopulateUnboundData(GetTypeTable(),false);

if (CPRISMStrLib.IsVs(ReportCategoryId))
{
    m_ComboboxRangeType.Value = CPRISMStrLib.GetStr(GetDefTable().Rows[0]["defaultDateRangeTypeID"]);
    m_ComboboxRangeType.SelectedValue = m_ComboboxRangeType.Value;
}

I've attached a couple falsh videos of the issue while running in debug mode.  The first one shows the crash when SetSelectedIndex is hit and the value of this.Column.  The second one breaks into my javascript code and also shows the result of SetSelectedRowByDefault in the watch window as well as continuing on and the crash of SetSelectedIndex.

As you can see above, the BaseFieldName is set up so I'm not sure why all that is empty on the client side, i.e., this.Column and so on.  Let me know if you need anything else.

I'm in a bind to get this working please so I can really use a fast resolution.  Thanks a lot.

1 attachment
All times are GMT -5. The time now is 11:05 PM.
Previous Next