|
Subject:
|
Calling Javascript Function With Attributes.Add
|
|
Posted By:
|
OutCaster
|
Post Date:
|
1/27/2006 11:28:57 AM
|
Hi,
I'm getting an error when trying to use the attributes.add method.
So in my vb file, I have the following declared :
Dim Disable_btn As Button
In my page_load I have
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ... Try Disable_btn.Attributes.Add("OnClick", "MM_callJS('StopTimer()')") Catch ex As Exception Response.Write("this doesn't work") End Try .... End Sub
In my aspx file I have asp:Button ID="Disable_btn" Text="Disable" CommandName="Disable" Runat="server"
Anyone see what's wrong? I have a feeling that I'm not declaring the variable correctly or that I need to add something to the parameters in the page_load declaration?
Thanks
|
|
Reply By:
|
planoie
|
Reply Date:
|
1/27/2006 8:53:51 PM
|
You need to declare the button with the protected keyword so that the markup declaration is matched up with it.
Protected Disable_btn As Button
-Peter
|