.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

No OnClick-events on any button/ImageButtons on any page runs any code

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :ASP.Net



I Simply drag a button from the toolbar onto a new page with a master page and a title, double click it so that I enter the Button1_Click function and sets a breakpoint and add some random code. The breakpoint nor the code never fires. I've tried this on several different pages and controllers, but with the same results: The page reloads, but no code is run.

I Have Tried:

Ive tried with three different webbrowsers with all plugins disabled.

I've tried to turn of Causes Validation, - Nothing changes.

I've tried to clean and Rebuild the project, - Still nothing.

I've tried to create a whole new project, - Does'nt work there either.

Other Information:

A RadioButtonList OnDatabound Event works, but whenever i try to do a Button or ImageButton click event the code for the event never fires. Ive programmed several webapplications in other versions of visual studio and ASP.NET but I have never encountered this problem before.

Breakpoints work in other parts of the code and the compile settings is set to DEBUG.


I am using

* Visual Studio 2010


* MVC 2.

Am I supposed to file a bug report or does anyone out there have a solution?

Many thanks in adv

View Complete Post

More Related Resource Links

Automatically inserting server-side page events into C# when using code separation

I know this is a really basic question and I have spent the last half hour trying to find an answer so please forgive me if this has been asked before (it probably has)....When I create a web page with the C# code placed in a separate file I can't seem to easily add page events (apart from Page_Load). When I open the C# class code for the page all I see in the two drop-down boxes above the code is "Default" (with no other options in the drop-down) in the left-hand box and "ApplicationInstance,form1,Page_Load(object sender,EventArgs e),Profile" in the right hand box. I can't see a way to create the code for the other page events from either of these drop-downs.If I keep the C# code in the same file (i.e., not use code separation) everything works fine - I see "Server Objects & Events, Page, Form1, etc..." in the left hand drop-down and I can create new events in the right drop-down when either Page or Form1 are selected in the left box.Am I missing something really obvious?Many thanks for any suggestions

Calling Button,s onclick event in javascript code


 Hi Experts.

I have a Button control in webpage.

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="test()"/>

When i click on button, i want to check some conditions

Button specific code


I have 2 submit buttons on my page. Right now, the only way to run the code behind with razor is to to If(IsPost). Since I have 2 buttons, how would I destinguish between the two in post? Is there a way to request a button that sent a post request?  

Reporting services in 2008 r2 how to get a report in a print button click event in my c#.net page


how to  get a report in my c#.net page button lick event also steps to call a report from asp.net to reporting services


Thanks in advance

Wicked Code: Silverlight Page Turning Made Simple


As we'll show, with just a few lines of JavaScript you can build a general-purpose framework for incorporating page turns into Silverlight 1.0 apps.

Jeff Prosise

MSDN Magazine May 2008

Button click in master page use in other pages I have to click twice. Why?


In my masterpage I have a menu with buttons. I want the buttons to do something after click. It works but I have to click twice on the button, why? What do I have to do to just to click once?

Infopath button click event in custom workflow code.


Hi All,

I have designed the infopath form(Init) and integrated with my state machine workflow. i want to access button click event (designed in Infopath form) in my workflow code.

Can you help me.




Object expected error


<input type="button' onclick="timeoutCheck()" value="Click Me!" />

it tells me Microsoft JScript runtime error: Object expected


timeoutCheck() is my script function that i declared above the input tag

can anyone tell me why i am getting this error

hello i need help , any ideas are welcome i have been working on this for two weeks now and cannot seem to be able to advance

Catch button click event in different .aspx page.


I have a button which starts processing.
I want that when ever a button is click from page1.aspx .. a count down timer should start and displayed on page2.aspx.
I am thinking of using iframe to join 2 pages.

Please let me know your suggestions.


SSIS And Sybase Source OLEDB connectivity issue with code page for character set

