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

error con un repeater(sistema de encuestas)

Estas en el tema de error con un repeater(sistema de encuestas) en el foro de .NET en Foros del Web. hola compañeros estoi haciendo un sistema de encuestas,me da un error, mas concretamente: El control 'repeater1__ctl1_0' de tipo 'RadioButton' debe colocarse dentro de una etiqueta ...
  #1 (permalink)  
Antiguo 13/06/2005, 04:36
 
Fecha de Ingreso: abril-2005
Mensajes: 55
Antigüedad: 19 años, 9 meses
Puntos: 0
error con un repeater(sistema de encuestas)

hola compañeros estoi haciendo un sistema de encuestas,me da un error, mas concretamente:
El control 'repeater1__ctl1_0' de tipo 'RadioButton' debe colocarse dentro de una etiqueta de formulario con runat=server.
y nose como solucionarlo,he metido el codigo para ver si alguien me puede ayudar
gracias por anticipado.

Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents Radio As System.Web.UI.WebControls.RadioButtonList
Protected WithEvents button1 As System.Web.UI.WebControls.Button
Protected WithEvents dg As System.Web.UI.WebControls.DataGrid
Protected WithEvents repeater1 As System.Web.UI.WebControls.Repeater
Protected WithEvents preg_1 As System.Web.UI.WebControls.Label

......codigo que genera la herramienta

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cn As New OleDb.OleDbConnection()
Dim da As New OleDb.OleDbDataAdapter()
Dim ds As New DataSet()
Dim str As String

str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Inetpub\wwwroot\Encuestas\encuestas.mdb"
cn.ConnectionString = str
cn.Open()
If Not Page.IsPostBack Then

da = New OleDb.OleDbDataAdapter("select pre_descrip,pre_id,pre_tipo from preguntas where enc_id = 1", cn)
ds = New DataSet()

da.Fill(ds, "preguntas")

repeater1.DataSource = ds.Tables("preguntas")
repeater1.DataBind()

End If
End Sub

Private Sub repeater1_ItemDataBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs) Handles repeater1.ItemDataBound

If Not DataBinder.Eval(e.Item.DataItem, "pre_id") Is Nothing Then
Dim fila As TableRow = New TableRow()
Dim celda As TableCell = New TableCell()

celda.Text = DataBinder.Eval(e.Item.DataItem, "pre_descrip")
fila.Cells.Add(celda)
repeater1.Controls.Add(fila)

fila = New TableRow()
celda = New TableCell()
Dim radio As RadioButtonList = New RadioButtonList()

If DataBinder.Eval(e.Item.DataItem, "pre_tipo") = 1 Then
radio.Items.Add("Muy alto")
radio.Items.Add("Alto")
radio.Items.Add("Medio")
radio.Items.Add("Bajo")
radio.Items.Add("Muy bajo")

ElseIf DataBinder.Eval(e.Item.DataItem, "pre_tipo") = 2 Then
radio.Items.Add("si")
radio.Items.Add("no")

End If
celda.Controls.Add(radio)
fila.Cells.Add(celda)
repeater1.Controls.Add(fila)
End If
End Sub
'Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
'Dim res As String
'If RadioButtonList1.SelectedIndex > -1 Then
'res = RadioButtonList1.SelectedItem.Text
'End If
' End Sub
End Class
  #2 (permalink)  
Antiguo 13/06/2005, 04:40
 
Fecha de Ingreso: abril-2005
Mensajes: 55
Antigüedad: 19 años, 9 meses
Puntos: 0
y este es el codigo de la pagina .aspx

<HTML>
<HEAD>
<title>WebForm1</title>
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta content="True" name="vs_showGrid">
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script>

</script>
</HEAD>
<body background="file:///C:\Inetpub\wwwroot\Encuestas\fondo1.gif" MS_POSITIONING="GridLayout">
<TABLE id="Table1" style="Z-INDEX: 101; LEFT: 40px; WIDTH: 456px; POSITION: absolute; TOP: 16px; HEIGHT: 96px" cellSpacing="1" cellPadding="1" width="456" border="1">
<asp:repeater id="repeater1" runat="server"></asp:repeater></TABLE>
</body>
</HTML>
  #3 (permalink)  
Antiguo 13/06/2005, 04:47
Avatar de Jose_minglein2  
Fecha de Ingreso: noviembre-2004
Mensajes: 2.344
Antigüedad: 20 años, 3 meses
Puntos: 8
prueba a poner el html dentro de un form con runat server:

Código PHP:
<HTML>
<
HEAD>
<
title>WebForm1</title>
<
META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<
meta content="True" name="vs_showGrid">
<
meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<
meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<
meta content="JavaScript" name="vs_defaultClientScript">
<
meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<
script>

</script>
</HEAD>
<body background="file:///C:\Inetpub\wwwroot\Encuestas\fondo1.gif" MS_POSITIONING="GridLayout">
<form id="form1" runat="server">
<TABLE id="Table1" style="Z-INDEX: 101; LEFT: 40px; WIDTH: 456px; POSITION: absolute; TOP: 16px; HEIGHT: 96px" cellSpacing="1" cellPadding="1" width="456" border="1">
<asp:repeater id="repeater1" runat="server"></asp:repeater></TABLE>
</form>
</body>
</HTML> 
  #4 (permalink)  
Antiguo 13/06/2005, 04:58
 
Fecha de Ingreso: abril-2005
Mensajes: 55
Antigüedad: 19 años, 9 meses
Puntos: 0
gracias campeon

aora va muy bien

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 09:48.