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
close icon

GenericDropDown Select the first item displayed by default?

GenericDropDown loaded, select the first item?

1 Reply

GA Gurunathan A Syncfusion Team June 24, 2013 11:13 AM UTC

Hi,

Thanks for contacting Syncfusion.

To get the first child text in generic dropdown control when page loads,  we suggest you to use clientside event "ClientSideOnLoaded". Please refer the following code snippet.

<code>

[.cshtml]

@{Html.Syncfusion().GenericDropDown("myDropDown").Width(300).TargetContentId("drop-down-contents").ClientSideOnClick("ClientSideOnClick")

.PopupPanelWidth(300).ClientSideOnLoaded("ClientSideonLoad").Render(); }

 

<script type="text/javascript">

        function ClientSideonLoad(sender, args) {//debugger

           var ddtext = $("div.gddChildItem:first")[0].firstChild.data;

           sender.setText(ddtext);

    }

</script>

</code>

Kindly let us know if you have further queries.

 

Warm Regards,

Gurunathan A



Gdd_dropdown_888bdbdb.zip

Loader.
Live Chat Icon For mobile
Up arrow icon