asp:button event not firing

C

csgraham74

Hi guys,

I posted regarding this issue the other day but i still dont have an
answer to my problem.

Basically i have imported asp.net pages from dreamweaver into visual
studio. Ive added a few controls that ive copied in from another
asp.net page that i built within visual studio. The problem is that the
asp:button does not fir an event and therefore my code behind it wont
work. The page load event is firing correctly so i think the issue
relates only to the button.

My button im using is the "btn_SearchNow" button. Can anyone tell me if
im missing any code or if they have a workaround.


Any help appreciated as i cannot seem to find a workaround.

Imports System.IO
Imports System.Data.OleDb
Imports System.Configuration.ConfigurationSettings

Public Class search
Inherits System.Web.UI.Page
Protected WithEvents Label9 As System.Web.UI.WebControls.Label
Protected WithEvents ddl_SPropType As
System.Web.UI.WebControls.DropDownList
Protected WithEvents Label13 As System.Web.UI.WebControls.Label
Protected WithEvents txt_SAddress As
System.Web.UI.WebControls.TextBox
Protected WithEvents lbl_TownCity As
System.Web.UI.WebControls.Label
Protected WithEvents ddl_STown As
System.Web.UI.WebControls.DropDownList
Protected WithEvents lbl_Postcode As
System.Web.UI.WebControls.Label
Protected WithEvents txt_SPostcode As
System.Web.UI.WebControls.TextBox
Protected WithEvents Label14 As System.Web.UI.WebControls.Label
Protected WithEvents ddl_SRentBuy As
System.Web.UI.WebControls.DropDownList
Protected WithEvents lbl_SPropertyOfTheWeek As
System.Web.UI.WebControls.Label
Protected WithEvents ddl_SPropertyOfTheWeek As
System.Web.UI.WebControls.DropDownList
Protected WithEvents dg_Properties As
System.Web.UI.WebControls.DataGrid
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Label6 As System.Web.UI.WebControls.Label
'*********************************************
Protected WithEvents btn_Searchnow As
System.Web.UI.HtmlControls.HtmlInputImage
'*********************************************
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Imagebutton1 As
System.Web.UI.WebControls.ImageButton Protected WithEvents pnl_Grid As
System.Web.UI.WebControls.Panel


#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region
 
N

Nathan Sokalski

Does your event handler have the "Handles btn_SearchNow.Click" clause at the
end of it? I have seen rare situations where this somehow gets automatically
removed, I would double check to make sure it is still there. Another easy
way to make sure something didn't accidentally get changed would be to
double-click the button in Visual Studio's Design View to see if it is
taking you to the place you think it should (If you changed the control's ID
after creating the event handler the Handles clause is not automatically
changed). Good Luck!
 
C

csgraham74

Thanks Nathan,

I think the handles part gets lost when you move or cut and paste a
control to another part of the page.

Unfortunately i have the handles btn_SearchNow.click so thats not the
problem

Thanks for the help .

any more ideas apprciated
 
N

Nathan Sokalski

I don't have any other ideas off hand. One thing I might suggest trying
would be using Visual Studio's debug feature and put a Breakpoint right at
the beginning of the event handler to see if the problem is with the handler
actually getting called or with the code inside the event handler. Good
Luck!
 
J

JIMCO Software

Nathan said:
I don't have any other ideas off hand. One thing I might suggest
trying would be using Visual Studio's debug feature and put a
Breakpoint right at the beginning of the event handler to see if the
problem is with the handler actually getting called or with the code
inside the event handler. Good Luck!

I would also check to be sure that IsPostBack evaluates as you think it
should. It could be that you are experiencing a problem that causes the
runtime to think you're not in a postback when you actually are.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003
 
C

csgraham74

Actually got this sorted. Turned out that there was a form tag in the
includes page but this just didnt throw an error. For whatever reason
it did not allow the the event of the button to fire.


Thanks for all the help

CG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top