如何在grideview中放置图像代替Autogenerateedit链接? [英] how to put image in place of Autogenerateedit link in grideview?

查看:76
本文介绍了如何在grideview中放置图像代替Autogenerateedit链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gridview中我已经放了autogenerateEdit链接,我将使用它来编辑数据。但我必须把图像放在那个地方,当我点击它时,我会做同样的事情编辑链接。怎么做?

解决方案

转到GridView的RowDataBound事件,找到处于编辑模式的备用项目,并设置按钮的背景图像。试试这个:

  if (e.Row.RowState == DataControlRowState.Edit&& e .Row.RowState == DataControlRowState.Alternate)
{
Button btn =(Button)e.Row.FindControl( MyButtonID);
if (btn!= null ){
// 在此设置背景图片..
}
}







--Amit


in gridview i have put autogenerateEdit link and i will edit data using this. But i have to put image on that place and when i click on that i will do same thing as edit link. how to do this?

解决方案

Go to the RowDataBound Event of your GridView and find the alternate items which is in edit mode and set the background image for the button. Try this:

if (e.Row.RowState == DataControlRowState.Edit && e.Row.RowState == DataControlRowState.Alternate)
{
    Button btn = (Button)e.Row.FindControl("MyButtonID");
    if(btn!=null){
         //Set the background image here..
    }
}




--Amit


这篇关于如何在grideview中放置图像代替Autogenerateedit链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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