Welcome Guest Search | Active Topics | Sign In | Register

ImageButton in Grid Options
Todd Mulhollan
Posted: Tuesday, June 28, 2011 10:44:48 AM
Rank: Newbie
Groups: Member

Joined: 6/15/2011
Posts: 5
Can I use asp:ImageButton in EO.Grid control? I wanted ImageButton type column ( to display an icon on each row, instead of button type column).

Thanks in advance.
eo_support
Posted: Tuesday, June 28, 2011 12:52:42 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

No. You can not use ImageButton directly. You can display an image in the Grid cell though:

http://www.essentialobjects.com/forum/postst3284_Picture-in-grid-cell.aspx

If you also wish to handle image click event, use a ButtonColumn instead of a StaticColumn.

Thanks
Todd Mulhollan
Posted: Tuesday, June 28, 2011 1:40:00 PM
Rank: Newbie
Groups: Member

Joined: 6/15/2011
Posts: 5
Thanks for the response. Based on the earlier post, I couldn't figure out if is this the correct format?

<eo:StaticColumn HeaderText="Operation" DataFormat='<img src="images/home.png" />' >
</eo:StaticColumn>

Also, as you mentioned if I want to handle image click, I have to use 'ButtonColumn'. So does that mean, I can't have clickable image/icon?

Another question:
I am trying to pupulate Grid's static column from array of strings (instead on database). I think this may be possible, but don't know how to define the 'DataField' of this column. When I pass string array to Grid's datasource, I get empty rows (same number as array). Here's the code:

string[] envs = /*getting array from somewhere*/
Grid1.DataSource = envs;
Grid1.DataBind();

Thanks again!
Todd Mulhollan
Posted: Tuesday, June 28, 2011 2:41:45 PM
Rank: Newbie
Groups: Member

Joined: 6/15/2011
Posts: 5
I got 2nd part working by converting string array to DataTable.
eo_support
Posted: Tuesday, June 28, 2011 3:12:47 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You can have clickable images in Grid cell. You would simply replace eo:StaticColumn with eo:ButtonColumn. Everything else such as DataFormat is the same.

Thanks
Todd Mulhollan
Posted: Tuesday, June 28, 2011 3:25:29 PM
Rank: Newbie
Groups: Member

Joined: 6/15/2011
Posts: 5
Thanks. That worked!!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.