GridView中DropDownList
<asp:TemplateField HeaderText="下拉框">
<ItemTemplate>
<cc1:MyDropDownList ID="ddlPKG" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPKG_SelectedIndexChanged" ToolTip='<%# Eval("id") %>' >
</cc1:MyDropDownList>
</ItemTemplate>
</asp:TemplateField>
protected void gvXyPhone_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex != -1)//注意加上这句就OK
{
DropDownList ddlPhoneKG = e.Row.FindControl("ddlPKG") as DropDownList;
ddlPhoneKG.Items.Add(new ListItem("无", "无"));
}
DataRowView drv = (DataRowView)e.Row.DataItem;
if (drv != null)
{
ddlPhoneKG.SelectedValue = drv.Row["kongguan"].ToString();
}
}
//下拉框的值改变
protected void ddlPKG_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlTKG = (DropDownList)sender;
string sqlUpdate = "update table1 set kongguan='" + ddlTKG.SelectedValue + "' where id='" + ddlTKG.ToolTip + "'";
sqlHelp.inUpDelInfo(sqlUpdate);
//GridView.DataSource = dt2;
//GridView.DataBind();
}
GridView中DropDownList的更多相关文章
- Js获取Gridview中Dropdownlist选中状态
在Gridview中加入Dropdownlist模板列,加入DropDownlist 是一种常用的操作,其中涉及到如何获取选择项和Gridview重新绑定两个要点. 如图 前台代码如下 <%@ ...
- GridView中两个DropDownList联动
GridView中两个DropDownList联动 http://www.cnblogs.com/qfb620/archive/2011/05/25/2057163.html Html: <as ...
- GridView 中绑定DropDownList ,下拉框默认选中Label的值
在GridView中,我们 有时候要绑定值. 前台绑定的代码可以这样 <asp:TemplateField HeaderText="当前状态" ItemStyle-Horiz ...
- Gridview中Datakeys 通过主键取得各列的值。
首先在初始化Gridview时候定义主键的数组. GridViewTeacherStudent.DataKeyNames=new string[] {"courseId",&quo ...
- GridView中显示时间日期格式问题
以下都是GridView基本常用的日期,时间格式 形式 语法 结果 注释 数字 {0:N2} 12.36 数字 {0:N0} 13 货币 {0:c2} $12.36 货币 {0:c4} $ ...
- 实现CheckBox的三种选中状态(全选、半选、不选)在GridView中模拟树形的功能
度娘了很多帖子,只说三种状态要用图片替换来做,但没找到有用的例子,被逼自己写了一个 三方控件肯定是很多的,如jstree,可以直接用 由于公司的UDS限制,不能上传图片,只能文字说明了. 就是要在gr ...
- Gridview中几个Button的应用
gridview中有三种方式添加button的应用,CommandField.ButtonField.TemplateField中加Button这三种方式.三种方式都可以实现同样的功能,但在实现某些功 ...
- DEV控件中GridView中的复选框与CheckBox实现联动的全选功能
最初的界面图如图1-1(全选框ID: cb_checkall DEV控件名称:gcCon ): 要实现的功能如下图(1-2 1-3 1-4)及代码所示: 图1-2 图1-3 图1-4 O(∩_∩ ...
- .net中从GridView中导出数据到excel(详细)
1,创建数据源 找到要导出的GridView中的数据. 2,重写VerifyRenderingInServerForm方法. public override void VerifyRenderingI ...
随机推荐
- linux服务之tuned
RHEL/CentOS 在 6.3 版本以后引入了一套新的系统调优工具 tuned/tuned-adm,其中 tuned 是服务端程序,用来监控和收集系统各个组件的数据,并依据数据提供的信息动态调整系 ...
- IntelliJ 2016.02设置maven 阿里云加速
修改maven 的setting.xml <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf ...
- [zz] 混合高斯模型 Gaussian Mixture Model
聚类(1)——混合高斯模型 Gaussian Mixture Model http://blog.csdn.net/jwh_bupt/article/details/7663885 聚类系列: 聚类( ...
- node.js和express.js安装和使用步骤 [windows]
PS: NODEJS:https://nodejs.org NPM:https://www.npmjs.com/ 一.node.js安装与配置 到https://nodejs.org/en/downl ...
- How to configure Veritas NetBackup (tm) to write Unified and Legacy log files to a different directory
Problem DOCUMENTATION: How to configure Veritas NetBackup (tm) to write Unified and Legacy log files ...
- ORA-00245: control file backup failed; target is likely on a local file system
ORACLE11G RAC alert报错如下:Errors in file /u01/app/oracle/diag/rdbms/dljyzs/dljyzs1/trace/dljyzs1_ora_8 ...
- Redirecting Console.WriteLine() to Textbox
I'm building this application in Visual Studio 2010 using C#. Basically there are 2 files, form1.cs ...
- Struts2中的异常处理
因为在Action的execute方法声明时就抛出了Exception异常,所以我们无需再execute方法中捕捉异常,仅需在struts.xml 中配置异常处理. 为了使用Struts2的异常处理机 ...
- Ubuntu-tomcat7目录
ubuntu下通过apt-get install tomcat7方式安装的tomcat目录分布如下,做个记录: user@myserver:/var/lib/tomcat7$ ls -lttotal ...
- Sqoop2入门之导入关系型数据库数据到HDFS上(sqoop2-1.99.4版本)
sqoop2-1.99.4和sqoop2-1.99.3版本操作略有不同:新版本中使用link代替了老版本的connection,其他使用类似. sqoop2-1.99.4环境搭建参见:Sqoop2环境 ...