Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/07/2004, 16:50
Avatar de Fher
Fher
 
Fecha de Ingreso: febrero-2003
Ubicación: En algun lugar de cancun
Mensajes: 384
Antigüedad: 22 años, 1 mes
Puntos: 0
ayuda con AddHandler but.Click, AddressOf But_Click

ya tenia como un que no posteo jejeje.. pero ahora haciendo unas pruebas con el panel me he topado con un problemita que me ha costado un poco y con este evento AddHandler button.Click, AddressOf But_Click y todo porque hagarre el panel que tiene de ejemplo el generar textbox en base a un DropDownList y se me ocurrio que cuando escoja cualquier opcion me genere un boton y este al darle click se valla a otra pagina, pero no me he logrado que mi boton funcione, este es el error

'Public Event Click(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.


estoy aprendiendo y es tiempo de preguntar

este es mi codigo
<html>
<head>

<script language="VB" runat="server">

Sub Page_Load(sender As Object, e As EventArgs)

If Check1.Checked Then
Panel1.Visible = False
Else
Panel1.Visible = True
End If


End Sub
sub cambiar(sender As Object, e As EventArgs)
dim i
dim numcajas
numcajas = CInt(DropDown2.SelectedItem.Value)

For i = 1 To numcajas
Dim tcaja As System.Web.UI.WebControls.TextBox = New System.Web.UI.WebControls.TextBox()
tcaja.Text = i
tcaja.ID = "TextBox" & i
Panel1.Controls.Add(tcaja)
Panel1.Controls.Add(new LiteralControl("<br>"))
Next
Dim but As System.Web.UI.WebControls.button = New System.Web.UI.WebControls.button()
but.Text ="adasd"
***************************
ERROR
but.Click ="But_Click"
AddHandler but.Click, AddressOf But_Click

Panel1.Controls.Add(but)

**********************************
end sub

public But_Click(sender As Object, e As EventArgs)
response.Redirect("uno.aspx")

End Sub
</script>

</head>
<body>

<h3><font face="Verdana">cuartos</font></h3>


<form runat=server>

<asp:Panel id="Panel1" runat="server"
BackColor="gainsboro"
Height="200px"
Width="300px">
cuartos por habitacion


</asp:Panel>

<br>

cuartos:
<asp:DropDownList id=DropDown2 runat="server" AutoPostBack="True" OnSelectedIndexChanged="cambiar">
<asp:ListItem Value="0">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
</asp:DropDownList>

<p>
<asp:CheckBox id="Check1" Text="Hide Panel" runat="server"/>

<p>
<asp:Button Text="Refresh Panel" runat="server"/>

</font>
</form>

</body>
</html>

**** gracias
__________________
solo firma

Última edición por Fher; 15/07/2004 a las 16:52