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

que problema tengo?

Estas en el tema de que problema tengo? en el foro de .NET en Foros del Web. hola amigos tengo el siguiente problema: tengo un datagrid y deseo seleccionar un datos en particular y desplegarlo en las cajas de texto, pero no ...
  #1 (permalink)  
Antiguo 08/09/2003, 15:14
 
Fecha de Ingreso: abril-2001
Mensajes: 293
Antigüedad: 23 años
Puntos: 0
Pregunta que problema tengo?

hola amigos tengo el siguiente problema:

tengo un datagrid y deseo seleccionar un datos en particular y desplegarlo en las cajas de texto, pero no me funciona me arroja un error

Control 'DataGrid1__ctl2__ctl0' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server.

este es el codigo


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

Sub Page_Load(obj As object, e As eventargs)
if ispostback() then
Dim objConn As New SQLConnection ("server=desarrollo;uid=yo;pwd=yo;database=prueba" )
Dim sSQL, Resul as string

sSQL = "Insert into correlativos_tablas (id, nombre_tabla) values (" & Nombre.text & ", '" & Apellido.text & "')"
'response.write(ssql)
'response.end
Dim objCmd As New SQLCommand (sSQL, objConn)
objConn.open
resul= objCmd.ExecuteNonQuery
if resul then
response.write("Se ha agregado correctamente el registro")
end if
objconn.close()
end if
BindGrid
End sub
Sub BindGrid()
Dim objConn As New SQLConnection ("server=desarrollo;uid=yo;pwd=yo;database=prueba" )
Dim da As New SqlDataAdapter("select * from correlativos_tablas", objConn)
Dim ds As New DataSet()
da.Fill(ds, "correlativos_tablas")
DataGrid1.DataSource = ds
DataGrid1.DataBind()
objconn.close()
End Sub
Sub Editar(Sender As Object, E As DataGridCommandEventArgs)
DataGrid1.EditItemIndex = e.Item.ItemIndex
BindGrid()
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<div align="center">
<center>
<table style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; BORDER-LEFT: #000080 1px solid; BORDER-BOTTOM: #000080 1px solid" cellspacing="0" cellpadding="0" width="50%" border="0">
<tbody>
<tr>
<td width="4%">
</td>
<td width="28%">
Id</td>
<td width="68%">
<ASP:textbox id="Nombre" runat="Server"></ASP:textbox>
</td>
</tr>
<tr>
<td width="4%">
</td>
<td width="28%">
Descripción</td>
<td width="68%">
<ASP:textbox id="Apellido" runat="Server"></ASP:textbox>
</td>
</tr>
<tr>
<td width="68%" colspan="3">
<div align="center">
<ASP:button id="Enviar" style="BORDER-RIGHT: #b5b6ce 1px solid; BORDER-TOP: #b5b6ce 1px solid; BORDER-LEFT: #b5b6ce 1px solid; CURSOR: hand; BORDER-BOTTOM: #b5b6ce 1px solid; BACKGROUND-COLOR: #f7f3f7" runat="Server" Height="25px" Width="96px" Text="Grabar"></ASP:button>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</div>
</form>
<p>
</p>
<p align="center">
<asp:DataGrid id="DataGrid1" runat="server" datakeyfield="id" OnEditCommand="Editar" AutoGenerateColumns="False" ShowFooter="True" CellPadding="4" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#CC9966">
<columns>
<asp:EditCommandColumn EditText="Modificar" CancelText="Cancelar"></asp:EditCommandColumn>
</columns>
</asp:DataGrid>
</p>
</body>
</html>

que podra ser?

saludos y gracias
  #2 (permalink)  
Antiguo 09/09/2003, 10:33
 
Fecha de Ingreso: abril-2001
Mensajes: 293
Antigüedad: 23 años
Puntos: 0
solucionado, me faltaba poner la datagrid dentro del form..


gracias..
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 11:09.