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.
Unfortunately, activation email could not send to your email. Please try again.

dr

Thread ID:

Created:

Updated:

Platform:

Replies:

119806 Aug 4,2015 03:19 AM Oct 20,2016 02:35 AM ASP.NET Web Forms 13
loading
Tags: DropDownList
abhijeet
Asked On August 4, 2015 03:19 AM

Sir,

I am working with syncfusion Dropdownlist control in asp.net c# web application.when i am doing postback on first dropdownlist selected index changed  second dropdown get bind but selected value in first dropdown get vanished.
please help in this issue.

Thanks

Ezhil S [Syncfusion]
Replied On August 5, 2015 12:04 PM

Hi  Abhijeet,

Thank you for contacting Syncfusion support.

We are unable to reproduce the issue with maintaining the DropDownList selected value after post back. We have prepared a sample based on the described scenario using DropDownList post back event on index change and in the handler data bind for second DropDownList, after post back selected value is maintained for first DropDownList. Please ensure the attached sample in your end and share us the modified sample to reproduce issue at our end. This will help us provide you an alternative solution.

Sample link: http://www.syncfusion.com/downloads/support/forum/119806/ze/DropDown_f1198061559020414
Please let us know if you have any queries.

Regards,
Ezhil S

abhijeet
Replied On August 6, 2015 03:16 AM

Thank you For Reply
I saw your example but why there is need to bind data source on pre-render event every time.if i do  bind third dropdownlist on value select event of 2nd dropdown do i need to bind datasource to second dropdownlist in pre render event?or can you please send me the example with 3 syncfusion dropdownlist with example?

Saranya Sivakumar [Syncfusion]
Replied On August 7, 2015 09:05 AM

Hi Abhijeet,

Thanks for your update.

As per your requirement we can achieve it by applying “Cascading” support to our Dropdownlist controls or by changing the DataSource of the other Dropdown list by using “OnValueSelect” server side event of our Dropdownlist control.

Applying Cascading support:

We are having an API called “CascadeTo” which is used to map the child Dropdown list in the parent Dropdown list control. By selecting an option in the parent dropdown, the child DropDownList has to load the corresponding value regarding the parent Dropdown. Cascading will be done based on parent id which we are mapping from one Dropdownlist to the other Dropdownlist control. We can also map any field of Dropdownlist control for Cascading support. Here we have mapped “Value” field to perform cascading. We have to bind CascadeTo API in the builder as shown in the following code snippet.

<code>

<p>Binded DataSource using Cascading support</p>

        <div class="control">

            <span class="txt">Select Group</span>

            <ej:DropDownList ID="groupsList" runat="server" DataValueField="key" CascadeTo="MainContent_countryList"></ej:DropDownList>

        </div>


        <div class="control">

            <span class="txt">Select Country</span>

            <ej:DropDownList ID="countryList" runat="server" DataValueField="key" CascadeTo="MainContent_subList" Enabled="false"></ej:DropDownList>

        </div>

       <div class="control">

            <span class="txt">Select Capital</span>

            <ej:DropDownList ID="subList" runat="server" Enabled="false"></ej:DropDownList>

        </div>

</code>

We have give the “ID” of the Dropdownlist control in which it has to be cascaded.

Using OnValueSelect event:

While binding DataSource on “OnValueSelect” server side event we have to bind OnValueSelect event in the builder as shown in the following code snippet.

<code>

<p>Binded DataSource using OnValueSelect</p>

       <div class="control">

            <span class="txt">DropDown 1</span>

            <ej:DropDownList ID="DropDownList1" runat="server" OnValueSelect="DropDownList1_ValueSelect"></ej:DropDownList>

        </div>

       <div class="control">

            <span class="txt">DropDown 2</span>

            <ej:DropDownList ID="DropDownList2" DataTextField="Text" DataIdField="ID" OnValueSelect="DropDownList2_ValueSelect"  runat="server"></ej:DropDownList>

        </div>

           <div class="control">

            <span class="txt">DropDown 3</span>

            <ej:DropDownList ID="DropDownList3" DataTextField="Text" DataIdField="ID"  runat="server"></ej:DropDownList>

        </div>

</code>

Then we have to bind the DataSource to the other Dropdownlist control as shown in the following code snippet.

 <code>

protected void DropDownList1_ValueSelect(object sender, DropdownListEventArgs e)

        {

            this.DropDownList2.DataSource = new DropDownDataSource().GetTreeIconItems().ToList();

        }

protected void DropDownList2_ValueSelect(object sender, DropdownListEventArgs e)

        {

            this.DropDownList3.DataSource = new DropDownDataSource1().GetTreeIconItems().ToList();

        }

</code>

Here on the value selected from first Dropdownlist control DataSource will be bound to the second Dropdownlist control. Then if you select any value from the second Dropdownlist control then the DataSource will be bound to the third Dropdownlist control. For your convenience we have prepared sample by showcasing both the scenario and the same can be downloaded from the following location. http://www.syncfusion.com/downloads/support/directtrac/141807/ze/DDL_Cascading_Web(1)1987184457

