2012-04-12 7 views
5

私はこれを一日中考えようとしています。私はFormViewにテキストフィールドを、GridViewにはいくつかの列を付けました。何らかの理由で、私のFormViewは表示されませんが、次のようにGridViewFormViewが表示されない

私の.aspxのファイルは次のとおりです。

FormView

<asp:FormView ID="frmPurchases" runat="server" DataKeyNames="ID" DataSourceID="dsPurchases" DataMember="DefaultView" Width="100%" SkinID="formSkinPP" > 
    <ItemTemplate> 
     <asp:Label id="lblApproval" runat="server" Text="NOT APPROVED: the guids do not match...."></asp:Label> 
     <br /><br /> 
     <div style="width:800px;padding:0px 0px 10px 0px;"> 
      <div style="float:left;width:400px;"> 
       <div style="float:left;width:100px;">Reference</div>         
       <div style="float:left;"> 
        <asp:TextBox ID="txtReference" CssClass="TextBox" runat="server" Width="237px" ValidationGroup="Group1" Text='<%# Bind("SupplierReference") %>'></asp:TextBox><br /> 
       </div> 
      </div> 


     <div style="width:800px;padding:0px 0px 10px 0px;"> 
      <div style="float:left;width:400px;"> 
       <div style="float:left;width:100px;">Date</div>         
       <div style="float:left;"> 
        <telerik:RadDatePicker DatePopupButton-CssClass="datePopUp" Width="260px" id="radDate" SelectedDate='<%# Bind("Date") %>' DateInput-BorderWidth="1px" DateInput-BorderColor="#7F9DB9" Runat="server" MinDate="2000-01-01">              
         <DateInput runat="server" DateFormat="dd/MM/yyyy" Width="260px" BorderColor="#7F9DB9" BorderWidth="1px" InvalidStyleDuration="100"> 
         </DateInput> 
        </telerik:RadDatePicker> 
       </div> 
      </div> 
     </div> 

     <div style="width:800px;padding:0px 0px 10px 0px;"> 
      <div style="float:left;width:400px;"> 
       <div style="float:left;width:100px;">Type</div>         
       <div style="float:left;"> 
        <asp:TextBox ID="txtType" runat="server" Width="240px" Text='<%# Bind("Type") %>'        
        ValidationGroup="Group1"></asp:TextBox><br /> 
       </div> 
      </div> 
     </div> 

     <div style="width:800px;padding:0px 0px 10px 0px;"> 
      <div style="float:left;width:400px;"> 
       <div style="float:left;width:100px;">PO Number</div>         
       <div style="float:left;"> 
        <asp:TextBox ID="acPONumber" runat="server" Width="240px" Text='<%# Bind("PONumber") %>'></asp:TextBox><br /> 

       </div> 
      </div> 
     </div> 

     <div style="width:800px;padding:0px 0px 10px 0px;"> 
      <div style="float:left;width:400px;"> 
       <div style="float:left;width:100px;"><asp:Label ID="lblEstimatedAmount" runat="server" Text="Estimated Amount"></asp:Label></div>         
       <div style="float:left;"> 
        <asp:TextBox ID="acEstimatedAmount" runat="server" Width="240px" Text='<%# Bind("Rate") %>'></asp:TextBox><br />        
       </div> 
      </div> 
     </div> 
     </div> 
    </ItemTemplate> 
</asp:FormView> 

GridView

