Picture Button

J

Jason

Hi

I know this is probably simple, but i am running around stuck.

All i want is a picture as a button in one of my columns on the datagrid
control. when clicked, all that is done is a javascript "window.open()". How
do i do this?

Thanks
Jason
 
A

Alvin Bruney

if(e.Item.ItemType == ListItemType.Footer)
{
//build and add a label
Panel lb = new Panel();
Panel.BackImageUrl = "blah.gif";

e.item.controls[3].Controls.Add(tb);
tb = null;

//embed javascript into the control

e.Item.Cells[3].Attributes.Add("oncontextmenu","window.open('url.aspx');retu
rn false;);
}

Here is an overview of the process. Put this code in an event handler such
as the itemdatabound. Build out a control which can take a picture as a
background. A panel will do nicely here. Add it to the cell being bound.
Embed the required javascript in with the control. In this case, right
clicking will fire of the javascript.
This is off the top of my head so it isn't guaranteed to compile but it
should provide the leg work to get things moving.

regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top