Images in DataGrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sekhar

    Images in DataGrid

    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
  • Patrick.O.Ige

    #2
    Re: Images in DataGrid

    You have:-<asp:ImageButto n runat="server" ToolTip="Click to move this row
    up" ImageUrl="up.gi f" ID="btnUp"
    CommandName="Mo veUp" />
    <asp:ImageButto n runat="server" ToolTip="Click here to move this row
    down" ImageUrl="down. gif" ID="ImageButton 1"
    CommandName="Mo veDown" />
    in ur aspx page and in codebehind do:-

    void DataGrid1_ItemC ommand(object source, DataGridCommand EventArgs 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



    "Sekhar" <Sekhar@discuss ions.microsoft. com> wrote in message
    news:ED6E4D61-A352-4ED9-996A-4B9FD842ADF0@mi crosoft.com...[color=blue]
    > 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[/color]


    Comment

    • Sekhar

      #3
      Re: Images in DataGrid

      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


      "Patrick.O. Ige" wrote:
      [color=blue]
      > You have:-<asp:ImageButto n runat="server" ToolTip="Click to move this row
      > up" ImageUrl="up.gi f" ID="btnUp"
      > CommandName="Mo veUp" />
      > <asp:ImageButto n runat="server" ToolTip="Click here to move this row
      > down" ImageUrl="down. gif" ID="ImageButton 1"
      > CommandName="Mo veDown" />
      > in ur aspx page and in codebehind do:-
      >
      > void DataGrid1_ItemC ommand(object source, DataGridCommand EventArgs 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
      >
      >
      >
      > "Sekhar" <Sekhar@discuss ions.microsoft. com> wrote in message
      > news:ED6E4D61-A352-4ED9-996A-4B9FD842ADF0@mi crosoft.com...[color=green]
      > > 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[/color]
      >
      >
      >[/color]

      Comment

      Working...