<asp:GridView ID="gridSupplierPurchasesDetail" DataSourceID="dsPurchasesDetail" runat="server" AutoGenerateColumns="False" AllowSorting="True" BorderStyle="Solid" BorderColor="#5E5EAE" BorderWidth="1pt" 
CellPadding="5" Font-Names="Helvetica,Arial,Sans-Serif" Font-Size="9pt" DataMember="DefaultView" 
SkinID="gridSkin" EmptyDataText="No Supplier Purchases Added to this Reference" 
EnableTheming="False" Width="755px" ShowFooter="True" FooterStyle-VerticalAlign="Top" RowStyle-VerticalAlign="Top"> 
    <HeaderStyle BackColor="#5E5EAE" ForeColor="White" HorizontalAlign="Left" />      
    <EmptyDataRowStyle VerticalAlign="Top" /> 
    <RowStyle VerticalAlign="Top" /> 
    <FooterStyle VerticalAlign="Top" /> 
    <Columns> 
     <asp:TemplateField HeaderText="Description" SortExpression="Description">          
      <ItemTemplate> 
       <asp:TextBox ID="txtDescription" Width="200px" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox> 

      </ItemTemplate> 
     </asp:TemplateField> 
     <asp:TemplateField HeaderText="NetAmount" SortExpression="NetAmount">          
      <ItemTemplate> 
       <asp:TextBox ID="txtNetAmount" width="80px" runat="server" Text='<%# Bind("NetAmount") %>'></asp:TextBox> 

      </ItemTemplate> 
     </asp:TemplateField> 
     <asp:TemplateField HeaderText="VATRates" SortExpression="VATRates">          
      <ItemTemplate> 
       <asp:DropDownList AutoPostBack="true" 
        ID="ddlVATRates" runat="server" 
         Width="80px"></asp:DropDownList> 

      </ItemTemplate>           
     </asp:TemplateField> 
     <asp:TemplateField HeaderText="VATAmount" SortExpression="VATAmount">           
      <ItemTemplate> 
       <asp:TextBox ID="txtVATAmount" width="80px" runat="server" Text='<%# Bind("VATAmount") %>' ReadOnly="true"></asp:TextBox> 
      </ItemTemplate> 
     </asp:TemplateField> 
     <asp:TemplateField HeaderText="TotalAmount" SortExpression="TotalAmount"> 

      <ItemTemplate> 
       <asp:TextBox ID="txtTotalAmount" width="80px" runat="server" Text='<%# Bind("TotalAmount") %>' ReadOnly="true"></asp:TextBox> 
      </ItemTemplate> 
     </asp:TemplateField> 

     <asp:TemplateField HeaderText="PartNumber" SortExpression="PartNumber">     
      <ItemTemplate> 
       <asp:TextBox ID="txtPartNumber" runat="server" class="PartNumber" Width="100px" Text='<%# Bind("PartNumber") %>' ValidationGroup="Group2"></asp:TextBox> 
      </ItemTemplate> 
     </asp:TemplateField>          
    </Columns> 
</asp:GridView> 

データソースコントロール:

<asp:ObjectDataSource ID="dsPurchases" runat="server" SelectMethod="GetSupplierPurchasesByID" TypeName="SupplierPurchasesSystem" OldValuesParameterFormatString="original_{0}" > 
    <SelectParameters> 
     <asp:Parameter Name="SupplierPurchasesID" Type="Int32" DefaultValue="13243" /> 
     <asp:Parameter DefaultValue="VNE_DB" Name="DataSource" Type="String" /> 
    </SelectParameters> 
</asp:ObjectDataSource> 
    <asp:ObjectDataSource ID="dsPurchasesDetail" runat="server" SelectMethod="GetSupplierPurchasesDetails" 
     TypeName="SupplierPurchasesSystem" > 
     <SelectParameters> 
      <asp:ControlParameter ControlID="HiddenField1" DefaultValue="" Name="guid" PropertyName="Value" 
       Type="String" /> 
      <asp:Parameter DefaultValue="VNE_DB" Name="DataSource" Type="String" /> 
     </SelectParameters> 
    </asp:ObjectDataSource> 
<asp:HiddenField ID="HiddenField1" runat="server" /> 

ご協力いただければ幸いです。

+0

あなたはバインドしていますか?あなたのコードを貼り付ける間にそれを編集してください。 –

+0

はいいいえフォームビュー – Eoiner

+0

@AshwiniVermaコードの書式を修正しました。 – jadarnel27

答えて

9

あなたのFormViewが表示されない可能性が最も高い理由は、データソースから何も戻ってこないということです。あなたのFormViewが確実になるようにEmptyDataTemplateを作成することができます。 </ItemTemplate>の直後に、あなたの前に入れてください</asp:FormView>

<EmptyDataTemplate> 
    There is nothing to see here. 
</EmptyDataTemplate> 
+0

これはおそらくデータベースのspが正しい結果を返していたようです。 – Eoiner

+1

@ user1305412「EmptyDataTemplate」が表示されている場合は、データが不足しているためです。 – jadarnel27

+1

OMG !!!私がこの答えを見つけ出すまで、すべての日が悲しかった。 – capdragon

関連する問題