Images in DataGrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I have a DataGrid which has two Template Columns both having Image Buttons
in it
One column has UP image and the other has DOWN image used to reorder rows in
the grid.

How do i handle the events to these images. Working on the ImageButton click
events doesnt help. I thought ItemCommand event would work but didnt.

Any suggestions?

Thanks
Sekhar
 
You have:-<asp:ImageButton runat="server" ToolTip="Click to move this row
up" ImageUrl="up.gif" ID="btnUp"
CommandName="MoveUp" />
<asp:ImageButton runat="server" ToolTip="Click here to move this row
down" ImageUrl="down.gif" ID="ImageButton1"
CommandName="MoveDown" />
in ur aspx page and in codebehind do:-

void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e)
{

switch (e.CommandName)
{
case "Up":

}

{
case "Down":

}
Phillip posted a sample on his site if you are interested in re-ordering the
rows..
I just can't remember the link.
I have a sample implementation but not with me.
Hope that helps
Patrick
 
Hi
I tried on those lines. It doesnt work. When i click on the ImageButton the
CLick event for the ImageButton is fired but not the ItemCommand Event

Thanks
Sekhar
 

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

Back
Top