---
title: "jQuery dropdownchecklist doesn't binds data"  
description: "jQuery dropdownchecklist doesn't binds data"  
author: "Anonymous User"  
published: 2014-08-28  
updated: 2014-08-28  
canonical: https://www.mindstick.com/forum/2182/jquery-dropdownchecklist-doesn-t-binds-data  
category: "jquery"  
tags: ["jquery"]  
reading_time: 1 minute  

---

# jQuery dropdownchecklist doesn't binds data

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to bind([select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance)) the some data by [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) from my list but it is not possible.

As you can see I [store](https://www.mindstick.com/articles/13125/tips-to-increase-sales-of-your-woocommerce-store) them by this value:

[DataValueField](https://www.mindstick.com/forum/12846/dropdownlist-datavaluefield-in-asp-dot-net-c-sharp)="ID_PROJECT_TYPE_DETAILS"

## I have the following html code:

```
<asp:ListBox SelectionMode="Multiple" ID="DDLProjectDetails" runat="server"                        DataSourceID="SqlDataSource4" DataTextField="DESCRIPTION"                        DataValueField="ID_PROJECT_TYPE_DETAILS">                                    </asp:ListBox>                     <script type="text/javascript">                        $(document).ready(function () {                            $('#<%= DDLProjectDetails.ClientID %>').dropdownchecklist({ width: 248 });                        });                    </script>                     <asp:SqlDataSource ID="SqlDataSource4" runat="server"                        ConnectionString="<%$ ConnectionStrings:MesarchConnectionString %>"                        SelectCommand="SELECT * FROM [PROJECT_TYPE_DETAILS]"></asp:SqlDataSource>
```

**and the [code behind](https://www.mindstick.com/forum/2199/call-javascript-s-function-from-code-behind) code:**

```
string insCmd = "SELECT ID_PROJECT, ID_PROJECT_TYPE_DETAILS FROM PROJECT_TYPE_DETAILS_OF_PROJECT WHERE ID_PROJECT = @IDProject"; dr = com.ExecuteReader();            while (dr.Read())            {                if (DDLProjectDetails.Items.Contains(DDLProjectDetails.Items.FindByValue(dr.GetInt32(1).ToString())))                    DDLProjectDetails.Items.FindByValue(dr.GetInt32(1).ToString()).Selected = true;            }
```

and doesn't fills my dropdownchecklist like this: enter [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) description here

When I run the [program](https://www.mindstick.com/blog/12337/scaling-up-your-mentorship-program) my DDLProjectDetails doesn't [shows](https://yourviews.mindstick.com/view/81380/new-york-violent-shooting-shows-people-are-not-safe-in-night-life) that has any items.

## Replies

### Reply by Sumit Kesarwani

Hi Ashish, \

string conStr = YOUR_CON_STR;

using (SqlConnection con = new SqlConnection(conStr))

{

SqlCommand com = new SqlCommand("SELECT [idBenutzer], [benutzerName], [aktiv] FROM [Benutzer]", con);

con.Open();

SqlDataReader rdr = com.ExecuteReader();

DropDownList1.DataBind(); // NECESSARY

while (rdr.Read())

{

Debug.WriteLine(rdr.GetInt32(0) + " " + rdr.GetString(1) + " " + rdr.GetBoolean(2));

if (DropDownList1.Items.Contains(DropDownList1.Items.FindByValue(rdr.GetInt32(0).ToString())))

{/* do anything */ }

}

}


---

Original Source: https://www.mindstick.com/forum/2182/jquery-dropdownchecklist-doesn-t-binds-data

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
