1

i have this code in html. all of the button in Answer_P doesn't work but to another project same code worked right. i don't now why. Any help is very much appreciated. when i debug and click on Cancel_btn doesn't any Event or request.to anuther word don't run Cancel_btn_Click function

    <asp:UpdatePanel runat="server" ID="U" UpdateMode="Conditional">
    <ContentTemplate>
        <div class="Div" style="box-shadow: 3px 2px 24px #000000">
            <asp:Panel runat="server" ID="Show_P">
                <div style="min-width: 300px; margin: 0px auto; text-align: center">
                    <div style="padding-top: 10px">
                        <table>
                            <tr>
                                <asp:GridView runat="server" ID="GRD" DataKeyNames="ID" AutoGenerateColumns="false" OnRowCommand="OnRowCommend_Click">
                                    <Columns>
                                        <asp:BoundField HeaderText="نام" DataField="Name" />
                                        <asp:BoundField HeaderText="ایمیل" DataField="Email" />
                                        <asp:BoundField HeaderText="موضوع" DataField="Subject" />
                                        <asp:BoundField HeaderText="متن" DataField="Text" />
                                        <asp:BoundField HeaderText="پاسخ" DataField="Answer" />
                                        <asp:ButtonField ButtonType="Image" ImageUrl="../Image/Comment.png" CommandName="Answer" Text="پاسخ دادن" HeaderText="پاسخ دادن" />
                                    </Columns>
                                </asp:GridView>
                            </tr>
                        </table>
            </asp:Panel>
            <asp:Panel runat="server" ID="Answer_P">
                <table>
                    <tr>
                        <td>نام</td>
                        <td>
                            <asp:TextBox runat="server" ID="Name_txt" CssClass="Txt-class"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>ایمیل</td>
                        <td>
                            <asp:TextBox runat="server" ID="Email_txt" CssClass="Txt-class"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>موضوع</td>
                        <td>
                            <asp:TextBox runat="server" ID="Subject_txt" CssClass="Txt-class"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>متن</td>
                        <td>
                            <uc1:CK_Editor runat="server" ID="Text_CK" />
                        </td>
                    </tr>
                    <tr>
                        <td>پاسخ</td>
                        <td>
                            <uc1:CK_Editor runat="server" ID="Answer_CK" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Button runat="server" ID="Answer_btn" Text="پاسخ" CommandName="Answer" CssClass="btn-blue" /></td>
                        <td>
                            <asp:Button runat="server" ID="Cancel_btn" Text="لغو" CommandName="Cancel" CssClass="btn-blue" OnClick="Cancel_btn_Click" /></td>
                    </tr>
                </table>
            </asp:Panel>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
Keval Domadia
  • 4,768
  • 1
  • 37
  • 64

5 Answers5

0

Add this code in your page load event

using AjaxControlToolkit;

And Add ToolScriptManager instead of ScriptManager

EDIT

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server."

This issue sometimes occurs when you have a control registered as an AsyncPostbackTrigger in multiple update panels.

If that's not the problem, try adding the following right after the script manager declaration:

<script type="text/javascript" language="javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args){
        if (args.get_error() != undefined){
            args.set_errorHandled(true);
        }
    }
</script>

There are a few more solutions discussed here: http://forums.asp.net/t/1066976.aspx/9/10

Community
  • 1
  • 1
Vignesh Kumar A
  • 27,863
  • 13
  • 63
  • 115
  • i'm try this code to another project and work but to this project doesn't work and in chrom see this error Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500 – mohammad mobasher Jan 28 '14 at 10:48
  • i'm try this but doesn't wrok. – mohammad mobasher Jan 28 '14 at 10:59
0

if you want that your buttons work you must use from trigger try :

<asp:UpdatePanel runat="server" ID="U" UpdateMode="Conditional">
<ContentTemplate>
.....
 </ContentTemplate>
  <Triggers >
    <asp:AsyncPostBackTrigger ControlID="Answer_btn" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="Cancel_btn" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

if yet your botton is not work in top of your page use EnableEventValidation="false":

<%@ Page Title="" Language="C#" ...  EnableEventValidation="false" ....
mirza
  • 766
  • 2
  • 7
  • 12
0

It seems that adding UseSubmitBehavior="false" to the button definitions has solved my problem. Also You can bind cancel button with AsyncPostBackTrigger as..

<Triggers>
    <asp:AsyncPostBackTrigger ControlID="Cancel_btn" /> 
</Triggers>
angfreak
  • 993
  • 2
  • 11
  • 27
0

i solved it by this code in web.config

<pages validateRequest="false">
Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
0

I had the same problem. Just add this to your page header:

<meta http-equiv="X-UA-Compatible" content="IE=9" />

See my answer on this thread:

https://stackoverflow.com/a/33156665/1821637

Community
  • 1
  • 1
Máster
  • 981
  • 11
  • 23