
08/10/2004, 06:17
|
| | Fecha de Ingreso: agosto-2004
Mensajes: 9
Antigüedad: 20 años, 6 meses Puntos: 0 | |
Crear hyperlinks dinamicamente en un Datagrid Hola, tengo un Datagrid paginado por código (c#) que devuelve datos que varian de un dia a otro. Me gustaría que estos resultados fueran a su vez hiperenlaces a otra pagina a la que pasrle como paramentro el texto del propio resultado. Es decir, el datagrid consiste en 2 columnas con el par (id, descripcion) y quiero que al pinchar en este par se redirija a otra página pasándole el parámetro (id o descripcion)
El codigo del metodo BinGrid es el siguiente:
<code>
void BindGrid(string stralpha)
{
OdbcConnection cn;
OdbcDataAdapter da;
DataSet ds;
//Miguel
HyperLinkColumn hyp ;
TableCell td = new TableCell();
//Miguel
//Comprueba que el usuario y password son correctos
AppSettingsReader rdr =new AppSettingsReader();
string strCadenaConexionBD = rdr.GetValue("ConexionBDASA",typeof(string)).ToStr ing();
cn= new OdbcConnection();
cn.ConnectionString=strCadenaConexionBD;
//string strsql ="select terapia_id, terapia_descripcion from terapia ";
//string strsql ="select especialidad_id, registrado from especialidad ";
string strsql ="select especialidad_id as CODIGO, registrado as REGISTRADO from especialidad ";
if (stralpha=="")
{
strsql = strsql + " where registrado like'" + stralpha + "A%'" +" order by registrado";
}
else
{
strsql=strsql + " where registrado like'" + stralpha + "%'" +" order by registrado";
}
da= new OdbcDataAdapter(strsql,cn);
ds= new DataSet ();
da.Fill (ds, "Product");
if (ds.Tables [0].Rows.Count ==0)
{
Response.Write ("No Data Found");
DataGrid1.DataSource=null;
DataGrid1.DataBind ();
}
else
{
DataGrid1.PageSize=(ds.Tables [0].Rows.Count);
DataGrid1.DataSource =ds;
DataGrid1.DataBind();
}
}
<code>
alguine sabe cómo puedo hacer para crear estos hiperenlaces por codigo??? |