Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    [ASP.NET VB]Eventi su controlli

    Ho una pagina di prova,
    codice:
    Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) handles CheckBox1.CheckedChanged
     TextBox1.text = "Check changed"
     'msgbox("Chk Changed")
     response.write("changed")
     exit sub
    End Sub
    
    Sub Button1_Click(sender As Object, e As EventArgs)
    response.write(textbox1.text)
     response.write("Click")
    exit sub
    end sub
    
    End Sub
    ed il codice completo è:
    codice:
    <%@ Page Language="VB" %>
    <%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
    <%@ import Namespace=" System.Diagnostics" %>
    <script runat="server">
    
        ' Insert page code here
        '
        
        
        
        Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) handles CheckBox1.CheckedChanged
         TextBox1.text = "Check changed"
         'msgbox("Chk Changed")
         response.write("changed")
         exit sub
        End Sub
        
        Sub Button1_Click(sender As Object, e As EventArgs)
        response.write(textbox1.text)
        response.write("btn click")
        exit sub
        end sub
        
       
    </script>
    <html>
    <head>
    </head>
    <body>
        <form runat="server">
            
    
    
                <asp:TextBox id="TextBox1" runat="server" ToolTip="ciao"></asp:TextBox>
                <asp:CheckBox id="CheckBox1" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" Text="Check Box"></asp:CheckBox>
                <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Cliccami"></asp:Button>
            </p>
            
    
    
                
            </p>
            
    
    
                  </p>
            
        </form>
    </body>
    </html>
    Succede questo, che al cambiamento della checkbox nn accade nulla, ma se premo il pulsante allora si scatena anche l'evento checkchanged(se è stato cambiato) altrimenti se cambio lo stato del checkbox nn accade nulla, perchè?

  2. #2

  3. #3
    le avevo già viste le msdn... e secondo vedendo gli esempi, il codice che ho postato è corretto...

  4. #4
    non mi sembra che il checkbox che hai postato abbia la proprieta' autopostback = true
    Saluti a tutti
    Riccardo

  5. #5
    Originariamente inviato da riccardone
    non mi sembra che il checkbox che hai postato abbia la proprieta' autopostback = true
    Si era quello... grazie mille!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.