Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > asp:button event not firing

Reply
Thread Tools

asp:button event not firing

 
 
csgraham74
Guest
Posts: n/a
 
      09-11-2005
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

 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      09-11-2005
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!
--
Nathan Sokalski
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/

"csgraham74" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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
>



 
Reply With Quote
 
 
 
 
csgraham74
Guest
Posts: n/a
 
      09-11-2005
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

 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      09-11-2005
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!
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"csgraham74" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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
>



 
Reply With Quote
 
JIMCO Software
Guest
Posts: n/a
 
      09-11-2005
Nathan Sokalski wrote:
> 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




 
Reply With Quote
 
csgraham74
Guest
Posts: n/a
 
      09-17-2005
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
firing button click event before page load event.....???? GauravGupta ASP .Net 4 01-19-2012 06:52 AM
TkInter bind() event is not firing event trigger Anthony Papillion Python 3 06-23-2010 12:55 AM
master page does not change due to preinit event not firing franchise63 General Computer Support 0 02-13-2008 09:18 AM
DataGrid ItemCommand event not firing if not first page =?Utf-8?B?ZGFuYw==?= ASP .Net 3 10-26-2005 05:24 PM
Control not maintaing viewState and PostBack not firing event. Don ASP .Net Building Controls 1 05-16-2005 01:45 PM



Advertisments