Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. AJAX server control not throwing events

AJAX server control not throwing events

Scheduled Pinned Locked Moved ASP.NET
databasedesignsysadmindockertools
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tad McClellan
    wrote on last edited by
    #1

    So I've been looking at this for 2 days now. I've created a simple custom control, a button to fill a lable with the current time from the server. I've tried to inherit updatepanel and I've tried updatepanel as a composit control but no luck. I click on the button and nothing happens. Here is the code if you think you can set me straight... Imports System.Web Imports System.Web.UI Imports System.Web.Script.Serialization Imports System.Web.UI.WebControls Public Class FormFooter Inherits WebControl Implements IPostBackEventHandler Public Event Click As EventHandler Private _SM As ScriptManager Protected Overrides Sub CreateChildControls() MyBase.CreateChildControls() Dim parent As Control Dim container As Control If SM Is Nothing OrElse Not SM.EnablePartialRendering Then container = New Control parent = New Control Else Dim up As UpdatePanel = New UpdatePanel up.ID = "UpPan2" Dim trigger As AsyncPostBackTrigger = New AsyncPostBackTrigger() trigger.ControlID = ClientID trigger.EventName = "Click" up.Triggers.Add(trigger) container = up.ContentTemplateContainer parent = up End If Dim cmdUpdate As Button Dim lblUpdate As Label lblUpdate = New Label lblUpdate.ID = ClientID & "$txtTime" lblUpdate.Text = " N O W" cmdUpdate = New Button cmdUpdate.Text = "Add Time" cmdUpdate.ID = ClientID & "$cmdUpdate" container.Controls.Add(lblUpdate) container.Controls.Add(cmdUpdate) Controls.Add(parent) End Sub Private ReadOnly Property SM() As ScriptManager Get If _SM Is Nothing Then _SM = ScriptManager.GetCurrent(Page) End If Return _SM End Get End Property Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements System.Web.UI.IPostBackEventHandler.RaisePostBackEvent Select Case eventArgument Case "click" OnClick(New EventArgs) End Select End Sub Protected Sub OnClick(ByVal e As EventArgs) SM.RegisterDataItem(Me, "<h3>Sending data from click3</h3>") RaiseEvent Click(Me, e) End Sub End Class

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups