Foros del Web » Programación para mayores de 30 ;) » .NET »

HIPERLINK COMO Se HACE EN COLUMN

Estas en el tema de HIPERLINK COMO Se HACE EN COLUMN en el foro de .NET en Foros del Web. EL SIGUIENTE CODIGO GENERA UNA GRILLA DONDE ME SALEN LOS TOTALES ABAJO , ESTE EJMPLO LO DIO ROOTK PARA EVITAR HACER SUM VARIOS POR CADA ...
  #1 (permalink)  
Antiguo 16/11/2004, 10:37
 
Fecha de Ingreso: septiembre-2004
Mensajes: 141
Antigüedad: 19 años, 7 meses
Puntos: 0
HIPERLINK COMO Se HACE EN COLUMN

EL SIGUIENTE CODIGO GENERA UNA GRILLA DONDE ME SALEN LOS TOTALES ABAJO , ESTE EJMPLO LO DIO ROOTK PARA EVITAR HACER SUM VARIOS POR CADA COLUMNA

YA MI PROBLEMA ES METER AHORA UN LINK EN LA PRIMERA COLUMNA, PRFA QUIEN ME PEUDE AYUDAR M DA ERROR Y NO ME RESULTA
me interesa que vean el codigo del DATAGRID lo demas esta FUNCIONANDO SI MI PROBLEMA ES SOLO AGREGAR EL LINK AL PRIMER DATACOLUMNN
----------------CODIGO----------------------------------

<%@ Page Language="vb" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SQLClient" %>
<script runat="server">

'----- DECLARA LOS SUMADORES DE TOTALES------
Dim viewCountSum as Integer = 0
.............

Sub Page_Load(sender as Object, e as EventArgs)
BindData()
End Sub


Sub BindData()
'1. Create a connection
' Dim myConnection as New SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))


dim fechai as String = Request.QueryString("fechai")
dim fechaf as String = Request.QueryString("fechaf")


'RESPONSE.WRITE (FECHAI)
'response.end()


Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyCommand.SelectCommand.CommandType = CommandType.StoredProcedure

MyCommand.SelectCommand.Parameters.Add(New SqlParameter("@fechai", SqlDbType.nvarchar, 8))
MyCommand.SelectCommand.Parameters("@fechai").Valu e = fechai


MyCommand.SelectCommand.Parameters.Add(New SqlParameter("@fechaf", SqlDbType.nvarchar, 8))
MyCommand.SelectCommand.Parameters("@fechaf").Valu e = fechaf

DS = new DataSet()
MyCommand.Fill(DS, "Sales")

MyDataGrid.DataSource=DS.Tables("Sales").DefaultVi ew
MyDataGrid.DataBind()
End Sub

Sub ComputeSum(sender As Object, e As DataGridItemEventArgs)
'--------------------------------------SUMA TOTALES RECIBIDOS ----------------
'First, make sure we are dealing with an Item or AlternatingItem
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Snip out the ViewCount
Dim viewCount as Integer = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "total"))
viewCountSum += viewCount

ElseIf e.Item.ItemType = ListItemType.Footer then
e.Item.Cells(6).Text = "Total: " & String.Format("{0:#,###}", viewCountSum)
End If



'-------------------SUMA cOLUMNA EN PROCESO--------------------------------------------------------

'First, make sure we are dealing with an Item or AlternatingItem
If e.Item.ItemType = ListItemType.Item OR _
e.Item.ItemType = ListItemType.AlternatingItem then
'Snip out the ViewCount
Dim viewCount3 as Integer = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ENPROCESO"))
viewCountSum3 += viewCount3

ElseIf e.Item.ItemType = ListItemType.Footer then
e.Item.Cells(2).Text = "Total: " & String.Format("{0:#,###}", viewCountSum3)
End If

end sub


