<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx</link><description>I am often asked how to intercept the postback when an &amp;lt;asp:Button/&amp;gt; is clicked. The answer is not immediately obvious but once you know the trick it is very straight forward. What makes this tricky is that an &amp;lt;asp:Button/&amp;gt; renders as &amp;lt;input</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#70026</link><pubDate>Tue, 11 Oct 2005 09:01:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:70026</guid><dc:creator>jonathangreensted</dc:creator><description>I have the same scenario with Mav above, my user control contains the 3 controls,&lt;br&gt;&lt;br&gt;control 1: textbox&lt;br&gt;control 2: requiredfieldvalidator&lt;br&gt;control 3: submit bitton&lt;br&gt;&lt;br&gt;I need the confirmation dialog to show only after there's no error from the requiredfieldvalidator.&lt;br&gt;&lt;br&gt;Any ideas?&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=70026" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#65035</link><pubDate>Fri, 02 Sep 2005 06:36:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:65035</guid><dc:creator>jonathangreensted</dc:creator><description>I am having an issue with submission of data. My webform contains 3 controls. &lt;br&gt;Control 1: TextBox&lt;br&gt;Control 2: RequiredFieldValidator&lt;br&gt;Control 3: Submit button.&lt;br&gt;&lt;br&gt;When I click on the Submit button, and if the text box is empty. The error message from the RequiredFieldValidator is shown. So I correct the error by entering some data and hit on Submit button again.&lt;br&gt;But the event doesn't get fire.&lt;br&gt;&lt;br&gt;The event is in a seprate abc.aspx.cs.&lt;br&gt;&lt;br&gt;Any clue.&lt;br&gt;&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=65035" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#63084</link><pubDate>Wed, 17 Aug 2005 19:52:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:63084</guid><dc:creator>jonathangreensted</dc:creator><description>Hello,&lt;br&gt;&lt;br&gt;I have a button.  When I click it, I want to check something before it shows a popup-window with 2 buttons (OK and Cancel).  When I click OK -&amp;gt; do other stuff.  When Cancel -&amp;gt; do nothing.&lt;br&gt;&lt;br&gt;Suggestions&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=63084" width="1" height="1"&gt;</description></item><item><title>re:ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#60673</link><pubDate>Mon, 01 Aug 2005 03:26:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:60673</guid><dc:creator>TrackBack</dc:creator><description>ASP.net Button submission controlooeess&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=60673" width="1" height="1"&gt;</description></item><item><title>re:ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#57864</link><pubDate>Sun, 17 Jul 2005 07:33:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:57864</guid><dc:creator>TrackBack</dc:creator><description>ASP.net Button submission controlooeess&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=57864" width="1" height="1"&gt;</description></item><item><title>My button is not working on the server but locally it working fine</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#56454</link><pubDate>Mon, 04 Jul 2005 11:29:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:56454</guid><dc:creator>jonathangreensted</dc:creator><description>Hello All,&lt;br&gt;&lt;br&gt;I uplaaded my application on the hosting server. everything is working fine there but some pages having the problem like button is not working. I used the validation control lets take Required file validator... If i clink the button then validator is fired but i fill the text box then button does not work.&lt;br&gt;Except some pages, all pages are workign fine on the server.&lt;br&gt;Can somebody help me out from this proble.&lt;br&gt;&lt;br&gt;Regards&lt;br&gt;Amit&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=56454" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#54511</link><pubDate>Thu, 23 Jun 2005 02:01:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:54511</guid><dc:creator>jonathangreensted</dc:creator><description>Great article, it helped a lot. Thanks.&lt;br&gt;&lt;br&gt;&lt;br&gt;I did one thing different though. I was getting a 'function not defined' javascrpt error, so I removed the following from Page_Load, and put the script block in the &amp;lt;head&amp;gt; of my .aspx file, and it worked just as well.  &lt;br&gt;&lt;br&gt; string jsConfirm = @&amp;quot;&amp;lt;script language='javascript'&amp;gt;&lt;br&gt;            function confirmButton()&lt;br&gt;            {&lt;br&gt;                var agree=confirm('Are you sure you wish to continue?');&lt;br&gt;&lt;br&gt;                if (agree)&lt;br&gt;                    return true;&lt;br&gt;                else&lt;br&gt;                    return false;&lt;br&gt;            }&lt;br&gt;            &amp;lt;/script&amp;gt;&amp;quot;;&lt;br&gt;&lt;br&gt; Page.RegisterClientScriptBlock(&amp;quot;confirm&amp;quot;,jsConfirm);&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=54511" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#53145</link><pubDate>Wed, 15 Jun 2005 18:00:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:53145</guid><dc:creator>jonathangreensted</dc:creator><description>This was great&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=53145" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#51427</link><pubDate>Thu, 09 Jun 2005 22:44:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:51427</guid><dc:creator>jonathangreensted</dc:creator><description>Hi I tried using it user control written in VB.Net but is not working. My button name in UC is ButtonDelete.  Can someone please let me know the code in VB.&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;Mahesh&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=51427" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#50452</link><pubDate>Sat, 04 Jun 2005 23:04:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:50452</guid><dc:creator>jonathangreensted</dc:creator><description>I've resolved mu issue now and there is actually a very simple solution.&lt;br&gt;&lt;br&gt;At the page level there is a method called RegisterOnSubmitStatement(id, script)&lt;br&gt;&lt;br&gt;So in my user control I simply call&lt;br&gt;&lt;br&gt;Page.RegisterOnSubmitStatement(&amp;quot;RenderHTML&amp;quot;, &amp;quot;getHTML('txtArticle');&amp;quot;)&lt;br&gt;&lt;br&gt;then when the page postsbacks it will call the necessary code.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=50452" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#50448</link><pubDate>Sat, 04 Jun 2005 22:09:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:50448</guid><dc:creator>jonathangreensted</dc:creator><description>I had this figured out for a while but what I am strugling with is a similar concept to do with user controls.&lt;br&gt;&lt;br&gt;for example I have a user control that before it is submitted needs to call a javascript event to prepare it for submission. Now if the submit button was located on the control I could wire the event like in your sample code.&lt;br&gt;&lt;br&gt;however this control is dropped on to a page to be used in larger form with a submit button. I can't expect users of my control to have to wire up their buttons for my user control so is there a way round this?&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=50448" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#48783</link><pubDate>Wed, 25 May 2005 00:54:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:48783</guid><dc:creator>jonathangreensted</dc:creator><description>Hello&lt;br&gt;&lt;br&gt;I searched for this too much ..&lt;br&gt;Many thanks, very very usefull.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=48783" width="1" height="1"&gt;</description></item><item><title>re:ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#47396</link><pubDate>Wed, 18 May 2005 02:39:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:47396</guid><dc:creator>TrackBack</dc:creator><description>^_~,pretty good!csharpsseeoo&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=47396" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#46770</link><pubDate>Fri, 13 May 2005 02:09:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:46770</guid><dc:creator>jonathangreensted</dc:creator><description>while this is nice... check out this example which handles things a little nicer (like allowing to disable the submit button when its clicked, but still do the postback)&lt;br&gt;&lt;br&gt;&lt;a target="_new" href="http://aspzone.com/articles/207.aspx?Pending=true"&gt;http://aspzone.com/articles/207.aspx?Pending=true&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=46770" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#44042</link><pubDate>Sat, 23 Apr 2005 22:46:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:44042</guid><dc:creator>jonathangreensted</dc:creator><description>Your code always posts. This code is not complete. The solution is bogus.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=44042" width="1" height="1"&gt;</description></item><item><title>re:ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#42820</link><pubDate>Sat, 16 Apr 2005 08:16:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:42820</guid><dc:creator>TrackBack</dc:creator><description>^_~&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=42820" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#41406</link><pubDate>Sat, 09 Apr 2005 12:01:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:41406</guid><dc:creator>jonathangreensted</dc:creator><description>how to get return value provided by function in javascript.&lt;br&gt;&lt;br&gt;except using hidden variables is there any other way.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=41406" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#41403</link><pubDate>Sat, 09 Apr 2005 11:54:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:41403</guid><dc:creator>jonathangreensted</dc:creator><description>Wow it's really a great code. but for me whether u have selected any of the item ok or cancel page is always posted to server is there something missed in the code or it may be my mistake.&lt;br&gt;&lt;br&gt;help me.&lt;br&gt;thanks.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=41403" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#39201</link><pubDate>Tue, 22 Mar 2005 03:31:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:39201</guid><dc:creator>jonathangreensted</dc:creator><description>Hi,&lt;br&gt;&lt;br&gt;This code has been really very helpful. Could someone please suggest the same if I dont want to use some server control such as a Button. What I want is to have a similar confirm dialog box when the page is loaded and not just when a buttom is clicked.&lt;br&gt;I would appreciate your help.&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;Soumitra&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=39201" width="1" height="1"&gt;</description></item><item><title>re: ASP.net Button submission control</title><link>http://msmvps.com/blogs/jonathangreensted/archive/2004/11/24/20495.aspx#37318</link><pubDate>Tue, 01 Mar 2005 20:31:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:37318</guid><dc:creator>jonathangreensted</dc:creator><description>There are other browsers?!&lt;br&gt;&lt;br&gt;Jonathan&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=37318" width="1" height="1"&gt;</description></item></channel></rss>