Technical support This forum is closed.
Version 1.x > Technical support > BUG: setting CMSSeachDialog.SearchScope causes error View modes: 
User avatar
Member
Member
wtijsma - 5/4/2005 11:47:01 AM
   
BUG: setting CMSSeachDialog.SearchScope causes error
Hi,

When trying to programmatically set the CMSSearchDialog.SearchScope causes an exception:

Specified argument was out of the range of valid values. Parameter name: ExactPhrase
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: ExactPhrase

Source Error:


Line 193: {
Line 194: get { return ((SearchModeEnum) (Int32.Parse(mDrpSearchMode.SelectedValue))); }
Line 195: set { mDrpSearchMode.SelectedValue = Convert.ToString(value); }
Line 196: }
Line 197:


Source File: C:\Projecten\Website\trunk\src\CMSControls_cs\CMSSearchDialog.cs Line: 195

Stack Trace:


[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: ExactPhrase]
System.Web.UI.WebControls.ListControl.set_SelectedValue(String value) +152
Kentico.CMS.CMSControls.CMSSearchDialog.set_SearchMode(SearchModeEnum value) in C:\Projecten\Website\trunk\src\CMSControls_cs\CMSSearchDialog.cs:195
Vitsol.Web.Search.Page_Load(Object sender, EventArgs e) in C:\Projecten\Website\trunk\src\Vitsol\Search.aspx.cs:30
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750



User avatar
Member
Member
wtijsma - 5/4/2005 11:47:26 AM
   
Re: BUG: setting CMSSeachDialog.SearchScope causes error
sorry, meant SearchScope

User avatar
Member
Member
wtijsma - 5/4/2005 11:48:23 AM
   
Re: BUG: setting CMSSeachDialog.SearchScope causes error
Ehrhh again! should be SearchMode ofcourse

User avatar
Guest
admin - 5/10/2005 7:32:02 PM
   
Re: BUG: setting CMSSeachDialog.SearchScope causes error
Hi Wiebe,

could you please send the code you use to set the value? I would guess that this is caused by the fact that you try to set the SearchMode before the dropdownlist items were loaded.

Thank you.

Best Regards,

User avatar
Member
Member
wtijsma - 5/11/2005 9:51:30 AM
   
Re: BUG: setting CMSSeachDialog.SearchScope causes error
private void Page_Load(object sender, EventArgs e)
{
CMSSearchDialog1.SearchMode = SearchModeEnum.ExactPhrase;
}


You're probably right but not having loaded data shouldn't influence the component's behaviour right? when else should I set it?

User avatar
Guest
admin - 5/14/2005 11:05:39 AM
   
Re: BUG: setting CMSSeachDialog.SearchScope causes error
Hi Wiebe,

I've just tried to do the same, but this code works fine for me. Do you have any other code that works with the search dialog control in your page?

I have also checked the source code of the dialog and it loads the drop down list values in the constructor, so I'm not sure why it doesn't work for you now.

Could you please possibly try to debug the code to see what happens?

Thank you.

Best Regards,

User avatar
Member
Member
wtijsma - 5/17/2005 11:53:17 AM
   
Re: BUG: setting CMSSeachDialog.SearchScope causes error
No, it's absolutely this line.

It's the property declaration that's erroneous anyway:

public SearchModeEnum SearchMode
{
get { return ((SearchModeEnum) (Int32.Parse(mDrpSearchMode.SelectedValue))); }
set { mDrpSearchMode.SelectedValue = Convert.ToString(value); }
}

It converts the enum to a string (resulting in the string "ExactPhrase") while the return type of the property parses the selected value as an Int32.

Wiebe

User avatar
Guest
admin - 5/19/2005 2:19:27 PM
   
Re: BUG: setting CMSSeachDialog.SearchScope causes error
Hi Wiebe,

Thank you very much for the details. It's possible that VB.NET interprets it differently to C#. We will check this and fix it in the nearest release.

Thank you.

Best Regards,