备用GridView列 [英] Alternate GridView Column

查看:129
本文介绍了备用GridView列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

有什么方法可以替代GridView列吗?
我已经禁用了GridView标头,并且它具有下面的列.

GridView

图片文字
图片文字
图片文字


我已使用模板字段"来处理图像和文本.
现在,我想将GridView作为

GridView

图片文字
文字图片
图片文字


我该怎么做?

Hi All,

Is there any way to alternate a GridView Columns ?
I''ve make GridView header disable and it has the columns below.

GridView

Image Text
Image Text
Image Text


I''ve used Template Field for image and text.
Now I want the GridView as

GridView

Image Text
Text Image
Image Text


How can i do that ?

推荐答案

您可以在RowDataBound事件中执行此操作.首先将两个控件(图像和文本)都放在ItemTemplate中.然后,在RowDataBound事件处理程序中,可以使用e.Row.FindControl("Control_ID")方法查找这些控件,并通过e.Row.RowIndex查找行,并可以根据需要设置visible = true/false.

如果您的问题得到解决,则标记​​为答案.
You can do this in RowDataBound event. Firstly put both controls(image and text) in ItemTemplate. Then in RowDataBound event handler, you can use e.Row.FindControl("Control_ID") method to find these controls and find row by e.Row.RowIndex and can set visible=true/false as per your requirement.

Mark is as answer if your problem is solved.


这篇关于备用GridView列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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