We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting selecteditems on serverside

Thread ID:

Created:

Updated:

Platform:

Replies:

118700 Apr 1,2015 10:51 AM UTC Apr 3,2015 02:43 PM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: MultiSelectionDropDown
Graham Gardner
Asked On April 1, 2015 10:51 AM UTC

I have a Multiselectiondropdown control binded to a datatable, on the page load I want to be able to pre select values in this control. My code currently seems to do this successfully on the server side however the selecteditems do not appear in the control on the client side. see code snippets below. probably something simple I am not doing but can't see it myself!
 
c#
following code is in page_load within a if (!Page.IsPostBack) check...

DataTable dtMP = PortalData.GetTableData("tsResults", strFilterCriteria + " GROUP BY TradeSite");
msddfMP.DataSource = dtMP;
msddfMP.DataTextField = "TradeSite";
msddfMP.DataValueField = "TradeSite";
msddfMP.DataBind();
msddfMP.CheckBoxListRepeatColumns = 4;
msddfMP.CheckBoxListRepeatDirection = RepeatDirection.Vertical;
msddfMP.PopupPositionVertical = Syncfusion.Web.UI.WebControls.Shared.PopupPositionVertical.Bottom;
foreach (string theMarketplace in PortalData.getCountryMarketplaces(theFilterValue))
{
     ListItem theItem = msddfMP.Items.FindByText(theMarketplace);
     if (theItem != null)
     {
         theItem.Selected = true;
         msddfMP.SelectedItems.Add(theItem);
     }
}
msddfMP.UpdateText();
UpdatePanel15.Update(); //Display selected trade sites for country
.aspx
 
<asp:UpdatePanel ID="UpdatePanel15" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<syncfusion:MultiSelectionDropDown ID="msddfMP"
  TextBoxCssClass="form-control input-sm"
  ButtonCssClass="form-control input-sm"
  ButtonHoverCssClass="form-control input-sm"
  TextBoxHoverCssClass="form-control input-sm"
  runat="server" Width="100%" >
</syncfusion:MultiSelectionDropDown>
</ContentTemplate>
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="btnClear" EventName="Click"  />
  </Triggers>
</asp:UpdatePanel>
 

Ezhil S [Syncfusion]
Replied On April 3, 2015 02:43 PM UTC

Hi Gardner,

Thank you for contacting Syncfusion support.

With reference to the shared code snippet, We are unable to reproduce the reported issue on not displaying the dynamically selected items in MultiSelectDropDown control from code behind. We have prepared sample with the shared code using dummy database and that works fine at our end. Could you please share us defect sample or modify ur sample to issue at our end? So that we can provide you a solution.

We have prepared a simple sample and it can be downloaded from link below:
http://www.syncfusion.com/downloads/support/forum/118700/MultiSelect_f118700_(3)1794106504.zip
Please let us know if you have any other queries.

Regards,
Ezhil S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;