【发布时间】:2012-12-31 09:34:21
【问题描述】:
我使用的是 DevExpress gridview,里面有一个命令按钮。我想使用图像而不是它。怎么可能?
到目前为止,我已经尝试了这么多:
GridViewCommandColumn commancol = new GridViewCommandColumn();
commancol.ButtonType = ButtonType.Image;
GridViewCommandColumnButton moveUpBtn;
moveUpBtn.Image.Url = "~/App_Themes/Images/GridControl/grid-delete.png";
commancol.Add(moveUpBtn);
但它给出了错误。
我想从 .cs 页面而不是 aspx 页面添加下面的方式按钮。所以我试图从代码隐藏中进行上述方式。
<dx:GridViewCommandColumn ButtonType="Image">
<HeaderTemplate>
</HeaderTemplate>
<DeleteButton Visible="true" Text="" Image-Url="grid-delete.png"
Image-ToolTip="Delete Record">
</DeleteButton>
</dx:GridViewCommandColumn>
谢谢
【问题讨论】:
-
我认为您需要在代码后面的 gridview 上添加一个图像按钮
-
我正在尝试使用下面的代码,但它在“commancol.Add(moveUpBtn);”上给了我错误行 GridViewCommandColumn commancol = new GridViewCommandColumn(); commancol.ButtonType = ButtonType.Image; GridViewCommandColumnButton moveUpBtn; moveUpBtn.Image.Url = "~/App_Themes/Images/GridControl/grid-delete.png"; commancol.Add(moveUpBtn);那么如何从.cs页面添加删除命令按钮..
-
我只是想从后面的代码中添加一个删除命令按钮.. 那我该怎么做呢?
-
@sejalpatel 请粘贴 gridview 的设计以及 cs 页面代码,以便了解您在 gridview 中添加图像而不是命令按钮时遇到的问题。
-
@Dev 我粘贴了我想从代码隐藏而不是 aspx 页面添加的 gridview 按钮。
标签: c# asp.net devexpress