Hi I am using SSIS 2008 to connect the Sybase Server version 15.0.3 64-bit. The default character set id used by this Sybase server is 4 (i.e. roman8). (http://manuals.sybase.com/onlinebooks/group-charc/chg0300e/charsets/@Generic__BookTextView/1706;pt=266) I had installed Sybase Client for Sybase OLEDB Driver (ASEOLEDB) to integrate this in OLEDB Source Editor. As per guidance from one of the past MSDN forum discussion, I tried setting property of AlwaysUseDefaultCodePage property to "FALSE"  (http://social.msdn.microsoft.com/forums/en-US/sqlintegrationservices/thread/f5af9328-e1fb-48d7-a85d-1d08bb7cf0e5/). However, I am still experiencing error message as follows:- ********************************************************* Error at Package2 [Connection manager "xxxxxx.xxxxxxx"]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available.  Source: "ASEOLEDB"  Hresult: 0x80004005  Description: "[00000] [Native Code: 30061] [ASEOLEDB]Could not load code page for requested charset". An OLE DB record is available.  Source: "ASEOLEDB"  Hresult: 0x80004005  Description: "[1ZZ001] [Native Code: 30016] [ASEOLEDB]Internal Error". Error at Data Flow Task 2 [OLE DB Source [1]]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMC

Code inside page load is not executing.

  I am beginner to .Net development, so i am looking for a favour. Thanks a lot in advance!!!!!!! Question 1 :  protected void Page_Load(object sender, EventArgs e)    {        txtUserName.Text = "Focus";                txtUserName.Focus();            } I am unable to get focus to my textbox   Question 2 : I made javascript code for client side validation. function loginjs()        {            if(document.getElementById('txtUserName').value.length==0)            alert("UserName cannot be blank");            else if(document.getElementById('txtPassword').value.length==0)            alert("Password cannot be blank");                    } this code executes but it is not stopping further code execution. I mean it is only alerts but in addition to that i need to stop further execution.     &nbs

Control this objectdatasource programatically from the code behind based on different button clicks

I have a page where you can search and display other data, very simple layout. 1 Gridview and 1 objectdatasource. But i have 4 possible buttons that can populate the gridview.. i would like to control my objectdatasource from the code behind based on the button you click. here is what i have right now.. but if possible, can this source not be hardcoded like this and only built in the code behind? <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="SelectDVRInfo" TypeName="DataAccessCode"> <SelectParameters> <asp:ControlParameter ControlID="ddlDVR" Name="dvrInfo" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </asp:ObjectDataSource> I found this site with a solution to this persons issue, but i cant seem to get mine working this way. http://stackoverflow.com/questions/2404264/overwriting-controlparameters-of-datasources-in-code-behind I have  this as the code behind right now when you press the button.. what other parameter settings am i missing and is this the right order to populate them for the source to acknowledge my values?   ObjectDataSource1.SelectMethod = "SelectDVRInfo"; ObjectDataSource1.SelectParameters["MyParameter"]

Code Behind (C#) - Postback - "If (this button was clicked) postback to this address, otherwise, do

Hello!!I have three buttons at the bottom of my form. Two of the buttons make the form invisible and make a Success message Visible.I need all three buttons to call SubmitForm Function to send us an email with the completed form.The third button is a PayPal button which I would like to postback to a different url after submitting the form via email.How can I change its Postback url in C# in the code behind.P.S. I tried Server.Transfer... got an errorThanks

Accessing controls / events on a master page from child page

I have a problem i am trying to work out the best method with my limited skills. Im using vb.net ( VS 2010  ) I am using a dll for an IFrame , which is call from code behind.  On my site I havea masterpage which has two gridviews. ( GrdViewWebBureau is the one i am using for this  query)  GrdViewWebBureau is contained within an update panel and updated on a timer control trigger. GrdViewWebBureau updates the page with file counts and status from our clients. I can click on any one of the cells and the code behind is fired. What I am trying to do is put an IFrame on the master page and every time a user clicks on the grid, the Iframe is fired up.  I have tested the iframe and vb code behind from a dummy page and it works, however when the Iframe is on the master page it doeant work.  What I am tryingh to achieve is that no matter what page a user is on the site, they will be able to click on the GrdViewWebBureau and the iframe will fire with the correct childpage. Each webPage may also have an Iframe as well, so i dont know if it is possible to make the IFrame global and just call that control ??  I have no idea if 1 this is possible with the code i have and 2, if i have the brains to understand the who what why and when. Please can you look at my code and pass anyt suggestions / help /  solutions. Master Pa

Redirecting to custom page while clicking on the user/group browse button

Hi, i have created a custom visual web part in visual studio 2010 and i deployed it into sharepoint site by creating a new page in my site. The custom page gets the data of users/groups from database and pass the users to the people picker in sharepoint.Here my question i have a document library where we upload document and get the users page popup that consists of people picker and a user/group browse button.when i click on the (book image button)browse button it will redirect to the user and group search page but here i need to replace my custom  user/group search page with the default one so please help me how to redirect to the custom page by clicking on the user/group browse button,and i need to pass the selected users to the people picker text box........please give me some solution whether this can be done or not if possibe please send me the link or some sample code how to do this   thank you.

How to manage postback on crystal Report viewer next page click button clickj

 Hi,       I am using Crystal Report on my ASP.NET Fw. 3.5 project. My report contains 100+ pages. When I click on next page button on crystal report viewer control my whole page gets postback to server and then second page appears. This take same time when first time report gets loaded.     Any suggestion how to imporve user experience in thiss case?   Nilkanth Desai   

Calling Serverside PageMethod function from an external page Client Side Code ?

there is many examples on the net about this issue .like this :http://sappidireddy.wordpress.com/2008/03/31/how-to-call-server-side-function-from-client-side-code-using-pagemethods-in-aspnet-ajax/But all javascript codes are in same aspx file including codebehind WebMethodsI wantto call a pagemethod from a js which is in another page.something like this : (javascript code but not in same aspx)PageMethods("www.externalpage.com").GetContactName(ctrl.value, CallSuccess, CallFailed, dest)).or calling WebMethods from javascript must only be defined in codebehind with linked aspx fileonly avaible in same aspx ?cant I call a Webmethod in a.aspx from a javascript in b.aspx ?any clue ?thanks.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend