Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FormView not displaying

I've been trying to figure this out all day - I have a FormView with some textfields and a GridView with a few columns. For some reason, my FormView doesn't display but the GridView

My .aspx file is as follows:

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>

Data source controls:

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

Any help would be greatly appreciated.

like image 858
Eoiner Avatar asked Apr 12 '12 14:04

Eoiner


1 Answers

Honestly, the most likely reason that your FormView isn't displaying is that you're not getting anything back from your datasource. You can create an EmptyDataTemplate for your FormView to be sure. Put this right after your </ItemTemplate> and before your </asp:FormView>

<EmptyDataTemplate>
    There is nothing to see here.
</EmptyDataTemplate>
like image 138
Josh Darnell Avatar answered Oct 20 '22 08:10

Josh Darnell