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>