为什么我的文本框在插入时会清除?

时间:2014-06-09 11:13:55

标签: asp.net updatepanel detailsview

我在updatepanel中有一个详细信息视图。当我按下插入时,文本框会清除。那是为什么?

我无法在代码隐藏中找到清除文本框的任何内容。它只是调用一个存储在数据库中的方法。

<asp:UpdatePanel runat="server" ID="insert">
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="500px"   
          AutoGenerateRows="False" DataKeyNames="strPositionId,nFolderId,tmVaRPosition" 
          DataSourceID="ODSManualPosVaR"  OnItemInserted="DetailsView1_ItemInserted"   
          OnItemInserting="DetailsView1_ItemInserting" DefaultMode="Insert" 
          SkinID="detailsviewSkin" EnableModelValidation="True">
  <HeaderStyle Width="200px" />
  <FieldHeaderStyle Width="200px" />
    <Fields>
     <asp:BoundField DataField="strPositionId" HeaderText="Id" ItemStyle-Width="200" SortExpression="strPositionId" />
     <asp:TemplateField HeaderText="Date" ItemStyle-Width="250" SortExpression="tmVaRPosition">
     <InsertItemTemplate>
       <asp:TextBox ID="tmVarPosition" runat="server" Text='<%# Bind("tmVaRPosition") %>' /> 
       <ajaxToolkit:CalendarExtender ID="calDate" OnClientDateSelectionChanged="HideCalendar" runat="server" TargetControlID="tmVarPosition" FirstDayOfWeek="Monday" CssClass="cssCalendar" Format="yyyy-MM-dd" />
       <asp:RangeValidator SkinID="rangeValidatorSkin" ID="datevalidator" runat="server" ControlToValidate="tmVarPosition" Type="Date" MaximumValue="2100-01-01" MinimumValue="1901-01-01" ErrorMessage="Not a valid date" />
     </InsertItemTemplate>
  </asp:TemplateField>
<asp:TemplateField HeaderText="Name" SortExpression="strPositionName">
   <InsertItemTemplate>
        <asp:TextBox ID="TextBox1" Width="380px" MaxLength="49" runat="server" Text='<%# Bind("strPositionName") %>'></asp:TextBox>
   </InsertItemTemplate>
  <EditItemTemplate>
    <asp:TextBox ID="TextBox1" Width="380px" MaxLength="49" runat="server" Text='<%# Bind("strPositionName") %>'></asp:TextBox>
                        </EditItemTemplate>
 <ItemTemplate>
    <asp:Label ID="Label1" runat="server" Width="380px" Text='<%# Bind("strPositionName") %>'></asp:Label>
 </ItemTemplate>
 </asp:TemplateField>
<asp:BoundField DataField="fP18VaR" HeaderText="P18VaR" ItemStyle-Width="200" SortExpression="fP18VaR" />
<asp:TemplateField HeaderText="Maturity" ItemStyle-Width="250" SortExpression="tmMaturity">
<InsertItemTemplate>
<asp:TextBox ID="tbMaturity" runat="server" Text='<%# Bind("tmMaturity") %>' />
<ajaxToolkit:CalendarExtender ID="calMaturityDate" OnClientDateSelectionChanged="HideCalendar" runat="server" TargetControlID="tbMaturity" FirstDayOfWeek="Monday" CssClass="cssCalendar" Format="yyyy-MM-dd" />
<asp:RangeValidator SkinID="rangeValidatorSkin" ID="dateMaturityvalidator" runat="server" ControlToValidate="tbMaturity" Type="Date" MaximumValue="2100-01-01" MinimumValue="1901-01-01" ErrorMessage="Not a valid date" />
</InsertItemTemplate>

       

0 个答案:

没有答案