CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001
    Location
    Israel
    Posts
    116

    runs at server Question

    Hi
    I have a web control asp:textbox runat=server
    I want to add a client side script that handles the OnTextChanged event
    but I’m getting an error:
    'myScriptFunc' is not a member of 'ASP.myPageName_aspx'

    I understand that the page search for the method at the server side

    How do I add a client side code to a web control that runs at server?

    Thanks
    Limor

  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868
    Page will need Table1, and Label1

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here

    x = New Button()
    x.Text = "Test Button"
    x.ID = "MyButtonID2"
    x.Attributes.Add("onclick", "javascript:alert('hello - this is from the client side!!')")
    AddHandler x.Click, AddressOf DynamicClick
    Me.Table1.Rows(0).Cells(0).Controls.Add(x)

    End Sub
    Public Sub DynamicClick(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim b As Button
    b = CType(sender, System.Web.UI.WebControls.Button)
    Label1.Text = "This is from server side -- You Clicked the Button! - " & sender.id & " "
    End Sub

  3. #3
    Join Date
    Mar 2001
    Location
    Israel
    Posts
    116
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured