DropListDown控件的数据绑定例子
来源:互联网 发布:申请网络空间 编辑:程序博客网 时间:2024/05/16 13:47
先在页面中将droplistdown控件AutoPostBack=true,然后开始绑定数据
1、Controller中执行绑定
ddlTransactor.DataBind(UIHelper.GetDepartName());
2、UIHelper中整理需要的数据
public static DDLBindInfo GetDepartName()
{
DDLBindInfo info = new DDLBindInfo()
{
TextField = "DepartName",
ValueField = "DepartID",
DataSource = BaseDataHelper.GetDepartName(),
TopItemText = "请选择所办理部门"
};
return info;
}
3、BaseDataHelper中通过bll层取得详细的数据
internal static DataSet GetDepartName()
{
BLL.DepartName bll = new BLL.DepartName();
string where = "LevelID='4'";
return bll.GetList(where);
}
4、bll层控制dat层与数据库交互
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
return dal.GetList(strWhere);
}
5、dat层从数据库中提取数据
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select DepartID,......) ");
strSql.Append(" FROM DepartName,DeaprtNickName,LevelID ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
return DbHelperSQL.Query(strSql.ToString());
}
1、Controller中执行绑定
ddlTransactor.DataBind(UIHelper.GetDepartName());
2、UIHelper中整理需要的数据
public static DDLBindInfo GetDepartName()
{
DDLBindInfo info = new DDLBindInfo()
{
TextField = "DepartName",
ValueField = "DepartID",
DataSource = BaseDataHelper.GetDepartName(),
TopItemText = "请选择所办理部门"
};
return info;
}
3、BaseDataHelper中通过bll层取得详细的数据
internal static DataSet GetDepartName()
{
BLL.DepartName bll = new BLL.DepartName();
string where = "LevelID='4'";
return bll.GetList(where);
}
4、bll层控制dat层与数据库交互
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
return dal.GetList(strWhere);
}
5、dat层从数据库中提取数据
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select DepartID,......) ");
strSql.Append(" FROM DepartName,DeaprtNickName,LevelID ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
return DbHelperSQL.Query(strSql.ToString());
}
0 0
- DropListDown控件的数据绑定例子
- LookUpEdit控件数据绑定例子
- 数据绑定的例子
- WPF 中DataGrid控件绑定数据的一个例子
- DropDownList控件的数据绑定
- ComboBox控件的数据绑定
- ListBox控件的数据绑定
- ComboBox控件的数据绑定
- DataGridView控件的数据绑定
- DropDownList控件的数据绑定
- ListBox控件的数据绑定
- XML绑定数据岛的例子
- 一个绑定amf数据的例子
- AngularJs对象数据的绑定例子
- html5的data-*数据绑定小例子
- AngularJS例子 数据绑定
- WPF 数据控件绑定数据与 ASP.NET数据控件绑定数据的区别
- WPF 数据控件绑定数据与 ASP.NET数据控件绑定数据的区别
- 几种随机生成器
- 记一次公司mysql的安装,解压安装方式
- position属性absolute与relative 详解
- display:none与visible:hidden的区别
- 在php中页面跳转(跳转到其他页面或者当前页面),可以用这种写法
- DropListDown控件的数据绑定例子
- 非RAC环境如何设置Oracle以spfile启动
- Unicode与ANSI字符集
- activity 的configuration监听
- jquery那点事之写选项卡
- Android打开各种类型的文件方法总结
- PostgreSQL执行计划
- 代码中出现的奇怪问题原因
- Android注册监听函数的NullPointerException