0

I'm having issue on asp:dropdownlist and search result display. One of the issues is "Cannot have multiple values on DropDownList", so, I looked it up and most of the suggestion were the use of ClearSelection method.

I added it and the error message was gone, however, the next issue is the search result was not displaying.

When I debugged the code, it was able to pull up the data and it was bounded to the datasource. I have also added try-catch to see if there any exception, however it passed the try block successfully.

Here is the code snippet for ddl.ClearSelection

try
        {
            this.ddlSearchBy.ClearSelection();
            this.ddlSearchBy.Items.FindByValue(csrSearchFormFilter.SearchBy).Selected = true;
        }
        catch (Exception e)
        {

        }

Then, here is code snippet for data binding and display:

public void Configure()
    {
        if (this.DataSource != null && this.DataSource.Count == 1)
        {
           //do code here
        }

        this.webpartSearchResults.DataSource = this.DataSource;
        this.webpartSearchResults.DataBind();
    }

Is the ClearSelection method can affect other webparts? If so, is there a way to eliminate the error on DropDownList without affecting the search result?

Any insight is much appreciated. Thanks for your time.

0

this forum is for SharePoint admin issues, as your issue is about SharePoint development, you can create a new thread on stackoverflow which is a development forum.

  • hello, thank you @Kally_SPWX i have transferred it to its proper forum. – newbie Jan 16 '18 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.