gridview中的动态命令域图像 [英] Dynamic commandfield image in gridview
本文介绍了gridview中的动态命令域图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我动态添加了一个gridview,并且我还在服务器端动态添加了命令字段到这个gridview.请参考以下代码.实际上,我在命令字段的selecttext属性上添加了一个图像.
Hi ,
I add a gridview dynamically and to this gridview I also add command field dynamically at server side. Please refer following code. On the selecttext property of the commandfield I actually add an image.
oAspCommandField = New CommandField()
oAspCommandField.ShowSelectButton = True
oAspCommandField.ButtonType = ButtonType.Link
oAspCommandField.SelectText = "<img align=top BorderColor=transparent border=0 alt='Show in Map' src='images/map20_norm.gif' />"
oGridView.Columns.Add(oAspCommandField)
但是现在我想将此图像放在gridview列的中心.
我需要在上面的代码中进行哪些更改?
谢谢.
Vijay
But now I want to have this image centered in the gridview column.
What changes do I need in the above code?
Thanks.
Vijay
推荐答案
解决方法是将图像包装在div和样式中,宽度= 100%,文本align =中心,光标作为手.
Solved as by wrapping the image in div and style with width = 100% text align = center and cursor as hand.
oAspCommandField.ItemStyle-HorizontalAlign = "Center"
如果这样做有帮助,则将其标记为答案,然后请投票.
If this helped you then marked it as answer and Please Vote.
这篇关于gridview中的动态命令域图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文