DataGrid超级链接列中绑定一个以上字段
来源:互联网 发布:达特茅斯学院知乎 编辑:程序博客网 时间:2024/05/22 12:20
The DataGrid's HyperLinkColumn column is great to have a column with an hyperlink that points to an Url with a parameter whose value is taken from the data source, but what if you need to build the target Url with more than one parameter taken from the data source? In this case you can use a template column as follows:
<TemplateColumn>
<ItemTemplate>
<asp:HyperLink Runat="server" NavigateUrl='<%# "Details.aspx?EmployeeID=" & Container.DataItem("ID")&"&EmployeeName=" & Container.DataItem("FirstName")%>'/>
</ItemTemplate>
</TemplateColumn>
Instead of doing the string concatenation yourself you can use the BuildUrlWithQueryString function, which must be declared with Public/Protected visibility in the code-behind, as follows:
<TemplateColumn>
<ItemTemplate>
<asp:HyperLink Runat="server" NavigateUrl='<%# _
BuildUrlWithQueryString("Details.aspx", "EmployeeID", Container.DataItem("ID"),"EmployeeName", Container.DataItem("FirstName")) %>' />
</ItemTemplate>
</TemplateColumn>
http://java.mblogger.cn/brian_jin/posts/2792.aspx
<asp:TemplateColumn HeaderText="购买">
<ItemTemplate>
<asp:HyperLink id=HyperLink1 runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.dinggou")%>'
NavigateUrl='<%# "../gouwu/gouwu_ls.aspx?commoditytype=" &
DataBinder.Eval(Container, "DataItem.commoditytype")
& "&commodityname=" & DataBinder.Eval(Container, "DataItem.commodityname")%>' />
</ItemTemplate>
</asp:TemplateColumn>
- DataGrid超级链接列中绑定一个以上字段
- DataGrid超级链接列中绑定一个以上字段
- DataGrid如何绑定一个超级链接列
- DataGrid中超级链接列之使用技巧
- DataGrid的超级链接列如何设置多个url字段?
- DataGrid中列绑定ComboBox
- 在datagrid中加入超级链接
- WPF:后台获取DataGrid列的绑定字段。
- DataGrid中点击超级链接列后,如何控制弹出窗口????/(MENGZI)
- 一个只读列、绑定列、模板列(动态下拉)、编辑列都有的DataGrid
- 在DataGrid中添加一个合计字段
- 在DataGrid中添加一个合计字段
- 在DataGrid中添加一个合计字段
- 在DataGrid中添加一个合计字段
- 在DataGrid中添加一个合计字段
- 在DataGrid中添加一个合计字段
- 在DataGrid中添加一个合计字段
- 在DataGrid中添加一个合计字段
- blueline的blog
- Java 理论与实践: 关于异常的争论
- ASP.NET中网页的加载时间
- c#做的控件—用vml生成柱状图
- 写在飞雪如絮时
- DataGrid超级链接列中绑定一个以上字段
- 用.NET获取汉字的区位码(c#)
- Servlet/JSP服务器端的重定向
- Web Server程序编写学习笔记(二)
- pl/x 语言语法分析器的java实现
- 光标的修改
- xml完成配置的功能
- VS.NET 2003 控件命名规范
- 关于DataGrid等控件中的自动编号