protected void sgvFile1_RowDataBound(object sender, GridViewRowEventArgs e)
{
DropDownList ddlAM = ((DropDownList)e.Row.FindControl("ddlAM"));
ddlAM.SelectedIndexChanged += new EventHandler(ddlAM_SelectedIndexChanged);
ddlAM.SelectedIndex = -;
ddlAM.Items.FindByValue(labAM.Text).Selected = true; }
protected void ddlAM_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlAM = (DropDownList)sender;
string i = ddlAM.ID.Substring(ddlAM.ID.LastIndexOf("ddlAM") + , ddlAM.ID.Length - );
bool flage = false;
GridViewRow row = (GridViewRow)ddlAM.NamingContainer;
Label labAMPersonID = (Label)row.FindControl("labAMPersonID" + i); try
{
UpdateKaoQin(labAMPersonID.Text, ddlAM.SelectedValue);
}
catch
{
ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "result", "alert('修改失败!');", true);
}
}

GridView中给DropDownList动态绑定数据,及选择列表值后自动更新数据库的更多相关文章

  1. (转).net控件dropdownlist动态绑定数据

    DropDownList控件的使用(数据绑定)(.net学习笔记二)(2006-10-12 07:28:49) 转载   分类:.net学习笔记 一.在页面初始化时候将集合绑定到DropDownLis ...

  2. .net控件dropdownlist动态绑定数据 ----转

    DropDownList控件的使用(数据绑定)(.net学习笔记二) 一.在页面初始化时候将集合绑定到DropDownListpublic void Page_Load(Object src.Even ...

  3. GridView 中绑定DropDownList ,下拉框默认选中Label的值

    在GridView中,我们 有时候要绑定值. 前台绑定的代码可以这样 <asp:TemplateField HeaderText="当前状态" ItemStyle-Horiz ...

  4. Gridview中Datakeys 通过主键取得各列的值。

    首先在初始化Gridview时候定义主键的数组. GridViewTeacherStudent.DataKeyNames=new string[] {"courseId",&quo ...

  5. Node.js中的express框架,修改内容后自动更新(免重启),express热更新

    个人网站 https://iiter.cn 程序员导航站 开业啦,欢迎各位观众姥爷赏脸参观,如有意见或建议希望能够不吝赐教! 以前node中的express框架,每次修改代码之后,都需要重新npm s ...

  6. WPF中为ListView动态绑定数据(可参考)

    GridView gv = new GridView(); DataTable dt = fieldManageBLL.GetFieldManage(moduleName); for(int i=0; ...

  7. 为GridView中的DropDownList赋值

    <Bda:GridView ID="gvMessage" runat="server" Height="70px" Width=&qu ...

  8. Gridview中绑定DropDownList

    1.页面代码                         <asp:TemplateField HeaderText="等级">                   ...

  9. GridView中实现DropDownList联动

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...

随机推荐

  1. Python——网络编程,如何避免死锁?

    问题描述:什么是死锁? 死锁发生在当一个服务器和客户端同时试图往一个连接上写东西或同时从一个连接上读的时候.在这种情况下,没有进程可以得到任何数据(如果它们都正在读),因此,如果它们正在写,向外的bu ...

  2. jquery autoComplete的使用代码一则

    $(function() { $("#vipCustomer").autocomplete({ source : function(request, response) { $.a ...

  3. Quartz的cron表达式 (spring定时器 crontab)

    http://tangshuo.iteye.com/blog/184824 表达式位数最少六位,如每天凌晨一点启动:"0 0 1 * * ?" 顺序按   秒 分 时 日期 月份 ...

  4. radiusd cisco限速问题

    http://puck.nether.net/pipermail/cisco-bba/2011-February/001349.html

  5. 利用HTML5 Canvas和Javascript实现的蚁群算法求解TSP问题演示

    HTML5提供了Canvas对象,为画图应用提供了便利. Javascript可执行于浏览器中, 而不须要安装特定的编译器: 基于HTML5和Javascript语言, 可随时编写应用, 为算法測试带 ...

  6. 水滴状的自己定义视图,让您摆脱单调的Dialog

    转载请注明出处:王亟亟的大牛之路 如今各种各样的进度条的呈现方式各种各样,我们老旧的条状条子和转圈圈的方式已经无法满足我们的业务需求,今天亟亟上的是一个水滴状循环滚动的一个自己定义视图.你能够把他用在 ...

  7. &quot;《 Serial Drivers 》by Alessandro Rubini&quot; 学习笔记

    Introduction to "serial device driver"     (My study note) 膜拜大神的作品. Standing on the should ...

  8. win8 应用商店。 app下载的音乐和视频软件能打开,不能正常播放 解决方法

    win8 应用商店.app下载的音乐和视频软件能打开,不能正常播放 安装完win8之后,下载了PPS,可以正常播放.但是过了几天之后,就不能播放了,又从网络上下载了其他的音乐和视频相关的软件, 都不可 ...

  9. php会话全揭秘

    一:php中sesion的配置 二: php手册中的函数 1:bool session_start ( void )  启动新会话或者重用现有会话 当会话自动开始或者通过 session_start( ...

  10. leetCode 30.Substring with Concatenation of All Words (words中全部子串相连) 解题思路和方法

    Substring with Concatenation of All Words You are given a string, s, and a list of words, words, tha ...