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

Dropdown List gets empty on Postback.

Thread ID:





121710 Jan 19,2016 06:03 AM UTC Jan 20,2016 05:28 AM UTC ASP.NET Web Forms 1
Tags: DropDownList
Asked On January 19, 2016 06:03 AM UTC


I am facing an issue where I am binding a datasource to dropdownlist from Access Database. 

Following works :

protected void Page_Load(object sender, EventArgs e)
            ddlDepartment.DataSource = dtDept;

The above code binds the data to dropdownlist every time the page loads i.e on every postback.

But if i check the isPostback Property of Page and want to load the data only on the initial Page Load, the data gets lost after a postback event.

protected void Page_Load(object sender, EventArgs e)
                 ddlDepartment.DataSource = dtDept;

Hence, unlike asp.net Dropdownlist, I cannot populate the Dropdown on first page load, I need to repopulate it on every page load and that has become an overhead. And this is the case with every other syncfusion control as well.. may it be Grid, Treeview, ListView, Accordian etc.

Please let me know if there is any work around for this. 

Gaurang Kelkar

Ezhil S [Syncfusion]
Replied On January 20, 2016 05:28 AM UTC

Hi Gaurang Kelkar,

Thank you for contacting Syncfusion support.

In order to maintain the DataSource bound after postback, we suggest you to use DataSourceCachingMode property with enum value ViewState or Session. This will maintain the data bound values in our controls after post back. Refer the following code sample,

    <ej:DropDownList ID="DropDownList1" runat="server" DataTextField="text" DataValueField="value" DataSourceCachingMode="ViewState" >


       <br />
    <ej:TreeView ID="tree" runat="server" DataIdField="id" DataHasChildField="child" DataParentIdField="pid" DataTextField="name"DataSourceCachingMode="ViewState"></ej:TreeView>

Refer the following API reference: http://help.syncfusion.com/CR/cref_files/aspnet/ejweb/Syncfusion.EJ~Syncfusion.JavaScript.DataSourceCachingMode.html 
Sample link: http://www.syncfusion.com/downloads/support/directtrac/149809/ze/Dropdown_postback1226813838 

Please let us know if you have any other queries.

Ezhil S


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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