Kindly check with the above sample. If still you face the problem then please share us your requirement details along with the replication procedure. This will be helpful for us to serve you better.

Please let us know if you have any other queries.

Regards,

Saranya.S


abhijeet
Replied On August 8, 2015 03:45 AM

Thank you for reply.
i have studied your example it is working with list as data source fine. i  am getting problem while working with Dataset,i am using Dataset for binding the dropdown.
can you please give me the example with dataset with 3 dropdownlist.




Saranya Sivakumar [Syncfusion]
Replied On August 10, 2015 09:17 AM

Hi Abhijeet,

Thanks for your update.

As per your request we have prepared the sample with Dropdownlist control with the DataSet binded and the sample can be downloaded from the following location.

http://www.syncfusion.com/downloads/support/forum/119806/ze/DropDown-467850071

In the above sample we have binded the DataSet as a DataSource for the Dropdownlist control in the code behind as shown in the following code snippet.

<code>

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString);

        protected void Page_Load(object sender, EventArgs e)

        {

            SqlCommand cmd = new SqlCommand("Select * from Employees", con);


            SqlDataAdapter da = new SqlDataAdapter(cmd);


            DataSet ds = new DataSet();

            da.Fill(ds);

            this.employeeList.DataSource = ds.Tables[0];

            this.employeeList.DataBind();

            con.Close();

       }

</code>

Kindly check with the above sample and let us know if you have any other queries.

Regards,

Saranya.S


abhijeet
Replied On August 11, 2015 05:35 AM

Thank you for reply

i have seen your example.but if i will add if(!ispostback) in page load then value of first dropdown get lost.
please tell me why there is need to bind first dropdown on every page load.
protected void Page_Load(object sender, EventArgs e)

        {

if(!ispostback)

{

            SqlCommand cmd = new SqlCommand("Select * from Employees", con);


            SqlDataAdapter da = new SqlDataAdapter(cmd);


            DataSet ds = new DataSet();

            da.Fill(ds);

            this.employeeList.DataSource = ds.Tables[0];

            this.employeeList.DataBind();

            con.Close();

       }

}



Saranya Sivakumar [Syncfusion]
Replied On August 13, 2015 09:05 AM

Hi Abhijeet,

We were able to reproduce the problem (Datasource gets emptied on postback in page load) and we have logged a report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,

Saranya.S


Gaurang
Replied On January 18, 2016 02:39 AM

Hi,

I am facing the same problem as Abhijit and this problems persists for all the controls which we bind using DataSource. Every control needs to be populated on every Postback. Is there any progress on this thread? Have you found any solution to this?

Thanks-
Gaurang Kelkar

Arun Palaniyandi [Syncfusion]
Replied On January 19, 2016 06:56 AM

Hi Gaurang,

Thanks for contacting syncfusion support.

Query:” I am facing the same problem as Abhijit and this problems persists for all the controls which we bind using DataSource. Every control needs to be populated on every Postback. Is there any progress on this thread? Have you found any solution to this?”

The reported issue have been fixed and available in our latest release volume 4, 2016.

Please contact us in future if you have any queries,

Regards,
Arun P

Ishara Kaluarachchi
Replied On October 15, 2016 02:33 AM

Hi Gaurang,

Thanks for contacting syncfusion support.

Query:” I am facing the same problem as Abhijit and this problems persists for all the controls which we bind using DataSource. Every control needs to be populated on every Postback. Is there any progress on this thread? Have you found any solution to this?”

The reported issue have been fixed and available in our latest release volume 4, 2016.

Please contact us in future if you have any queries,

Regards,
Arun P

Is this fixed. if so can you please share the link to download.

Dhivyalakshmi Thirumurugan [Syncfusion]
Replied On October 17, 2016 05:49 AM

Hi Ishara, 
 
We are glad to announce that reported issue has been fixed and please find our latest Essential Studio 2016 Volume 3 Release v14.3.0.49 which can be downloaded under the following link:    
                          
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance  
 
Regards, 
Dhivyalakshmi. 


Ishara Kaluarachchi
Replied On October 18, 2016 03:03 AM

Hi Ishara, 
 
We are glad to announce that reported issue has been fixed and please find our latest Essential Studio 2016 Volume 3 Release v14.3.0.49 which can be downloaded under the following link:    
                          
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance  
 
Regards, 
Dhivyalakshmi. 


Stil the issue is persisting. selected value is initializing in postback.

Kalai Selvi Rajendran [Syncfusion]
Replied On October 20, 2016 02:35 AM

Hi Abhijeet, 
 
Thanks for using Syncfusion products. 
We have created a new incident on behalf of your forum. We suggest you to follow up the incident for further reference using your direct trac account. 
 
Please let us know, if you have any concerns. 
 
 
Regards 
Kalai Selvi 


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.

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.

;