Ajax makes button visible but then throws error on that button's clickhttps://forums.asp.net/t/2015161.aspx?Ajax+makes+button+visible+but+then+throws+error+on+that+button+s+clickTue, 18 Nov 2014 09:28:01 -080020151615799991https://forums.asp.net/p/2015161/5799991.aspx?Ajax+makes+button+visible+but+then+throws+error+on+that+button+s+clickAjax makes button visible but then throws error on that button's click
<p>I have an asp (vb.net) page with a table on it for layout purposes. There are some buttons in the table. When I click on one button, it makes another row of buttons become visible. I have placed the table within a radajax panel because I would like those
button clicks&nbsp;to just update just that table, not the rest of the page.&nbsp; But when I click on one of the newly visible buttons I get a 404 javascript error.&nbsp; I'm thinking that because those buttons were not visible on page load, they did not get properly hooked
up with the&nbsp;ajaxpanel?&nbsp; Does anybody know how to make this work.</p>
<p>Here is the HTML:</p>
<pre class="prettyprint ">&lt;telerik:RadAjaxPanel runat = &quot;server&quot;&gt;
&lt;asp:Table ID=&quot;Table1&quot; runat=&quot;server&quot; &gt;
&lt;asp:TableRow ID = &quot;rowLast&quot;&gt;
&lt;asp:TableCell Width=&quot;200px&quot; HorizontalAlign=&quot;Right&quot; Font-Bold = &quot;true&quot; &gt;
&lt;asp:Label ID=&quot;Label1&quot; runat=&quot;server&quot; Text=&quot;Last ARS Heat:&quot; CssClass=&quot;bhFormTitle&quot; &gt; &lt;/asp:Label&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign = &quot;Center&quot;&gt;
&lt;asp:Label ID=&quot;lblLastHeatID&quot; runat=&quot;server&quot; Text=&quot;&quot; CssClass=&quot;bhFormTitle&quot; &gt; &lt;/asp:Label&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign = &quot;Left&quot; columnspan = &quot;2&quot;&gt;
&lt;asp:Label ID=&quot;lblLastHeatStatus&quot; runat=&quot;server&quot; Text=&quot;&quot; CssClass=&quot;bhFormTitle&quot; width = &quot;200px&quot;&gt; &lt;/asp:Label&gt;
&lt;/asp:TableCell&gt;
&lt;/asp:TableRow&gt;
&lt;asp:TableRow ID = &quot;rowNext&quot; &gt;
&lt;asp:TableCell Width=&quot;200px&quot; HorizontalAlign=&quot;Right&quot; Font-Bold = &quot;true&quot; &gt;
&lt;asp:Label ID=&quot;Label2&quot; runat=&quot;server&quot; Text=&quot;Next Planned ARS Heat:&quot; CssClass=&quot;bhFormTitle&quot; &gt; &lt;/asp:Label&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign = &quot;Center&quot;&gt;
&lt;asp:Label ID=&quot;lblNextHeatID&quot; runat=&quot;server&quot; Text=&quot;&quot; CssClass=&quot;bhFormTitle&quot; &gt; &lt;/asp:Label&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign = &quot;Left&quot; columnspan = &quot;2&quot;&gt;
&lt;asp:Label ID=&quot;lblNextHeatStatus&quot; runat=&quot;server&quot; Text=&quot;&quot; CssClass=&quot;bhFormTitle&quot; width = &quot;200px&quot;&gt; &lt;/asp:Label&gt;
&lt;/asp:TableCell&gt;
&lt;/asp:TableRow&gt;
&lt;asp:TableRow ID = &quot;rowChangeButtons&quot; &gt;
&lt;asp:TableCell Width=&quot;200px&quot; HorizontalAlign=&quot;Right&quot;&gt;
&lt;telerik:RadButton ID=&quot;btnChange&quot; text = &quot;Change&quot; runat=&quot;server&quot; width = &quot;120px&quot; UseSubmitBehavior = &quot;false&quot; tooltip = &quot;Enter a new heat as the Next Planned Heat. &quot;&gt; &lt;/telerik:RadButton&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign=&quot;Center&quot;&gt;
&lt;telerik:RadButton ID=&quot;btnDelete&quot; text = &quot;Delete&quot; runat=&quot;server&quot; width = &quot;110px&quot; UseSubmitBehavior = &quot;false&quot; tooltip = &quot;Delete the Next Planned Heat.&quot; &gt; &lt;/telerik:RadButton&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign=&quot;Center&quot;&gt;
&lt;telerik:RadButton ID=&quot;btnRequest&quot; text = &quot;Request Override&quot; runat=&quot;server&quot; width = &quot;110px&quot; UseSubmitBehavior = &quot;false&quot; tooltip = &quot;Send Email to Quality requesting override permission to run ARS.&quot; &gt; &lt;/telerik:RadButton&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign=&quot;Center&quot;&gt;
&lt;telerik:RadButton ID=&quot;btnOverride&quot; text = &quot;Override&quot; runat=&quot;server&quot; width = &quot;110px&quot; UseSubmitBehavior = &quot;false&quot; tooltip = &quot;Enter Override code provided by Quality to approve this heat.&quot;&gt; &lt;/telerik:RadButton&gt;
&lt;/asp:TableCell&gt;
&lt;/asp:TableRow&gt;
&lt;asp:TableRow ID = &quot;rowSetupNew&quot; Visible = &quot;false&quot;&gt;
&lt;asp:TableCell Width=&quot;200px&quot; HorizontalAlign=&quot;Right&quot; Font-Bold = &quot;true&quot; &gt;
&lt;asp:Label ID=&quot;Label3&quot; runat=&quot;server&quot; Text=&quot;Enter Heat ID&quot; CssClass=&quot;bhFormTitle&quot; &gt; &lt;/asp:Label&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign = &quot;Center&quot;&gt;
&lt;telerik:RadTextBox ID=&quot;txtNewHeatID&quot; width = &quot;110px&quot; runat=&quot;server&quot;&gt; &lt;/telerik:RadTextBox&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign = &quot;Center&quot;&gt;
&lt;telerik:RadButton ID=&quot;btnValidate&quot; text = &quot;Set as Next Heat&quot; runat=&quot;server&quot; width = &quot;110px&quot; UseSubmitBehavior = &quot;false&quot; tooltip = &quot;Save this Heat Number as the Next Planned Heat.&quot; &gt; &lt;/telerik:RadButton&gt;
&lt;/asp:TableCell&gt;
&lt;asp:TableCell Width=&quot;125px&quot; HorizontalAlign = &quot;Center&quot;&gt;
&lt;telerik:RadButton ID=&quot;btnCancel&quot; text = &quot;Cancel&quot; runat=&quot;server&quot; width = &quot;110px&quot; UseSubmitBehavior = &quot;false&quot; &gt; &lt;/telerik:RadButton&gt;
&lt;/asp:TableCell&gt;
&lt;/asp:TableRow&gt;
&lt;asp:TableRow ID = &quot;rowWarning&quot; Visible = &quot;false&quot;&gt;
&lt;asp:TableCell HorizontalAlign=&quot;Center&quot; columnspan = &quot;4&quot; Font-Bold = &quot;false&quot; &gt;
&lt;asp:Label ID=&quot;lblWarning&quot; runat=&quot;server&quot; Text=&quot;If you set a new Next Planned Heat, approval will be removed from the current planned heat.&quot; Font-Bold = &quot;false&quot; ForeColor = &quot;Red&quot;&gt; &lt;/asp:Label&gt;
&lt;/asp:TableCell&gt;
&lt;/asp:TableRow&gt;
&lt;/asp:Table&gt;
&lt;/telerik:RadAjaxPanel&gt;
</pre>
<p>In the simplest scenario&nbsp;when they click on btnChange, I want rowSetupNew to appear.&nbsp; When they click on btnCancel within rowSetupNew, then rowSetupNew should become invisible again. Right now clicking btnChange works as expected but clicking btnCancel does
not.</p>
<p>I tried this other ways as well including using a RadAjaxMananger and setting the ajax settings but all of them had the same problem. Any button that was not visible at the start throws a javascript error.&nbsp; I also tried setting the rows visible in the html
and then making them invisible in the prerender event if not ispostback but that didn't help either.</p>
<p>Thanks for any help.</p>
<p>&nbsp;</p>
2014-10-28T16:54:31-07:005800256https://forums.asp.net/p/2015161/5800256.aspx?Re+Ajax+makes+button+visible+but+then+throws+error+on+that+button+s+clickRe: Ajax makes button visible but then throws error on that button's click
<p>Hi lisandlaur,</p>
<p>According to your description, if you want to make the button visible or invisible, you could set the visible property on button click event.</p>
<p>For the 404 error, I suppose the reason is&nbsp;that the page cannot be&nbsp;found. So, please check the URL.</p>
<p>Here is a sample about Show/Hide Web Controls in RadAjaxPanel, you could reference to it.</p>
<p><a href="http://demos.telerik.com/aspnet-ajax/ajax/examples/common/showingwebcontrols/defaultcs.aspx">http://demos.telerik.com/aspnet-ajax/ajax/examples/common/showingwebcontrols/defaultcs.aspx</a></p>
<p>And,&nbsp;for more information about 404 error, you could refer to the following link.</p>
<p><a href="http://support.microsoft.com/kb/827667">http://support.microsoft.com/kb/827667</a></p>
<p>Best Regards,<br>
Dillion</p>
2014-10-29T05:25:42-07:005800379https://forums.asp.net/p/2015161/5800379.aspx?Re+Ajax+makes+button+visible+but+then+throws+error+on+that+button+s+clickRe: Ajax makes button visible but then throws error on that button's click
<p>Thanks for your response Zhi.&nbsp;</p>
<p>I do know how to make the buttons visible/invisible.&nbsp; Clicking btnChange makes btnCancel visible just fine. The trouble is that btnCancel does not then respond to its own button click. From googling I do believe it's because its in the same update panel
but was not visible at page load time.</p>
<p>I am not trying to go to another page so the problem is not page not found. Really the btnCancel should just make itself invisible and make btnChange enabled again.</p>
<p>&nbsp;</p>
<p>Lisa</p>
2014-10-29T08:37:21-07:005800666https://forums.asp.net/p/2015161/5800666.aspx?Re+Ajax+makes+button+visible+but+then+throws+error+on+that+button+s+clickRe: Ajax makes button visible but then throws error on that button's click
<p>Hi Lisa,</p>
<p>From your description and with reference to&nbsp;the demo, I suppose the issue is related to that you doesn't set AjaxSetting for btnCancel control in the&nbsp;RadAjaxManager.</p>
<p>More information, I suggest you reference to the RadAjaxManager in the demo.</p>
<p>This is the demo address: <a href="http://demos.telerik.com/aspnet-ajax/ajax/examples/common/showingwebcontrols/defaultcs.aspx">
http://demos.telerik.com/aspnet-ajax/ajax/examples/common/showingwebcontrols/defaultcs.aspx</a></p>
<p>Besides, you could also reference to the steps for setting up the&nbsp;btnChange control.</p>
<p>Best Regards,<br>
Dillion</p>
2014-10-29T21:53:13-07:005812779https://forums.asp.net/p/2015161/5812779.aspx?Re+Ajax+makes+button+visible+but+then+throws+error+on+that+button+s+clickRe: Ajax makes button visible but then throws error on that button's click
<p>FINALLY found the problem.&nbsp; I have been banging my head on Ajax for a long time now with all sorts of things like this just not working the way it is supposed to.&nbsp; Following everyone's examples and suggestions to the letter and things that absolutely should
work, just didn't.&nbsp; Then I realized that the code always worked in my test project where the ajaxed test page was opened as the Start page.&nbsp; But that same code didn't work in my real project!!!</p>
<p>The key was I generally use Server.Transfer to move from page to page. I don't know why, but this screws up ajax on the page.&nbsp; When I changed to using Response.Redirect to move to the ajaxed page, all those little weird things that just didn't work all worked
beautifully.&nbsp; So after months of hating Ajax, I now love it!</p>
<p>Thanks to all for trying to help.</p>
2014-11-18T09:28:01-08:00