GridView CommandArgument 绑定多个参数
我们在使用GridView的时候 有时会需要绑定多个参数
- <asp:GridView ID="gvwVoxListAll" runat="server" Width="100%" AutoGenerateColumns="False"
- AllowPaging="True" OnPageIndexChanging="gvwVoxListAll_PageIndexChanging" ShowCheckBoxColumn="True" HasGridValue="False" NewSortExpression="" OnRowCommand="gvwVoxListAll_RowCommand" BorderColor="#F8D791" CssClass="tableCssBga1">
- <Columns>
- <asp:BoundField DataField="group_placard_id" HeaderText="编号" >
- <HeaderStyle CssClass="header_myinform" />
- <ItemStyle CssClass="header_myinform" HorizontalAlign="Center" VerticalAlign="Middle" />
- <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
- </asp:BoundField>
- <asp:BoundField DataField="group_placard_title" HeaderText="公告标题" >
- <HeaderStyle CssClass="header_myinform" />
- <ItemStyle CssClass="header_myinform" HorizontalAlign="Center" VerticalAlign="Middle" />
- <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
- </asp:BoundField>
- <asp:BoundField DataField="group_name" HeaderText="群组名称" >
- <HeaderStyle CssClass="header_myinform" />
- <ItemStyle CssClass="header_myinform" HorizontalAlign="Center" VerticalAlign="Middle" />
- <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
- </asp:BoundField>
- <asp:BoundField DataField="group_placard_time" HeaderText="发布时间" >
- <HeaderStyle CssClass="header_myinform" />
- <ItemStyle CssClass="header_myinform" HorizontalAlign="Center" VerticalAlign="Middle" />
- <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
- </asp:BoundField>
- <asp:TemplateField HeaderText="操作">
- <ItemTemplate>
- <asp:LinkButton ID="btEdit" runat="server" CausesValidation="False" CommandName="editData"
- CssClass="lb" CommandArgument='<%# Eval("group_placard_id")+","+Eval("group_id") %>'>修改</asp:LinkButton>
- <asp:LinkButton ID="dtDelete" runat="server" CausesValidation="False" CommandName="delData"
- CommandArgument='<%# Eval("group_placard_id") %>' CssClass="lb" OnClientClick='if(confirm("您确定删除吗?"))return true;else return false;'>删除</asp:LinkButton>
- </ItemTemplate>
- <ItemStyle Wrap="False" CssClass="main_myinform" />
- <HeaderStyle Width="20%" CssClass="main_myinform" />
- </asp:TemplateField>
- </Columns>
- <PagerSettings FirstPageText="第一页" LastPageText="最后页" Mode="NextPreviousFirstLast" NextPageText="下一页" PreviousPageText="上一页" Visible="False" />
- <PagerStyle HorizontalAlign="Right" />
- <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" BackColor="#FFF7E5" CssClass="trCssBga1" />
- </asp:GridView>
后置代码:
- protected void gvwVoxListAll_RowCommand(object sender, GridViewCommandEventArgs e)
- {
- if (e.CommandName.Equals("editData"))
- {
- string[] estr = e.CommandArgument.ToString().Split(',');
- string placardID = Convert.ToString(estr[0]);
- string groupID = Convert.ToString(estr[1]);
- Response.Redirect("addPlacard.aspx?mark=edit&placardID=" + placardID + "&groupID=" + groupID);
- }
- if (e.CommandName.Equals("delData"))
- {
- string placardID = e.CommandArgument.ToString();
- int result = placard.DelPlacard(placardID);
- if (result > 0)
- {
- this.bindData();
- new BaseTool().showAlert("删除成功!");
- }
- else
- new BaseTool().showAlert("删除失败!");
- }
- }
GridView CommandArgument 绑定多个参数的更多相关文章
- Freemarker-2.3.22 Demo - No03_使用map绑定多个参数
package No03_使用map绑定多个参数; import java.io.File; import java.io.FileOutputStream; import java.io.Outpu ...
- GridView数据源绑定的一个小问题
在使用GridView绑定数据源的时候,遇到了一个问题,因为图简单,没有注意到,贴出错误截图: 找了半天没有找出错误,在网上找了之后,才发现是一个细节引起的错误. 后台是这样写的: namespace ...
- ASP.NET Gridview数据库绑定支持增删改,记得要完整实现
1.错误情况 /WebSite3"应用程序中的服务器错误. 指定的参数已超出有效值的范围. 参数名: index 说明: 执行当前 Web 请求期间,出现未经处理的异常.请检查堆栈跟踪信息, ...
- [深入Maven源代码]maven绑定命令行参数到具体插件
maven的插件 我们知道Maven具体构建动作都是由插件执行的,maven本身只是提供一个框架,这样就提供了高度可定制化的功能,我们用maven命令执行比如mvn clean package这样的命 ...
- SpringMVC由浅入深day01_12参数绑定(12.1参数绑定过程_12.2默认支持的类型_12.3简单类型)
12 参数绑定 处理器适配器在执行Handler之前需要把http请求的key/value数据绑定到Handler方法形参数上. 注解适配器对RequestMapping标记的方法进行适配,对方法中的 ...
- GridView后台绑定数据列表方法
在很多时候数据绑定都是知道了数据表中的表字段来绑定GridView控件的,那时候我就有个想法希望通过表明来查询数据库中的字段来动态的绑定GirdView控件数据并提供了相关的操作列,在网上找了一些资料 ...
- GridView 中绑定DropDownList ,下拉框默认选中Label的值
在GridView中,我们 有时候要绑定值. 前台绑定的代码可以这样 <asp:TemplateField HeaderText="当前状态" ItemStyle-Horiz ...
- c# Repeater中CommandArgument传多个参数
<ItemTemplate> <div onmouseover="javascript:this.style.cursor='hand ...
- CommandArgument传多个参数
CommandArgument='<%#Eval("id")+","+Eval("interName") %>'
随机推荐
- 【Leetcode】 - Single Number II
Problem Discription: Suppose the array A has n items in which all of the numbers apear 3 times excep ...
- QT模态弹出对话框
QDialog QWidget 默认show()都是非模态 如果需要模态显示, QDialog ==> setModal(true); show(); exec(); QWidget ==> ...
- Problem 1016 咒文卷轴 优先队列+前缀和+rmq
题目链接: 题目 Problem 1016 咒文卷轴 Time Limit: 3000 mSec Memory Limit : 131072 KB 问题描述 小Y 是一个魔法师,有一天他获得了一卷神秘 ...
- Hadoop以及其外围生态系统的安装参考
在研究Hadoop的过程中使用到的参考文档: 1.Hadoop2.2 参考文档 在CentOS上安装Hadoop 2.x 集群: http://cn.soulmachine.me/blog/201 ...
- 【转载】错误 CS0016: 未能写入输出文件“c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/.........dll”--“拒绝访问。 ”
win7中安装asp.net的问题 编译器错误信息: CS0016: 未能写入输出文件问题解决办法 编译错误 说明: 在编译向该请求提供服务所需资源的过程中出现错误.请检查下列特定错误详细信息并适当地 ...
- 汇编中Enter与Leave指令
Enter的作用相当==push ebp和mov ebp,esp 这后面两句大家很熟悉吧?函数开始一般都是这两句 Leave的作用相当==mov esp,ebp和pop ebp 而这后面这两句也很常见 ...
- uva 10330 最大流
拆点 将节点 i 的容量拆成从 i 到 i+n 的边的容量 套用最大流模板 ac #include <cstdio> #include <cstdlib> #include ...
- Install wget in Mac OS X Without Homebrew or MacPorts
May 22, 2012 - 31 Comments The command line tool wget lets you retrieve a group of files from FTP an ...
- UVA 291 The House Of Santa Claus (DFS求一笔画)
题意:从左下方1开始,一笔画出圣诞老人的屋子(不过话说,圣诞老人的屋子是这样的吗?这算是个屋子么),输出所有可以的路径. 思路:贴代码. #include <iostream> #incl ...
- jfinal想用到中大型项目中的项目经验分享
jfinal 用在大项目中更加方便实用,节省无数的开发时间,代码量相对 SSH 减少 75% 至 90%,对于项目结构来说,简单提以下几点: 1:先分大模块,大模块内部可以根据划分的model分成子包 ...