内部更新面板按钮OnClick在面板内的文本框提供验证错误后未触发 [英] Inside Update Panel Button OnClick is not firing after textbox inside panel gives Validation error

查看:55
本文介绍了内部更新面板按钮OnClick在面板内的文本框提供验证错误后未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正面临按钮OnClick事件的问题。场景是我有一个更新面板,里面有几个控件。当我在更新面板中将文本框留空时,其旁边的按钮的Onclick事件不会触发。在按钮之前填写文本框也不是强制性的。

在Onclick事件上有一个服务调用。页面底部还有下一个按钮。



下面是代码片段:



Hi,

I am facing a problem with OnClick event of my button. Scenario is that I have an Update panel and few controls inside it. When i left a textbox empty in the update panel then the Onclick event of button next to it doesn't fire. Also its not mandatory to fill textbox before button.
There is a service call on Onclick event. Also there is Next button at the bottom of the page.

Below is the code snippet:

<asp:UpdatePanel ID="updatePnlPropertyType" runat="server">
                    <ContentTemplate>

 <div id="rebuild" class="elements">

                    <label class="formLabel">
                        Rebuild Cost (£):<span class="required">*</span></label>
                    <asp:TextBox runat="server" name="ddrebuild" ID="ddrebuild" CssClass="inputRebuildCost"

                        onBlur="changeClass('rebuild', 0);" onFocus="changeClass('rebuild', 1);"

                        onChange="changeClass('rebuild', 0);"></asp:TextBox>

  <VAM:RangeValidator ID="vrebuildrange" runat="server" ControlIDToEvaluate="ddrebuild"

                       //Validation code here

                </VAM:RangeValidator>

 </div>

<div id="calc_rebuild_cost" runat="server">
                    <vam:ImageButton ID="btnRebuildCalc" runat="server"  Group="calc_rebuild_cost"   CssClass="LeftPaddedButton" AlternateText="Calculate Rebuild Cost" ImageUrl="~/img/Images/calc_rebuild_cost.png"  OnClick="btnRebuildCalc_Click"/>
                </div>

</ContentTemplate>
        </asp:UpdatePanel>







请给我一个sol尽快。



谢谢





大家好,



我已将我的设计代码更改为以下但仍然按钮Onclick在验证消息后没有触发:






Please give me a sol ASAP.

Thanks


Hi all,

I have changed my desgin code to following but still button Onclick is not firing after validation message:

<asp:UpdatePanel ID="updatePnlPropertyType" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>

 <div id="rebuild" class="elements">
                    <a href="javascript:helpTips('rebuild', 1);" class="help" title="help">help</a>
                    <label class="formLabel">
                        Rebuild Cost (£):<span class="required">*</span></label>
                    <asp:TextBox runat="server" name="ddrebuild" ID="ddrebuild" CssClass="inputRebuildCost"

                        onBlur="changeClass('rebuild', 0);" onFocus="changeClass('rebuild', 1);"

                        onChange="changeClass('rebuild', 0);"></asp:TextBox>
                </div>

 <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                     <div id="calc_rebuild_cost" runat="server">
                    <vam:ImageButton ID="btnRebuildCalc" runat="server" CssClass="LeftPaddedButton" AlternateText="Calculate Rebuild Cost" ImageUrl="~/img/Images/calc_rebuild_cost.png"  OnClick="btnRebuildCalc_Click"/>
                </div>
                <div id="rebuild_cost" class="rebuildMsgtxt" runat="server">
                    <asp:Literal ID="litRebuildCost" runat="server"></asp:Literal>
                </div>

                  </ContentTemplate>
        </asp:UpdatePanel>
 </ContentTemplate>
</asp:UpdatePanel>





现在我已将按钮放在另一个嵌套面板中,但事件未启动。

Plz帮助我...



Now i have placed button inside another nested panel but event is not firing up.
Plz help me out...

推荐答案

确保您运行的页面没有任何运行时错误。还要检查这个与你的问题非常相似的解决方案。



http://stackoverflow.com/questions/7650592/button-inside-update-panel-is-not-triggered-in-asp-net [ ^ ]
Make sure the page you are running do not have any run-time error. also check this solution which closely resembles with your problem.

http://stackoverflow.com/questions/7650592/button-inside-update-panel-is-not-triggered-in-asp-net[^]


<asp:TextBox ID="txt" runat="server"></asp:TextBox>
 <asp:RequiredFieldValidator ID="req1" runat="server" ControlToValidate="txt" ErrorMessage="Please Enter Value"></asp:RequiredFieldValidator>
 <asp:Button ID="btn" runat="server" onclick="btn_Click" CausesValidation="false"/>


Plz提供验证码



Plz give your validation code

<VAM:RangeValidator ID="vrebuildrange" runat="server" ControlIDToEvaluate="ddrebuild"

                       //Validation code here

                </VAM:RangeValidator>



或你在范围验证中可能有任何错误。你可以设置


or u might have did any wrong in rangevalidation. U might set

minimumValue

属性

rangevalidator 

control



请检查并告诉我..

control

do check and let me know..


这篇关于内部更新面板按钮OnClick在面板内的文本框提供验证错误后未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