ImageButton 放到 datalist中,cs代码中无法识别的解决办法
来源:互联网 发布:网络编辑工资多少 编辑:程序博客网 时间:2024/06/03 05:38
方法:在datalist的DataList1_ItemDataBound事件中写如下
ImageButton imga = (ImageButton)e.Item.FindControl("ImageButton1"); //找到它
imga.PostBackUrl = "b.aspx?id=" + DataBinder.Eval(e.Item.DataItem, "id", "{0:d}"); //改变它的 PostBackUrl
这样用FindControl找到了ImageButton1,想改变什么属性都可以了。
另外,如果想改变PostBackUrl还有另外一种方法:直接在HTML中写判断,下面只是一个简单的例子
<%if (1 == 3){%>
<asp:ImageButton ID="ImageButton1" runat="server" onclick="ImageButton1_Click"
PostBackUrl="a.html" />
<%}
else{ %>
<asp:ImageButton ID="ImageButton2" runat="server" onclick="ImageButton1_Click"
PostBackUrl="b.html" />
<%} %>
- ImageButton 放到 datalist中,cs代码中无法识别的解决办法
- jstl中el表达式无法识别的解决办法。
- 虚拟机中克隆系统后网卡无法识别的解决办法
- WPF项目中.xaml文件和.xaml.cs文件无法收缩显示的解决办法
- 在DataList中单击ImageButton,显示图片详细信息
- asp.net中datalist下面使用URL,拼接带有参数的跳转链接(用在ImageButton中)
- Xcode6的项目放到Xcode7中无法运行问题汇总
- XCode中Categories的类出现无法识别函数的问题的解决办法
- android中ImageButton的使用
- idea中terminal无法识别git命令行命令解决办法
- .NET中DataList嵌套DataList的实例
- ORA-12514:TNS:监听程序当前无法识别链接描述符中请求的服务 解决办法
- flex,mxml中,text属性无法识别换行符/n的解决办法。
- 【记录】Ubuntu中开发Andriod无法识别真机的解决办法
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 解决办法
- “ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务”的解决办法
- 震惊:把 URL 直接放到 C/C++ 的代码中
- cs中调用js代码
- 新建flex Library Project项目错误 Nothing Was Specified to be included in the library
- PB变量的作用域
- POJ3264 Balanced Lineup 【RMQ问题的四种解法】
- 从备份集恢复归档日志的说明
- 例解 autoconf 和 automake 生成 Makefile 文件
- ImageButton 放到 datalist中,cs代码中无法识别的解决办法
- hdu 1.2.3
- windows 7家庭版升级为旗舰版 序列
- 在Web上运行Linux
- Oracle 自定义 Exception
- Linux文件与目录操作函数
- 给分类,订单等添加一个属性字段!!
- hdu--1372 knight moves (BFS+数据结构)
- 简易电子书(24C64+Atmega16+128*64+红外接收+串口下载)