尝试保存TextBox值时页面刷新

时间:2014-04-13 17:34:36

标签: asp.net updatepanel

我有一个带有TextBoxes的表,我将UpdatePanel设置到表中并设置一个按钮,该按钮应该保存我的新TextBoxes'作为触发器的数据库值。但是,当我按下按钮时,页面会刷新。

<%@ Page Title="" Language="C#" MasterPageFile="~/MaestroMaster.master" AutoEventWireup="true"
    CodeFile="ProjectDetails.aspx.cs" Inherits="Default" EnableEventValidation="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <style type="text/css">
        .style1
        {
            height: 68px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder3" runat="Server">
<asp:ScriptManager ID="ScriptManager"  runat="server"></asp:ScriptManager>    
    <div class="cntr">
        <h1>
            פרטי הלקוח
        </h1>
    </div>
    <br />

   <asp:UpdatePanel ID="CustomerUpdatePanel">
   <ContentTemplate>

    <table id="CustomerDetailsTBL" class="table">
        <tr>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoID" type="text" class="form-control" runat="server" maxlength="9">
                    <span class="input-group-addon">ת.ז</span>
                </div>
            </td>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoAddress" type="text" class="form-control" runat="server" maxlength="30">
                    <span class="input-group-addon">כתובת</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoFirstName" type="text" class="form-control" runat="server"
                        maxlength="15">
                    <span class="input-group-addon">שם פרטי</span>
                </div>
            </td>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoCity" type="text" class="form-control" runat="server" maxlength="15">
                    <span class="input-group-addon">עיר</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoLastName" type="text" class="form-control" runat="server" maxlength="15">
                    <span class="input-group-addon">שם משפחה</span>
                </div>
            </td>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoEmail" type="text" class="form-control" runat="server">
                    <span class="input-group-addon">דוא"ל</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoPhone" type="text" class="form-control" runat="server" maxlength="10">
                    <span class="input-group-addon">טלפון</span>
                </div>
            </td>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoFax" type="text" class="form-control" runat="server" maxlength="10">
                    <span class="input-group-addon">פקס</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoMobile" type="text" class="form-control" runat="server" maxlength="10">
                    <span class="input-group-addon">טלפון נייד</span>
                </div>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoArchitectName" type="text" class="form-control" runat="server"
                        maxlength="15">
                    <span class="input-group-addon">שם האדריכל</span>
                </div>
            </td>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoArchitectMobile" type="text" class="form-control" runat="server"
                        maxlength="10">
                    <span class="input-group-addon">טלפון אדריכל</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoContractorName" type="text" class="form-control" runat="server"
                        maxlength="15">
                    <span class="input-group-addon">שם הקבלן</span>
                </div>
            </td>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoContractorPhone" type="text" class="form-control" runat="server"
                        maxlength="10">
                    <span class="input-group-addon">טלפון קבלן</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoSupervisorName" type="text" class="form-control" runat="server"
                        maxlength="15">
                    <span class="input-group-addon">שם המפקח</span>
                </div>
            </td>
            <td>
                <div class="input-group">
                    <input id="ProjectInfoSupervisorPhone" type="text" class="form-control" runat="server"
                        maxlength="10">
                    <span class="input-group-addon">טלפון מפקח</span>
                </div>
            </td>
        </tr>
    </table>
   </ContentTemplate>
   <Triggers>
   <asp:AsyncPostBackTrigger ControlID="ContentPlaceHolder3_SaveCustomerDetailsBTN" EventName="Click"/>
   </Triggers>
   </asp:UpdatePanel>

1 个答案:

答案 0 :(得分:0)

UpdatePanel中没有任何按钮只能触发UpdatePanel内容的动态更新,然后在您提供的代码中触发不存在ContentPlaceHolder3_SaveCustomerDetailsBTN的控件ID