0

我想获取模态弹出的内容并将其存储在数据库中。

假设我在模式弹出窗口中有 2 个文本框,一个是名称,另一个是评论。

代码在前端就像 dis :

  <asp:scriptmanager id="ScriptManager1" runat="server"> </asp:scriptmanager> <ajaxtoolkit:modalpopupextender id="ModalPopupExtender1" runat="server"
cancelcontrolid="btnCancel" targetcontrolid="addComment"
popupcontrolid="Panel1" popupdraghandlecontrolid="PopupHeader"
drag="false" backgroundcssclass="ModalPopupBG" oncancelscript="ClearUI();"
behaviorid="modalwithinput"> </ajaxtoolkit:modalpopupextender>
    <asp:panel id="Panel1" style="display: none" runat="server">
<div class="HellowWorldPopup" >
            <div class="PopupHeader" id="PopupHeader"><h3 style="color:white; font-family:'Palatino Linotype'">Add Your Comment</h3></div>
            <div class="PopupBody">
                <p style="font-family:'Palatino Linotype'; margin-left:10px;">Your Name : </p>
                <p><asp:TextBox ID="txtName" runat="server" Width="300px" style="margin-left:10px; font-family:'Palatino Linotype'; font-size:medium; font-style:italic"></asp:TextBox>
                    <asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server"
                        controltovalidate="txtName" errormessage="Please Enter your name"
                        setfocusonerror="true" display="None"></asp:requiredfieldvalidator>
                    <ajaxtoolkit:validatorcalloutextender id=
                        "RequiredFieldValidator1_ValidatorCalloutExtender"
                        runat="server" targetcontrolid="RequiredFieldValidator1"
                        behaviorid="textValidator" enabled="True">
                    </ajaxtoolkit:validatorcalloutextender>
                   </p>  

                <p style="font-family:'Palatino Linotype'; margin-left:10px;">Your Comment:  </p>
                <p><asp:TextBox ID="txtComment" runat="server" Width="400px" style="margin-left:10px;font-family:'Palatino Linotype'; max-height:100px; font-size:medium; resize:none; font-style:italic" TextMode="MultiLine"></asp:TextBox>
                    <asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server"
                        controltovalidate="txtComment" errormessage="Please Enter your Comment"
                        setfocusonerror="true" display="None">
                    </asp:requiredfieldvalidator>
                    <ajaxtoolkit:validatorcalloutextender id=
                        "Validatorcalloutextender1"
                        runat="server" targetcontrolid="RequiredFieldValidator2"
                        behaviorid="textValidator1" enabled="True">
                    </ajaxtoolkit:validatorcalloutextender>
                   </p>  

            </div>

                <asp:Button runat="server" id="btnOkay" Text="Done" OnClick="btnOkay_Click" style="font-family:'Palatino Linotype'; margin-bottom:10px; margin-left:10px;  width:100px; height:30px; font-size:small;font-weight:700" />
                <asp:Button ID="btnCancel" runat="server" Text="Cancel" style="font-family:'Palatino Linotype';width:100px; height:30px; margin-left:10px; font-size:small;font-weight:700" OnClick="btnCancel_Click" />

    </div>
    </asp:panel>

我在后端写的 btnOkay 点击。

但它从两个文本框中传递一个空字符串,并且插入将成功完成。

请给我一个解决方案。

提前致谢.. :)

4

0 回答 0