---
title: "给下打列表框增加数据"
author: "cab0605"
date: "2011-04-21T20:40:09Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2011-04-21T20:40:09Z"
id: 1011688
url: "https://cab0605.iteye.com/blog/1011688"
---

//先定义来源

Maticsoft.BLL.ud\_pub\_water\_type type\_bll = new Maticsoft.BLL.ud\_pub\_water\_type();

 

//给指定的下拉列表增加数据

       public void Load\_type\_name()  
        {  
            this.ddl\_water\_type.Items.Clear();  
            DataSet ds = new DataSet();  
            ds = type\_bll.GetAllList();  
            int li\_count;  
            li\_count = ds.Tables\[0].Rows.Count;  
            for (int i = 0; i &lt; li\_count; i++)  
            {  
                string ls\_column\_name;  
                string ls\_column\_value;  
                ls\_column\_name = ds.Tables\[0].Rows\[i]\["type\_name"].ToString();  
                ls\_column\_value = ds.Tables\[0].Rows\[i]\["type\_id"].ToString();  
                this.ddl\_water\_type.Items.Add(new ListItem(ls\_column\_name, ls\_column\_value));  
            }  
        }