很久没有写ASP.NET了,今天有看到论坛上一个问题:
"两个dropDownList和一个GridView,已经进行了数据绑定,现在想让第一个下拉菜单的数据改变时,第二个下拉菜单自动变到相应的数据,同时选中gridview中相对应的行,不知道如何实现,很急,求大神相助"
其实,实现起来算得上简单,下面先从准备数据开始,创建一个对象Customer:
source code:
using System; using System.Collections.Generic; using System.Linq; using System.Web; /// <summary> /// Summary description for Customer /// </summary> namespace Insus.NET { public class Customer { private int _CustomerID; private string _CustomerName; private string _PID; private bool _IsActived; public int CustomerID { get { return _CustomerID; } set { _CustomerID = value; } } public string CustomerName { get { return _CustomerName; } set { _CustomerName = value; } } public string PID { get { return _PID; } set { _PID = value; } } public bool IsActived { get { return _IsActived; } set { _IsActived = value; } } } }