Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Raisepostbackevent

  1. #1

    Raisepostbackevent

    Nessuno ha sperimentato con questo simpatico eventco che permette di intercettare il postback lato client??

    Nessuno sa dirmi perché in qesuto codice (sotto) che allego il postback viene eseguito (e quindi il javascript associato al div) ma non mi passa per il RaisePostback???
    Questo sarebbe veramente risolutivo.

    ---- Codice ----

    Imports System.ComponentModel
    Imports System.Web.UI

    <DefaultProperty("Text"), ToolboxData("<{0}:CustomWebControls runat=server></{0}:CustomWebControls>")> Public Class CustomWebControls
    Inherits System.Web.UI.WebControls.WebControl
    Implements IPostBackDataHandler
    Implements IPostBackEventHandler

    Dim _text As String
    <Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As String
    Get
    Return _text
    End Get

    Set(ByVal Value As String)
    _text = Value
    End Set
    End Property
    Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
    output.Write("<div OnClick=""javascript:" & Page.GetPostBackEventReference(Me) & """>Clickare</div>")
    output.Write("
    ")
    output.Write([Text])
    End Sub

    Public Function LoadPostData(ByVal postDataKey As String, ByVal postCollection As System.Collections.Specialized.NameValueCollection ) As Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData
    Return True
    End Function

    Public Sub RaisePostDataChangedEvent() Implements System.Web.UI.IPostBackDataHandler.RaisePostDataCh angedEvent

    End Sub

    Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements IPostBackEventHandler.RaisePostBackEvent
    Text = Text + eventArgument
    End Sub
    End Class

  2. #2
    uppete
    nessuno risponde?
    eppure è strettamente collegato al post precedente

  3. #3
    risolto!!
    Il codice era giusto solo che aggiungevo il custom web control a runtime. Aggiungendolo a design time tutto funziona. Fico!

    Imports System.ComponentModel
    Imports System.Web.UI

    Namespace mycustcontrol
    <DefaultProperty("Text"), ToolboxData("<{0}:CustomWebControls runat=server></{0}:CustomWebControls>")> Public Class CustomWebControls
    Inherits System.Web.UI.WebControls.WebControl
    Implements IPostBackEventHandler
    Implements IPostBackDataHandler

    Dim _text As String
    <Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As String
    Get
    Return _text
    End Get

    Set(ByVal Value As String)
    _text = Value
    End Set
    End Property
    Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
    output.Write("<div OnClick=""javascript:" & Page.GetPostBackEventReference(Me) & """>Clicckare</div>")
    output.Write("
    ")
    output.Write([Text])
    End Sub
    Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements System.Web.UI.IPostBackEventHandler.RaisePostBackE vent
    Me.Text = "hai clickato"
    End Sub

    Public Function LoadPostData(ByVal postDataKey As String, ByVal postCollection As System.Collections.Specialized.NameValueCollection ) As Boolean Implements System.Web.UI.IPostBackDataHandler.LoadPostData

    End Function

    Public Sub RaisePostDataChangedEvent() Implements System.Web.UI.IPostBackDataHandler.RaisePostDataCh angedEvent

    End Sub
    End Class
    End Namespace

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 © 2026 vBulletin Solutions, Inc. All rights reserved.