</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">BODY {
BACKGROUND-COLOR: #ffffcc
}
</style>
</head>
<body>
<table width="100%" border="0">
<tbody>
<tr>
<td>
<table width="100%" border="0">
<tbody>
<tr>
<td>
<table width="100%" border="0">
<tbody>
<tr>
<td bgcolor="#ff9933">
<div align="center">RESUMEN CONTACTO INGRESADOS POR TIPO EN EL PERIODO
</div>
</td>
</tr>
<tr>
<td bgcolor="#ffcc00">
<div align="center">INFORME AL <%= (Date.now()) %>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<form runat="server">
<div align="center">
<asp:DataGrid id="MYDATAGRID" runat="server" AutoGenerateColumns="False" Font-Name="Verdana" Width="85%" Font-Size="11pt" HorizontalAlign="Center" ShowFooter="True" OnItemDataBound="ComputeSum">
<FooterStyle font-size="12pt" font-bold="True" horizontalalign="Right" forecolor="White" backcolor="Goldenrod"></FooterStyle>
<HeaderStyle font-size="14pt" font-bold="True" horizontalalign="Center" forecolor="White" backcolor="Goldenrod"></HeaderStyle>
<Columns>
<asp:HyperLinkColumn DataField="type_id" DataNavigateUrlField="type_id"
DataNavigateUrlFormatString="menu_detalle.aspx?id= {0}" Text="Get Details">
</asp:BoundColumn>

<asp:BoundColumn DataField="description" HeaderText="Full Name " DataFormatString="{0:#,###}">
<ItemStyle horizontalalign="Right" width="15%"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="ENPROCESO" HeaderText="PROCESO" DataFormatString="{0:#,###}">
<ItemStyle horizontalalign="Right" width="15%"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="ATRASADO" HeaderText="ATRASADO" DataFormatString="{0:#,###}">
<ItemStyle horizontalalign="Right" width="15%"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CERRADO" HeaderText="CERRADO" DataFormatString="{0:#,###}">
<ItemStyle horizontalalign="Right" width="15%"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CERRADOaTRASADO" HeaderText="CERRADO ATRASADO" DataFormatString="{0:#,###}">
<ItemStyle horizontalalign="Right" width="15%"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="total" HeaderText="TOTALES" DataFormatString="{0:#,###}">
<ItemStyle horizontalalign="Right" width="15%"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="porcentaje" HeaderText="Porcentaje" DataFormatString="{0:#,###}">
<ItemStyle horizontalalign="Right" width="15%"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="ReAbierto" HeaderText="Reabierto" DataFormatString="{0:#,###}">
<ItemStyle horizontalalign="Right" width="15%"></ItemStyle>
</asp:BoundColumn>
</Columns>
</asp:DataGrid>
<ASP:DataGrid id="MyDataGrid" runat="server">



</ASP:DataGrid>



</div>
</form>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div align="right">
<input style="BACKGROUND-COLOR: #ff9900" type="button" value="VOLVER" name="VOLVER" />
<input style="BACKGROUND-COLOR: #ff9900" onclick="javascript:print.window()" type="button" value="IMPRIMIR" name="VOLVER" />
</div>
</body>
</html>
  #2 (permalink)  
Antiguo 16/11/2004, 10:41
Avatar de RootK
Moderador
 
Fecha de Ingreso: febrero-2002
Ubicación: México D.F
Mensajes: 8.004
Antigüedad: 22 años, 2 meses
Puntos: 50
Un LinkButton o un HyperLink ?

De cualquiera de las 2 formas solo es cosa de que lo pongas al principio.

Cita:
<asp:DataGrid id="MYDATAGRID" runat="server" AutoGenerateColumns="False" Font-Name="Verdana" Width="85%" Font-Size="11pt" HorizontalAlign="Center" ShowFooter="True" OnItemDataBound="ComputeSum">
<FooterStyle font-size="12pt" font-bold="True" horizontalalign="Right" forecolor="White" backcolor="Goldenrod"></FooterStyle>
<HeaderStyle font-size="14pt" font-bold="True" horizontalalign="Center" forecolor="White" backcolor="Goldenrod"></HeaderStyle>
<Columns>
<asp:HyperLinkColumn DataField="type_id" DataNavigateUrlField="type_id"
DataNavigateUrlFormatString="menu_detalle.aspx?id= {0}" Text="Get Details">
...
....
No sé cual sea tu problema, porque con ello la primera columna tendrá el hyperlink or linkbutton dependiendo de que coloques.

Salu2
__________________
Nadie roba nada ya que en la vida todo se paga . . .

Exentrit - Soluciones SharePoint & Net
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:10.