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的更多相关文章

  1. PHP+Mysql+easyui点击左侧tree菜单对应表名右侧动态生成datagrid加载表单数据(二)

    关于tree菜单生成,参考我的另一篇博文地址tree 菜单 实现功能:点击左侧tree菜单中的table,右侧通过datagrid加载出该表对用的所有数据 难点:获取该表的所有列名,动态生成datag ...

  2. jquery easyui datagrid 加每页合计和总合计

    jquery easyui datagrid 加每页合计和总合计 一:效果图 二:代码实现 这个只有从后台来处理 后台根据rows 和page两个参数返回的datatable 命名为dt 然后根据dt ...

  3. jquery easyui使用(三)······datagrid加载数据(已解决)

    <div id="table_Data"> </div> $("#table_Data").datagrid({ toolbar: '# ...

  4. easyui datagrid 加载两次请求,触发两次ajax 请求 问题

    datagrid初始化的时候请求两次URL 两种情况 1. <table id="gridview" class="easyui-datagrid"> ...

  5. 解决easyui datagrid加载数据时,checkbox列没有根据checkbox的值来确定是否选中

    背景:   昨天帮朋友做一个easyui datagrid的小实例时,才发现easyui datagrid的checkbox列,没有根据值为true或false来选中checkbox,当时感觉太让人失 ...

  6. easyui datagrid加载数据的三种方式

    1.加载本地数据 var obj = {"total":2,"rows":[{id:"1",name:"一"},{id: ...

  7. Easyui datagrid加载数据时默认全选的问题

    问题描述: 最近使用 Easyui datagrid 展示数据,之前一直使用很正常,今天出现了一个怪异问题 加载数据后,只要点击选中列 ck 的任意行或多行,再刷新时整个datagrid的所有数据都 ...

  8. wpf DataGrid加载行号

    <DataGrid Name="tkdg" HorizontalContentAlignment="Center" AutoGenerateColumns ...

  9. easyui datagrid加载成功之后选定并获取首行数据

    //加载成功之后,选定并获取首行数据 onLoadSuccess:function(data){ alert("grid加载成功"); var rows=$('test').dat ...

随机推荐

  1. 【RabbitMQ】 Routing

    Routing 之前的章节里我们构建了一个简单的日志系统.我们可以广播所有的日志消息给所有的接收端. 本节我们将给它添加一个新特性 - 我们将允许只订阅一个消息的子集.例如,我们只将关键的错误消息定位 ...

  2. 为什么要用专业的ETL

    这两天一直在思考一个问题,为什么要用专业的etl工具进行数据清洗,原因如下: ETL负责将分布的.异构数据源中的数据如关系数据.平面数据文件等抽取到临时中间层后进行清洗.转换.集成,最后加载到数据仓库 ...

  3. linux 消息队列的限制

    消息队列的系统限制 作者:冯老师,华清远见嵌入式学院讲师. 消息队列是System V的IPC对象的一种,用于进程间通信,会受到系统的限制,本文主要描述了三个限制.第一:议个消息的最大长度:第二:消息 ...

  4. js弹出新窗口居中

    方式1: <script language="javascript"> var newUrl = <%=newUrl % > //window.locati ...

  5. Unity3D Asset Server搭建 .

    Unity3D    Asset Server搭建 本文转载于 http://blog.csdn.net/amazonzx/article/details/7980117,非常感谢! Asset Se ...

  6. PYTHON之批量文件指定字符串替换

    在工作应用中,运维自动化的基础是标准化. 而标准化的工作,是难点,在公司相关部门的配合. 那么,在有标准化之后,相应的部署脚本,就比较好写了. 贡献一个在类似环境下可以运用的东东.. 当然,可以写得更 ...

  7. IBM Websphere 说明文档

    http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.nd.doc%2Finfo%2F ...

  8. Linux&shell之Shell脚本

    写在前面:案例.常用.归类.解释说明.(By Jim) 使用多条命令shell脚本的关键是可以输入多条命令,甚至可以将一条命令的结果传递给另一条命令.date;who(两个命令shell脚本的写法) ...

  9. bzoj2789

    这种题目肯定是先把一个当做标准串根据标准串得出一个初始串是怎么排列的,然后求逆序对数就可以了但是因为有重复,我们不知道标准串中的一个数到底是由原来哪个字母交换来的但是我们可以猜,不难贪心得到对于标准串 ...

  10. Linux Kernel ‘kvm_set_memory_region()’函数本地提权漏洞

    漏洞名称: Linux Kernel ‘kvm_set_memory_region()’函数本地提权漏洞 CNNVD编号: CNNVD-201306-343 发布时间: 2013-06-20 更新时间 ...