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.

Generic Dropdown

Thread ID:

Created:

Updated:

Platform:

Replies:

99066 Apr 22,2011 06:39 AM Jun 28,2011 02:48 AM ASP.NET Web Forms (Classic) 9
loading
Tags: Tools
Nitin
Asked On April 22, 2011 06:39 AM

Hi,

I am looking to add items in generic dropdown and change the selected value on runtime, but I didn't see any suitable property for the same.

Please let me guide how I can achieve it.

Thanks
Nitin


Varalakshmi R.S [Syncfusion]
Replied On April 25, 2011 09:02 AM

Hi Nitin,

Thanks for your interest in syncfusion products.

If your intention is to highlight the selected item in the items added to the GenericDropDownControl then it can be achieved by enabling the selected property of the corresponding item. Here we have created a simple sample for adding TreeView in GenericDropDown control and by default the items with value 7 will be selected then during run time the item will be highlighted based on the items selected. Please find the below code snippet to achieve this,

[VB]
Protected Sub tree_NodeSelected(ByVal sender As Object, ByVal e As Syncfusion.Web.UI.WebControls.Tools.TreeViewNodeSelectEventArgs)
GenericDropDown1.Text = TreeView1.SelectedNode.Text //displays the selected item text in GenericDropDown1
End Sub

Protected Sub TreeView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.DataBound
findValue(TreeView1.Items)
End Sub
Protected Sub findValue(ByVal items As TreeViewItemCollection)
For Each item As TreeViewNode In items
If (item.Value.Equals("7")) Then
item.Selected = True //highlight the item which has the value “7”
GenericDropDown1.Text = item.Text
End If
If (item.HasSubNodes) Then
findValue(item.Items)//this continues recursively to highlight the items
End If
Next

End Sub


Kindly download the sample from the following link,
generic-760246203.zip

Please try the sample and let us know if this helps.

Regards,
Varalakshmi R.S



Chetan Thummar
Replied On June 21, 2011 06:07 AM

Hello,

I have code to display checkbox list in dropdown as your sample application.

its nice and bind properly what i want.

but there is problem with checked items in dropdown that cant get the value of checked items and i want to pass it to controller.

how to do same?????

please solve this problem.....
thanks in advance....


Vignesh [Syncfusion]
Replied On June 22, 2011 04:37 AM

Hi Nitin,

Before we providing you a solution, could you please confirm with us that is your requirement in MVC?. So that we could able to provide you a better solution.

Please let us know your concerns.

Regards,
Vignesh


Chetan Thummar
Replied On June 25, 2011 02:10 AM

Hi,

Chetan here and sure that i m using MVC so please give me a solusin in MVC...

Thank you.


Chetan Thummar
Replied On June 25, 2011 02:12 AM

Hi,

Chetan here and sure that i m using MVC so please give me a solusin in MVC...

Thank you.


Chetan Thummar
Replied On June 25, 2011 02:12 AM

Hi,

Chetan here and sure that i m using MVC so please give me a solusin in MVC...

Thank you.


Vignesh [Syncfusion]
Replied On June 27, 2011 07:24 AM

Hi Chetan,

Thanks for the Update.

To send the selected value from the drop down to the controller use the following code to achieve it.


[Javascript]
$.ajax({
type: 'Post',
data: { input: selText },
dataType: "json",
success: function (result) {

obj.setText(result.input);
}

});



Also I have created a simple sample and attached in the below link for your reference,

GenericDropDown-259114197.zip

Please try this and let us know if you have any queries.

Regards,
Vignesh



Chetan Thummar
Replied On June 28, 2011 01:33 AM

Thank you very much for solve my problem.



Vignesh [Syncfusion]
Replied On June 28, 2011 02:48 AM

Hi Chetan,

Thanks for the Update.

Please let us know if you have any other queries. We will happy to help you out.

Regards,
Vignesh


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.

;