未触发ListView中的ItemCommand [英] ItemCommand in ListView is not fired

查看:96
本文介绍了未触发ListView中的ItemCommand的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.net网站中使用了名为ListView_image的ListView控件,该listview仅显示一个图像列表,我想单击每个图像然后重定向到一个新页面,但是我不知道如何处理它.然后我尝试使用ItemCommand.但是我发现单击图像时无法调用此函数.
以下只是一个简单的测试.请注意,我只想测试何时触发此功能.
有人可以给我提示吗?请注意,图像列表已成功从数据源中显示.

I have used ListView control called ListView_image in my ASP.net website, the listview just displays the a image list, I want to click each one and then redirect to one new page, but I do not know how to do with it. then I try to use ItemCommand. But I found this function can not called when I click the image.
the following is just a simple test. Note that, I just want to test when this function will be fired.
any one can give me a hint? Note that, the image list has been displayed sucessfully from a data sourece.

protected void ListView_image_ItemCommand(object sender, ListViewCommandEventArgs e)
{
    MessageBox.Show(e.Item.ToString());
}

推荐答案


您只需尝试一下,然后检查您的网格是否正在触发事件.
Hi,
You just try this and check whether your grid is firing event or not.
protected void ListView_image_ItemCommand(object sender, ListViewCommandEventArgs e)
{
        ScriptManager.RegisterClientScriptBlock(base.Page, this.GetType(), "Myscript", "alert('Event fired..');", true); 
}



祝一切顺利.
--AK



All the best.
--AK


这篇关于未触发ListView中的ItemCommand的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