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. Image for the cookie policy date

Two GenericDropDown How to achieve linkage?

Two GenericDropDown   实现联动效果??

1 Reply

SP Sunil Prabakar C Syncfusion Team June 27, 2013 08:48 AM UTC

Hi Customer,

 

Thanks for contacting Syncfusion support.

 

Since we are not able to get your requirements clearly. We make simply the hierarchy between two generic dropdown to achieve linkage between two generic dropdown. To achieve this use the  “OnTextChanged” serverside event for primary dropdown. And using this event bind the values for secondary dropdown. Please refer the following code snippet.

 

<Code>

 

[ASPX]

 

<syncfusion:GenericDropDown ClientObjectId="Generic" AutoPostBackOnTextChanged="true"

            ID="GenericDropDown1" runat="server" Width="150px" OnTextChanged="GenericDropDown1_TextChanged">

 

[CS]

 

   protected void GenericDropDown1_TextChanged(object sender, Syncfusion.Web.UI.WebControls.Shared.GenericDropDownTextChangeEventArg e)

    {

        if (GenericDropDown1.Text == "Tools")

        {

            TreeViewNode node1 = new TreeViewNode();

            node1.ID = "tools1";

            node1.Text = "ASP";

            TreeViewNode node3 = TreeView2.Items[0];

            node3.Text = "Tools";

            node3.Items.Add(node1);

        }

        else

        {

            gdd.Text = "-Select-";

            TreeView2.Items.Clear();

        }

    }

 

</Code>

 

For your reference we have prepared the sample to exhibit this behavior, its available in below link.

 

GDD.zip

 

If your requirement is different form hierarchy generic dropdown, kindly let us know with further more details.


Thanks & Regards

Sunil Prabakar C


Loader.
Live Chat Icon For mobile
Up arrow icon