输入字段变空

时间:2015-06-03 15:55:22

标签: html asp.net vb.net

我正在开发一个从表单向数据库插入数据的函数。每当我使用母版页并发送表单来添加数据时,它就会出现异常并且不存储任何内容,输入字段似乎是空的。 但是当我分离母版页时,函数工作正常,数据最终存储,我尝试使用新的母版页,问题仍然存在,我真的不知道是什么问题。

这是MasterPage代码:

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="backOffice_MasterPage" %>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<asp:ContentPlaceHolder runat="server" ID="title">

</asp:ContentPlaceHolder>


<meta http-equiv="Content-Type" content="text/html" name="viewport" charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!--Styles bootstrap-->
<link href="../styles/bootstrap/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />
<link href="../styles/bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../styles/simple-sidebar.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!--Add a condition so that less than ie9 understands html5 tags such as header, article ...-->
<!--[if lt IE 9]>       
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
     <!-- jQuery -->
<script src="../scripts/jquery.1.11.3.js" type="text/javascript"></script>

<link rel="stylesheet" href="../styles/cyllene.css" type="text/css" />

<script type="text/javascript" src="../include/ctrlsaisie.js"></script>

<script type="text/javascript" src="../include/CBrowser.js"></script>

<script src="../include/CEditor.js" type="text/javascript"></script>

<script src="../include/CIconList.js" type="text/javascript"></script>

</head>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
        <ul class="sidebar-nav">
            <li class="sidebar-brand">
                <a href="#">
                    Start Bootstrap
                </a>
            </li>
            <li>
                <a href="#">Dashboard</a>
            </li>
            <li>
                <a href="ListPays.aspx">Liste des pays</a>
            </li>
            <li>
                <a href="ListVilles.aspx">Liste des villes</a>
            </li>
            <li>
                <a href="ListActivites.aspx">Liste des activités</a>
            </li>
            <li>
                <a href="#">About</a>
            </li>
            <li>
                <a href="#">Services</a>
            </li>
            <li>
                <a href="#">Contact</a>
            </li>
        </ul>
    </div>
    <!-- /#sidebar-wrapper -->

    <!-- Page Content -->
     <div id="page-content-wrapper">
        <div class="container-fluid">    
                    <asp:ContentPlaceHolder id="cphMain" runat="server">

                    </asp:ContentPlaceHolder>
        </div>
    </div>
    <!-- /#page-content-wrapper -->

</div>
<!-- /#wrapper -->



<!-- Bootstrap Core JavaScript -->

<script src="../scripts/bootstrap/bootstrap.min.js" type="text/javascript"></script>    

<asp:ContentPlaceHolder ID="script" runat="server">

</asp:ContentPlaceHolder>
</body>

以下是页面代码:

<%@ Page Language="VB"  AutoEventWireup="false" MasterPageFile="~/backOffice/MasterPage.master" CodeFile="GestPays.aspx.vb" Inherits="GestPays" %>
<asp:Content ContentPlaceHolderID="cphMain" runat="server">
<form id="FrmMain" runat="server">
<div class="frmContent">
    <afc:wccFilAriane ID="WccFilAriane1" runat="server">
        <afc:woStep ID="WoStep1" runat="server" Text="Accueil" NavigateUrl="../FrmAccueilGestion.aspx"></afc:woStep>
        <afc:woStep ID="WoStep3" runat="server" Text="Liste des pays" NavigateUrl="ListPays.aspx"></afc:woStep>
        <afc:woStep ID="WoStep2" runat="server" Text="Modification d'un pays" NavigateUrl="#"></afc:woStep>
    </afc:wccFilAriane>
    <asp:HiddenField runat="server" ID="KEY" />
    <asp:HiddenField runat="server" ID="C_PAGE" />
    <fieldset>
        <legend>
            <asp:Label runat="server" ID="lblTitle" Text="Pays" /></legend>
        <table width="70%" border="0" cellspacing="0" cellpadding="2">
            <tr>
                <td>
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <asp:Label runat="server" ID="lblLib" Text="Désignation" />
                                :
                            </td>
                            <td>
                                <asp:HiddenField ID="ID_LIBELLE" runat="server" />
                                <afc:wccMaskEdit ID="SYS_ID_LIBELLE" runat="server" MaxLength="250" Width="320px" />
                                <afc:wccPopUpCaller ID="TRAD_ID_LIBELLE" runat="server" ImageUrl="../images/trad.gif" Visible="false"
                                    Text="Traduire" WindowHeigth="120" WindowWidth="550" Title="Traduction" />
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="height: 40px; vertical-align: top;">
                    <afc:wccButton runat="server" ID="btnValider" Text="Valider" Width="75px" />
                    <br />
                    <br />
                    <afc:wccButton runat="server" ID="btnAnnuler" Text="Retour" Width="75px" />
                </td>
            </tr>
        </table>
    </fieldset>
</div>
</form>

当不使用母版页时,后面的代码工作正常,所以我猜这不是必需的。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

标签应该在母版页中而不是内容页