update control in table

Discussion in 'ASP .Net Web Controls' started by miguel.ossa, Jan 26, 2004.

  1. miguel.ossa

    miguel.ossa Guest

    Hi to all!

    I've created a table with n x n elements, in the way:

    imagen = Array.CreateInstance( typeof(HtmlInputImage), nFilas,
    nColumnas);
    Panel1.Height = nColumnas * 15 + 2;
    for (int j=0; j<nFilas; j++)
    {
    HtmlTableRow r = new HtmlTableRow();
    r.BgColor="Gainsboro";
    r.Height = "15";
    for (int i=0; i<nColumnas; i++)
    {
    HtmlTableCell c = new HtmlTableCell();
    HtmlInputImage image = new HtmlInputImage();
    image.Src = "images/tapada.jpg";
    image.ServerClick += new
    ImageClickEventHandler(Imagen_ServerClick);
    imagen.SetValue(image, j, i);
    c.Controls.Add((HtmlInputImage)imagen.GetValue(j, i));
    c.Height = "15";
    r.Cells.Add(c);
    }
    Table2.Rows.Add(r);
    }

    The name of the image has to change if the user clicks on it. If the
    images changes, I don't need anymore the event handling. I want to
    change the image and deassing the handler.

    for (int i=0; i<nFilas; i++)
    {
    // TODO: recreación de las imágenes según estado de cada casilla
    for (int j=0; j<nColumnas; j++)
    {
    if (tablero.casilla(i,j) != tablero_old.casilla(i,j))
    {
    HtmlInputImage image = new HtmlInputImage();
    image = (HtmlInputImage)Table2.Rows.Cells[j].Controls[0];
    if (tablero.casilla(i,j) ==
    TableroBuscaminas.EstadoCasilla.Vacia)
    {
    image.Src = "images/destapada.jpg";
    image.ServerClick -= new
    ImageClickEventHandler(Imagen_ServerClick);
    }
    }
    }
    }

    Doing like above, I change the image, but I need also to update it
    again in the table.
     
    miguel.ossa, Jan 26, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Williams
    Replies:
    2
    Views:
    1,140
    Jacob Yang [MSFT]
    Aug 12, 2003
  2. Farraige
    Replies:
    4
    Views:
    288
    Farraige
    Nov 8, 2006
  3. Geary
    Replies:
    2
    Views:
    729
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Jul 12, 2007
  4. David Shorthouse

    Update query doesn't update table

    David Shorthouse, Jun 17, 2005, in forum: ASP General
    Replies:
    6
    Views:
    262
    David Shorthouse
    Jun 17, 2005
  5. Sven Fischer
    Replies:
    0
    Views:
    479
    Sven Fischer
    Oct 22, 2012
Loading...

Share This Page