Shalin Gajjar
Shalin Gajjar

Reputation: 239

how to render properly all drop down list with jquery function in asp.net 3.5

i just made one user control with Drop Down list. here i'm using msdropdownlist for binding images with it. now i just want to when page load then all Drop Down list renders with msdropdownlist one of jquery function. I know this one can made with jquery + html - select selector function. now here my problem is when user selects any drop down list then selected index changed event fires after that it's doesn,t rendered with msdropdownlist jquery function.

here i include my jquery :

<script type="text/javascript" src="../js/jquery.dd.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function(e) {
    try {
        $("#<%=DDL_Column_List.ClientID %>").msDropDown();
        $("#<%=DDL_Categorynames.ClientID %>").msDropDown();
        $("#<%=DDL_Usernames.ClientID %>").msDropDown();
        $("#<%=DDL_StatusList.ClientID %>").msDropDown();
        $("#<%=DDL_GroupList.ClientID %>").msDropDown();
        $("#<%=DDL_UserList1.ClientID %>").msDropDown();
        $("#<%=DDL_StatusList1.ClientID %>").msDropDown();
        $("#<%=DDL_GroupList1.ClientID %>").msDropDown();
} catch (e) {
alert(e.message);
}
});
</script>

here i just want to make one common function for all drop down list found per page. then it's getting upper function. And it renders properly if user has been getting change item selection.

please help me....

Upvotes: 0

Views: 559

Answers (1)

Matas Vaitkevicius
Matas Vaitkevicius

Reputation: 61401

I apologise if I misunderstood what you are trying to accomplish, but do you mean this?

$('select').msDropDown();

Edit: Put both scripts in your page then pick one that fires after postback and replace console.log with code above. You can see log messages fired by opening your page in Google Chrome then going to console (Ctrl+Shift+I)

$(window).load(function () {
   console.log("window loaded");
});
$(function () {
  console.log('document ready');
});

Upvotes: 1

Related Questions