2012-04-12 17 views
5

Ich habe versucht, dies den ganzen Tag herauszufinden - ich habe eine FormView mit einigen Textfeldern und eine GridView mit ein paar Spalten. Aus irgendeinem Grund hat mein FormView nicht angezeigt werden aber die GridViewFormView nicht angezeigt

Meine ASPX-Datei ist wie folgt:

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> 

Datenquellensteuer :

<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" /> 

Jede Hilfe würde sehr geschätzt werden.

+0

sind Sie verbindliche formview? Sie haben beim Einfügen Ihren Code durcheinander gebracht. Bitte bearbeiten Sie ihn. –

+0

Ja im Bidnig die Formview – Eoiner

+0

@AshwiniVerma Ich habe die Code-Formatierung behoben. – jadarnel27

Antwort

9

Ehrlich gesagt, der wahrscheinlichste Grund, dass Ihre FormView nicht angezeigt wird, ist, dass Sie nichts zurück von Ihrer Datenquelle bekommen. Sie können eine EmptyDataTemplate für Ihre FormView sicher sein. Setzen Sie dies direkt nach Ihrer </ItemTemplate> und vor Ihrer </asp:FormView>

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

ya das ist es wahrscheinlich, obwohl die sp in der Datenbank die richtigen Ergebnisse zurückgegeben ... – Eoiner

+1

@ user1305412 Ja, wenn die 'EmptyDataTemplate' angezeigt wird, dann ist es definitiv wegen des Mangels an Daten. – jadarnel27

+1

OMG !!! Der ganze Tag verging, bis ich diese Antwort fand. – capdragon