IE 中未触发项目数据绑定事件
我在数据列表
<asp:DataList ID="dl" RepeatColumns="8" runat="server" GridLines="None" OnItemDataBound="dl_idb"
OnItemCommand="dl_ic" RepeatDirection="Horizontal">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="margin-left: 15px; margin-right: 15px;">
<tr>
<td>
<li>
<asp:ImageButton ID="imgMat" runat="server" Width="100" Height="100" ImageUrl='<%# DataBinder.Eval(Container, "DataItem.imgMat")%>'
CommandArgument='<%# DataBinder.Eval(Container, "DataItem.Matid")%>' ToolTip='<%# DataBinder.Eval(Container, "DataItem.ImgMat")%>'
CommandName="gallery" />
</li>
和服务器端
protected void dl_IC(object source, DataListCommandEventArgs e)
{
try
{
if (e.CommandName.ToString() == "gallery")
{
遇到了一个奇怪的问题,但是当页面加载时,我无法单击图像,即当我在 Firefox 或 Chrome 中打开同一页面时,它不处于可单击模式 em> 我可以单击图像,并且项目命令事件也正在触发。
其他信息
- 我正在绑定数据列表 > 事件
- If(!ispostback)行数据绑定上的
我正在执行此ImageButton imgM = (ImageButton)e.Item.FindControl("imgMat"); imgM .Attributes.Add("onload", "DoSomething('" + 字符串值 + "'," + 0 + ")");
有什么帮助吗?
I have a strange issue in a datalist
<asp:DataList ID="dl" RepeatColumns="8" runat="server" GridLines="None" OnItemDataBound="dl_idb"
OnItemCommand="dl_ic" RepeatDirection="Horizontal">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="margin-left: 15px; margin-right: 15px;">
<tr>
<td>
<li>
<asp:ImageButton ID="imgMat" runat="server" Width="100" Height="100" ImageUrl='<%# DataBinder.Eval(Container, "DataItem.imgMat")%>'
CommandArgument='<%# DataBinder.Eval(Container, "DataItem.Matid")%>' ToolTip='<%# DataBinder.Eval(Container, "DataItem.ImgMat")%>'
CommandName="gallery" />
</li>
and on server side
protected void dl_IC(object source, DataListCommandEventArgs e)
{
try
{
if (e.CommandName.ToString() == "gallery")
{
but when the page is load I am not able to click the image, i.e. it is not in clickable mode while when I open the same page in Firefox or Chrome I can click the image and Item command event is also firing.
Additional Info
- I am binding the datalist in > If(!ispostback) event
- on Row Databound I am doing this
ImageButton imgM = (ImageButton)e.Item.FindControl("imgMat");
imgM .Attributes.Add("onload", "DoSomething('" + string value + "'," + 0 + ")");
Any help ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定这是否是您的问题,但您的服务器端方法是“dl_IC”,而客户端 OnItemCommand 设置为“dl_ic”。尝试让它们匹配大小写,看看是否更可靠。
Not positive if this is your problem or not, but you're server side method is "dl_IC" while the client side OnItemCommand is set to "dl_ic". Try making them match case and see if it's more reliable.