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") %>'
随机推荐
- BAT CMD 批处理文件脚本 -1
http://www.cnblogs.com/linglizeng/archive/2010/01/29/Bat-CMD-ChineseVerion.html 1. 综述 ...
- ios 框架学习笔记
ios主要的系统层次: 一.Cocoa Touch 层:创建应用程序主要使用的框架. 1.关键技术: AirDrop:实现应用间通信. Text Kit:处理文本和排版. UIKit Dynamics ...
- Reactjs相比较原生方案是绝对的快吗?哪些情况下React有优势
作者:尤雨溪链接:http://www.zhihu.com/question/31809713/answer/53544875来源:知乎著作权归作者所有,转载请联系作者获得授权. 1. 原生 DO ...
- Bootstrap 基础
一种前端开发框架,如同YUI 下载源码找开后,其文件结构如下: bootstrap/├── css/│ ├── bootstrap.css│ ├── bootstrap.min.css│ ...
- setDepthStencilState
cgfx->hlsl StencilFunc={always,1,0xff}->setDepthStencilState(DepthState,0) StencilFunc={always ...
- Ignore files which are already versioned
If you accidentally added some files which should have been ignored, how do you get them out of vers ...
- mysql中文乱码解决
有时服务端显示中文正常,但在客户端却显示?乱码, 首先,系统字符集, echo $LANG vi .bash_profile export $LANG=en_us.utf8 另一个是, mysql的, ...
- C# 常用的工具类
编码解码.图片与byte[].日志文件写入和读取 /// <summary> /// 将字符串编码为Base64字符串 /// </summary> /// <param ...
- 关联式容器(associative containers)
关联式容器(associative containers) 根据数据在容器中的排列特性,容器可分为序列式(sequence)和关联式(associative)两种. 标准的STL关联式容器分为set( ...
- Selenium WebDriver 中鼠标和键盘事件分析及扩展(转)
本文将总结 Selenium WebDriver 中的一些鼠标和键盘事件的使用,以及组合键的使用,并且将介绍 WebDriver 中没有实现的键盘事件(Keys 枚举中没有列举的按键)的扩展.举例说明 ...