Ver Mensaje Individual
  #9 (permalink)  
Antiguo 23/04/2013, 06:58
maialenlopez
 
Fecha de Ingreso: abril-2012
Mensajes: 449
Antigüedad: 12 años, 1 mes
Puntos: 7
Respuesta: meter en un url la pagina a la que se dirige pasandole una variable

Cita:
Iniciado por Malenko Ver Mensaje
He encontrado un ejemplo muy muy parecido a lo que tu quieres hacer (crear un link html en una tabla). A ver si te sirve de guia:

http://www.vbforums.com/showthread.p...ks-at-run-time

Muchas gracias!!!
Me ha servido muchísimo. Y guiándome de lo que me has mandado la he echo asi!


Código vb.net:
Ver original
  1. With mysql_comando
  2.                         reader = .ExecuteReader()
  3.                         While reader.Read()
  4.  
  5.                             objRow = New TableRow()
  6.                             Dim objCell1, objCell2, objCell3, objCell4 As New TableCell()
  7.                             Dim linkDetalle, linkMes As String
  8.                             Dim sw1 As StringWriter = New StringWriter
  9.                             Dim ht1 As HtmlTextWriter = New HtmlTextWriter(sw1)
  10.                             Dim sw2 As StringWriter = New StringWriter
  11.                             Dim ht2 As HtmlTextWriter = New HtmlTextWriter(sw2)
  12.                             'Dim link As HtmlTextWriter
  13.  
  14.                             numoperario = reader.GetValue(0)
  15.                             nombre = reader.GetValue(1)
  16.  
  17.                             objCell1.Controls.Add(New LiteralControl(numoperario))
  18.                             objCell1.HorizontalAlign = HorizontalAlign.Center
  19.                             objCell2.Controls.Add(New LiteralControl(nombre))
  20.                             objCell2.HorizontalAlign = HorizontalAlign.Left
  21.  
  22.                             ' Create the a.
  23.                             ht1.AddAttribute(HtmlTextWriterAttribute.Href, "HorasOperarios.aspx?numOperario=" & numoperario)
  24.                             ht1.RenderBeginTag(HtmlTextWriterTag.A)
  25.                             ht1.Write("Detalle mensual")
  26.                             ' End all the tags.
  27.                             ht1.RenderEndTag()
  28.                             linkDetalle = sw1.ToString()
  29.                             objCell3.Controls.Add(New LiteralControl(linkDetalle))
  30.  
  31.                             ' Create the a.
  32.                             ht2.AddAttribute(HtmlTextWriterAttribute.Href, "HorasOperariosMes.aspx?numOperario=" & numoperario)
  33.                             ht2.RenderBeginTag(HtmlTextWriterTag.A)
  34.                             ht2.Write("Mes entero")
  35.                             ' End all the tags.
  36.                             ht2.RenderEndTag()
  37.                             linkMes = sw2.ToString()
  38.                             objCell4.Controls.Add(New LiteralControl(linkMes))
  39.  
  40.                             objRow.Cells.Add(objCell1)
  41.                             objRow.Cells.Add(objCell2)
  42.                             objRow.Cells.Add(objCell3)
  43.                             objRow.Cells.Add(objCell4)
  44.                             Table2.Rows.Add(objRow)
  45.                         End While
  46.                         .Dispose()
  47.                     End With

Gracias por todo, has sido de gran ayuda.

__________________
Gracias por todo;

Un saludo