Ver Mensaje Individual
  #5 (permalink)  
Antiguo 23/04/2013, 04:37
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
Yo controles dinámicos no he tocado mucho pero diría que más que llamar a la propiedad "Text" porque es el Texto del link:
Código:
linkDetalle.Text
tendrías que usar el RenderControl para que te genere todo el código HTML (<a href=...)

Ya lo he echo, a ver si me puedes ayudar en esto.

Hago lo siguiente pero ahora no me muestra el nombre del link al que tengo que clicar, es decir, el objCell3 no me pinta nada en la tabla

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 As String
  8.                             Dim link As HtmlTextWriter
  9.  
  10.                             numoperario = reader.GetValue(0)
  11.                             nombre = reader.GetValue(1)
  12.  
  13.                             objCell1.Controls.Add(New LiteralControl(numoperario))
  14.                             objCell1.HorizontalAlign = HorizontalAlign.Center
  15.                             objCell2.Controls.Add(New LiteralControl(nombre))
  16.                             objCell2.HorizontalAlign = HorizontalAlign.Left
  17.  
  18.                             Dim sw As StringWriter = New StringWriter
  19.                             Dim ht As HtmlTextWriter = New HtmlTextWriter(sw)
  20.  
  21.                             ' Create the a.
  22.                             ht.AddAttribute(HtmlTextWriterAttribute.Href, "~/HorasOperarios.aspx?numOperario=" & numoperario)
  23.                             ht.RenderBeginTag(HtmlTextWriterTag.A)
  24.  
  25.                             ' End all the tags.
  26.                             ht.RenderEndTag()
  27.                             linkDetalle = sw.ToString()
  28.                             [B]objCell3.Controls.Add(New LiteralControl(linkDetalle))[/B]
  29.  
  30.                             objRow.Cells.Add(objCell1)
  31.                             objRow.Cells.Add(objCell2)
  32.                             objRow.Cells.Add(objCell3)
  33.                             Table2.Rows.Add(objRow)
  34.                         End While
  35.                         .Dispose()
  36.                     End With
__________________
Gracias por todo;

Un saludo