Click here to Skip to main content
15,910,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 ?
Posted
Updated 14-Aug-13 20:39pm
v2
Comments
Dholakiya Ankit 15-Aug-13 8:57am    
use alternate itemtemplate in repeater what u tried ?
Member 9330747 16-Aug-13 6:19am    
Hi Ankit, Thank for your reply. But i couldn't get you. Can you please elaborate ?
Dholakiya Ankit 16-Aug-13 7:26am    
https://www.google.co.in/search?q=alternate+itemtemplate+in+repeater&oq=alternate+itemtemplate+in+repeater&aqs=chrome.0.69i57&sourceid=chrome&ie=UTF-8
pradiprenushe 19-Aug-13 13:19pm    
Add image & label in both template.
In rowdatabound add logic for visibility.
If 1st template label visible then second template image visible & vice versa.

1 solution

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.
 
Share this answer
 
Comments
Member 9330747 16-Aug-13 6:21am    
Thanks for your reply, But in this case there is a possibility that few row might be invisible.
If i am wrong please clarify it. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900