datagrid加下拉列表dropdownlist
datagrid中代码:
<asp:datagrid id="dgList" runat="server" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
HorizontalAlign="Center" PageSize="5" AutoGenerateColumns="False" GridLines="Horizontal" CellPadding="1" BackColor="White"
BorderWidth="1px" BorderStyle="None" BorderColor="#E7E7FF" Width=100% OnItemDataBound="DataGrid1_ItemDataBound">
<FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#738A9C"></SelectedItemStyle>
<AlternatingItemStyle BackColor="#F7F7F7"></AlternatingItemStyle>
<ItemStyle HorizontalAlign="Center" ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle>
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="#F7F7F7" BackColor="#4A3C8C"></HeaderStyle>
<Columns>
<asp:templatecolumn HeaderText="状态">
<itemtemplate>
<asp:dropdownlist id="ItemDropDown" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDown_SelectedIndexChanged"/>
</itemtemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button id="SaveButton" Visible="false" runat="server" CommandName="save" Text="保存"></asp:Button>
</ItemTemplate>
</asp:templatecolumn>
<PagerStyle ForeColor="#4A3C8C" BackColor="#E7E7FF" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
private void InitializeComponent()
{
this.dgList.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgList_ItemCommand);
} protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.Item)
{
string[] options = { "", "已通知", "变更邮箱中", "联系不上", "商户要注销" }; DropDownList list = (DropDownList)e.Item.FindControl("ItemDropDown");
list.DataSource = options;
list.DataBind(); TableCell cell = list.Parent as TableCell;
DataGridItem item = cell.Parent as DataGridItem; int index = item.ItemIndex;
list.SelectedValue = item.Cells[].Text;
}
} protected void DropDown_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList list = (DropDownList)sender; TableCell cell = list.Parent as TableCell;
DataGridItem item = cell.Parent as DataGridItem; int index = item.ItemIndex;
string content = item.Cells[].Text;
// DropDownList down = (DropDownList)item.FindControl("ItemDropDown");
string checkState = list.SelectedValue.Trim(); object obj = item.Cells[].FindControl("queryButton");
if (obj != null)
{
Button lb = (Button)obj;
lb.Visible = true;//动下拉列表就显示保存按钮
}
} private void dgList_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string spid = e.Item.Cells[].Text.Trim();
string crt_etime = e.Item.Cells[].Text.Trim();
string state = e.Item.Cells[].Text.Trim(); try
{
if (e.CommandName == "save") ;
…………………………//保存
}
catch (Exception eSys)
{
WebUtils.ShowMessage(this.Page, "保存数据失败!" + eSys.Message);
}
}
datagrid加下拉列表dropdownlist的更多相关文章
- PHP+Mysql+easyui点击左侧tree菜单对应表名右侧动态生成datagrid加载表单数据(二)
关于tree菜单生成,参考我的另一篇博文地址tree 菜单 实现功能:点击左侧tree菜单中的table,右侧通过datagrid加载出该表对用的所有数据 难点:获取该表的所有列名,动态生成datag ...
- jquery easyui datagrid 加每页合计和总合计
jquery easyui datagrid 加每页合计和总合计 一:效果图 二:代码实现 这个只有从后台来处理 后台根据rows 和page两个参数返回的datatable 命名为dt 然后根据dt ...
- jquery easyui使用(三)······datagrid加载数据(已解决)
<div id="table_Data"> </div> $("#table_Data").datagrid({ toolbar: '# ...
- easyui datagrid 加载两次请求,触发两次ajax 请求 问题
datagrid初始化的时候请求两次URL 两种情况 1. <table id="gridview" class="easyui-datagrid"> ...
- 解决easyui datagrid加载数据时,checkbox列没有根据checkbox的值来确定是否选中
背景: 昨天帮朋友做一个easyui datagrid的小实例时,才发现easyui datagrid的checkbox列,没有根据值为true或false来选中checkbox,当时感觉太让人失 ...
- easyui datagrid加载数据的三种方式
1.加载本地数据 var obj = {"total":2,"rows":[{id:"1",name:"一"},{id: ...
- Easyui datagrid加载数据时默认全选的问题
问题描述: 最近使用 Easyui datagrid 展示数据,之前一直使用很正常,今天出现了一个怪异问题 加载数据后,只要点击选中列 ck 的任意行或多行,再刷新时整个datagrid的所有数据都 ...
- wpf DataGrid加载行号
<DataGrid Name="tkdg" HorizontalContentAlignment="Center" AutoGenerateColumns ...
- easyui datagrid加载成功之后选定并获取首行数据
//加载成功之后,选定并获取首行数据 onLoadSuccess:function(data){ alert("grid加载成功"); var rows=$('test').dat ...
随机推荐
- Egret 双端接入爱贝支付遇到的问题
首先要为 egret 工程引入第三方库: Egret 接第三方库:http://edn.egret.com/cn/index.php?g=&m=article&a=index& ...
- [BZOJ 1085] [SCOI2005] 骑士精神 [ IDA* 搜索 ]
题目链接 : BZOJ 1085 题目分析 : 本题中可能的状态会有 (2^24) * 25 种状态,需要使用优秀的搜索方式和一些优化技巧. 我使用的是 IDA* 搜索,从小到大枚举步数,每次 DFS ...
- Cow Exhibition
poj2184:http://poj.org/problem?id=2184 题意:给你n头牛,每头牛有一个S值和一个F值,现在的问题是,要你选出其中的一些牛求出S+T的最大值.但是要保证总的s> ...
- 在SystemOut.log中发现HMGR0152W: 检测到CPU 饥饿的消息 <转载>
今天系统报警了!!!!!顿时人又不好了!!!查看系统日志, 报错如下: Did not receive adequate CPU time slice. Last known CPU usage ti ...
- PPI是什么?如何计算?
PPI,英文全称:pixels per inch,即像素每英寸,也叫像素密度,它是描述在水平的和垂直的方向上,每英寸距离的图像包含的像素(pixel)数目.因此PPI数值越高,即代表显示屏能够以越高的 ...
- c# 基础连接已经关闭: 连接被意外关闭,错误的解决
原文:c# 基础连接已经关闭: 连接被意外关闭,错误的解决 调试一个使用HttpWebRequest模拟提交表单的程序的时候频繁出现上述错误提示,google了一下发现了几个解决方案.1.在appli ...
- Linux&shell之Shell脚本
写在前面:案例.常用.归类.解释说明.(By Jim) 使用多条命令shell脚本的关键是可以输入多条命令,甚至可以将一条命令的结果传递给另一条命令.date;who(两个命令shell脚本的写法) ...
- Git skills in reseting files
How to uncommit files that were committed long time a ago?Note: Since all changes in the current wor ...
- 服务器之间免密码ssh登陆
配置服务器f1(192.168.1.1)与服务器f2(192.168.1.2)之间免密码ssh登陆 一.首先,配置服务器主机名为f1.f2 1.更改/etc/sysconfig下的network文件, ...
- Uncle Sam 山姆大叔
山姆大叔被用来代指“美国”或“美国政府”,主要在美国.英国,尤其是在新闻界中使用较多.“山姆大叔”是美国的绰号,它同自由女神一样,为世人所熟知. 形象 美国的报纸杂志.文学作品和漫画中,经常可以看到“ ...