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

The selected item does not display in textbox of GenericDropDown

Thread ID:

Created:

Updated:

Platform:

Replies:

107668 Mar 11,2013 11:14 PM UTC Mar 13,2013 04:40 AM UTC ASP.NET MVC (Classic) 3
loading
Tags: Tools
Marie CG
Asked On March 11, 2013 11:14 PM UTC

The selected item (Name) does not display in textbox of GenericDropDown.  The initial value appeared in the textbox but when I make different item in the popup panel, the new item does not show up.  I do not have images in my selection list but I don't think that would make it not working.  Help!

In Controller, I have the following:

            ViewBag.selectedBeforeEvents = db.Ratings.Where(e => e.Type == 1 && e.Scale == threat.LOIBeforeEvent).Single().Name;
            ViewBag.LOIBeforeEvents = db.Ratings.Where(e => e.Type == 1).ToList();

In View, I have the following:

 @{List<gThiraMetrix.Models.Rating> LOIBeforeEventList = ViewBag.LOIBeforeEvents;
       string selectedBeforeEvent = ViewBag.selectedBeforeEvents;
       Html.Syncfusion().GenericDropDown("LOIBeforeEventPopup")
                .DataSource(LOIBeforeEventList)
                .Text(selectedBeforeEvent)
                .BindTo(bind=>
               bind.Text("Name")
                        .Id("RatingID")).Render();}


Meena [Syncfusion]
Replied On March 12, 2013 05:15 AM UTC

Hi Marie,

 

Thanks for contacting Syncfusion forums.

 

Your requirement of updating the text of selected item in GenericDropdown textbox can be achieved using the “setText()” client side method. Please refer the below code snippet,

 

<code>

@{Html.Syncfusion().GenericDropDown("myGenericDropDown").ClientSideOnClick("ClientSideOnClick").Render();}                    // This event will be triggered on item select

 

[Script]

 

function ClientSideOnClick(sender, args) {

        var text = "";

        if (args._target.nodeName.toLowerCase() == "img")

            text = $(args._target.parentNode).text().trim();

        else

            text = args._text;

        sender.setText(text);                                                                                                  // This method will set the text in textbox

    }

 

</code>

 

We have also prepared a simple sample with GenericDropdown with databinding as per your code snippet and it can be downloaded from the below link.

 

Kindly have a look at the sample and let us know if your requirement is met.

 

Regards,

Meena



F107668_GDD_42d16956.zip

Marie CG
Replied On March 12, 2013 06:57 PM UTC

Thank you.  It is working.
Marie

Meena [Syncfusion]
Replied On March 13, 2013 04:40 AM UTC

Hi Marie,

 

Thanks for the update.

 

We are glad to know that your issue has been solved. Kindly get back to us if you need further assistance.

 

We will be happy to help you out.

 

Regards,

Meena


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.

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

;