DataForm do not show the fields and data in view mode but ok while inserting/updating data

2 posts, 0 answers
  1. Mian
    Mian avatar
    2 posts
    Member since:
    Dec 2014

    Posted 16 Dec 2014 Link to this post

    I have added a RadDataForm (asp.net ajax), and added datasource and generated fields using the design wizard.

    it is inserting and updating the data. but it do not view the fields and data. On 
    clicking next, previous, it is also navigating records, but do not view 
    the fields.

    when i press insert or update, then it view the fields and the data. Please help.

    following is the auto-generated code

       <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <telerik:RadDataForm ID="RadDataForm11" runat="server" DataKeyNames="ProductID" DataSourceID="SqlDataSource1" Visible="true"    >
            <LayoutTemplate>
                <div class="RadDataForm RadDataForm_<%# Container.Skin %> rdfInlineBlock rdfNoFieldHint">
                    <div id="itemPlaceholder" runat="server">
                    </div>
                    <div class="rdfPager">
                        <span>
                        <asp:Button ID="btnFirst" runat="server" CommandArgument="First" CommandName="Page" CssClass="rdfFirst" Text=" " ToolTip="First" />
                        <asp:Button ID="btnPrev" runat="server" CommandArgument="Prev" CommandName="Page" CssClass="rdfPrev" Text=" " ToolTip="Previous" />
                        </span><span>
                        <asp:Button ID="btnNext" runat="server" CommandArgument="Next" CommandName="Page" CssClass="rdfNext" Text=" " ToolTip="Next" />
                        <asp:Button ID="btnLast" runat="server" CommandArgument="Last" CommandName="Page" CssClass="rdfLast" Text=" " ToolTip="Last" />
                        </span>
                    </div>
                </div>
    </LayoutTemplate>
            <ItemTemplate>
                <fieldset >
                    <legend >View</legend>
                    <div class="rdfRow">
                        <asp:Label ID="ProductNameLabel2" runat="server"  Text="ProductName"></asp:Label>
                        <asp:Label ID="ProductNameLabel1" runat="server" Text='<%# Eval("ProductName") %>' />
                    </div>
                    <div class="rdfRow">
                        <asp:Label ID="UnitPriceLabel2" runat="server"  Text="UnitPrice"></asp:Label>
                        <asp:Label ID="UnitPriceLabel1" runat="server"  Text='<%# Eval("UnitPrice") %>' />
                    </div>
                    <div class="rdfRow">
                        <asp:Label ID="UnitsInStockLabel2" runat="server"  Text="UnitsInStock"></asp:Label>
                        <asp:Label ID="UnitsInStockLabel1" runat="server"  Text='<%# Eval("UnitsInStock") %>' />
                    </div>
                    <div class="rdfRow">
                        <asp:Label ID="ProductIDLabel2" runat="server"  Text="ProductID"></asp:Label>
                        <asp:Label ID="ProductIDLabel1" runat="server"  Text='<%# Eval("ProductID") %>' />
                    </div>
                    <div class="rdfCommandButtons">
                        <hr class="rdfHr" />
                        <telerik:RadButton ID="InitInsertButton" runat="server" ButtonType="SkinnedButton" CausesValidation="False" CommandName="InitInsert" Text="Insert" ToolTip="Insert" />
                        <telerik:RadButton ID="EditButton" runat="server" ButtonType="SkinnedButton" CausesValidation="False" CommandName="Edit" Text="Edit" ToolTip="Edit" />
                        <telerik:RadButton ID="DeleteButton" runat="server" ButtonType="SkinnedButton" CausesValidation="False" CommandName="Delete" Text="Delete" ToolTip="Delete" />
                    </div>
                </fieldset>
            </ItemTemplate>
            <EditItemTemplate>
                <fieldset class="rdfFieldset rdfBorders">
                    <legend class="rdfLegend">Edit</legend>
                    <div class="rdfRow">
                        <asp:Label ID="ProductNameLabel2" runat="server" AssociatedControlID="ProductNameTextBox" CssClass="rdfLabel rdfBlock" Text="ProductName"></asp:Label>
                        <telerik:RadTextBox ID="ProductNameTextBox" runat="server" Text='<%# Bind("ProductName") %>' WrapperCssClass="rdfInput" />
                    </div>
                    <div class="rdfRow">
                        <asp:Label ID="UnitPriceLabel2" runat="server" AssociatedControlID="UnitPriceTextBox" CssClass="rdfLabel rdfBlock" Text="UnitPrice"></asp:Label>
                        <telerik:RadNumericTextBox ID="UnitPriceTextBox" runat="server" DataType="Double" DbValue='<%# Bind("UnitPrice") %>' Skin="<%#Container.OwnerDataForm.Skin %>" WrapperCssClass="rdfInput" />
                    </div>
                    <div class="rdfRow">
                        <asp:Label ID="UnitsInStockLabel2" runat="server" AssociatedControlID="UnitsInStockTextBox" CssClass="rdfLabel rdfBlock" Text="UnitsInStock"></asp:Label>
                        <telerik:RadNumericTextBox ID="UnitsInStockTextBox" runat="server" DataType="Int16" DbValue='<%# Bind("UnitsInStock") %>' NumberFormat-DecimalDigits="0" Skin="<%#Container.OwnerDataForm.Skin %>" WrapperCssClass="rdfInput" />
                    </div>
                    <div class="rdfRow">
                        <asp:Label ID="ProductIDLabel2" runat="server" CssClass="rdfLabel rdfBlock" Text="ProductID"></asp:Label>
                        <asp:Label ID="ProductIDLabel1" runat="server" CssClass="rdfFieldValue" Text='<%# Eval("ProductID") %>' />
                    </div>
                    <div class="rdfCommandButtons">
                        <hr class="rdfHr" />
                        <telerik:RadButton ID="UpdateButton" runat="server" ButtonType="SkinnedButton" CommandName="Update" Text="Update" ToolTip="Update" />
                        <telerik:RadButton ID="CancelButton" runat="server" ButtonType="SkinnedButton" CausesValidation="False" CommandName="Cancel" Text="Cancel" ToolTip="Cancel" />
                    </div>
                </fieldset>
            </EditItemTemplate>
            <InsertItemTemplate>
                <fieldset class="rdfFieldset rdfBorders">
                    <legend class="rdfLegend">Insert</legend>
                    <div class="rdfRow">
                        <asp:Label ID="ProductNameLabel2" runat="server" AssociatedControlID="ProductNameTextBox" CssClass="rdfLabel rdfBlock" Text="ProductName"></asp:Label>
                        <telerik:RadTextBox ID="ProductNameTextBox" runat="server" Text='<%# Bind("ProductName") %>' WrapperCssClass="rdfInput" />
                    </div>
                    <div class="rdfRow">
                        <asp:Label ID="UnitPriceLabel2" runat="server" AssociatedControlID="UnitPriceTextBox" CssClass="rdfLabel rdfBlock" Text="UnitPrice"></asp:Label>
                        <telerik:RadNumericTextBox ID="UnitPriceTextBox" runat="server" DataType="Double" DbValue='<%# Bind("UnitPrice") %>' Skin="<%#Container.OwnerDataForm.Skin %>" WrapperCssClass="rdfInput" />
                    </div>
                    <div class="rdfRow">
                        <asp:Label ID="UnitsInStockLabel2" runat="server" AssociatedControlID="UnitsInStockTextBox" CssClass="rdfLabel rdfBlock" Text="UnitsInStock"></asp:Label>
                        <telerik:RadNumericTextBox ID="UnitsInStockTextBox" runat="server" DataType="Int16" DbValue='<%# Bind("UnitsInStock") %>' NumberFormat-DecimalDigits="0" Skin="<%#Container.OwnerDataForm.Skin %>" WrapperCssClass="rdfInput" />
                    </div>
                    <div class="rdfCommandButtons">
                        <hr class="rdfHr" />
                        <telerik:RadButton ID="PerformInsertButton" runat="server" ButtonType="SkinnedButton" CommandName="PerformInsert" Text="Insert" ToolTip="Insert" />
                        <telerik:RadButton ID="CancelButton" runat="server" ButtonType="SkinnedButton" CausesValidation="False" CommandName="Cancel" Text="Cancel" ToolTip="Cancel" />
                    </div>
                </fieldset>
            </InsertItemTemplate>
            <EmptyDataTemplate>
                <div class="RadDataForm RadDataForm_<%# Container.Skin %>">
                    <div class="rdfEmpty">
                        There are no items to be displayed.</div>
                </div>
            </EmptyDataTemplate>
            </telerik:RadDataForm>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" DeleteCommand="DELETE FROM [Products] WHERE [ProductID] = @original_ProductID AND (([ProductName] = @original_ProductName) OR ([ProductName] IS NULL AND @original_ProductName IS NULL)) AND (([UnitPrice] = @original_UnitPrice) OR ([UnitPrice] IS NULL AND @original_UnitPrice IS NULL)) AND (([UnitsInStock] = @original_UnitsInStock) OR ([UnitsInStock] IS NULL AND @original_UnitsInStock IS NULL))" InsertCommand="INSERT INTO [Products] ([ProductName], [UnitPrice], [UnitsInStock]) VALUES (@ProductName, @UnitPrice, @UnitsInStock)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [ProductName], [UnitPrice], [UnitsInStock], [ProductID] FROM [Products]" UpdateCommand="UPDATE [Products] SET [ProductName] = @ProductName, [UnitPrice] = @UnitPrice, [UnitsInStock] = @UnitsInStock WHERE [ProductID] = @original_ProductID AND (([ProductName] = @original_ProductName) OR ([ProductName] IS NULL AND @original_ProductName IS NULL)) AND (([UnitPrice] = @original_UnitPrice) OR ([UnitPrice] IS NULL AND @original_UnitPrice IS NULL)) AND (([UnitsInStock] = @original_UnitsInStock) OR ([UnitsInStock] IS NULL AND @original_UnitsInStock IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_ProductID" Type="Int32" />
                <asp:Parameter Name="original_ProductName" Type="String" />
                <asp:Parameter Name="original_UnitPrice" Type="Double" />
                <asp:Parameter Name="original_UnitsInStock" Type="Int16" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="ProductName" Type="String" />
                <asp:Parameter Name="UnitPrice" Type="Double" />
                <asp:Parameter Name="UnitsInStock" Type="Int16" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="ProductName" Type="String" />
                <asp:Parameter Name="UnitPrice" Type="Double" />
                <asp:Parameter Name="UnitsInStock" Type="Int16" />
                <asp:Parameter Name="original_ProductID" Type="Int32" />
                <asp:Parameter Name="original_ProductName" Type="String" />
                <asp:Parameter Name="original_UnitPrice" Type="Double" />
                <asp:Parameter Name="original_UnitsInStock" Type="Int16" />
            </UpdateParameters>
        </asp:SqlDataSource>






    Best Regards,
    imran
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 19 Dec 2014 Link to this post

    Hello Mian,

    The described issue is most probably some kind of styling issue as the DataForm configuration looks correctly set in the provided code.
    Can I ask you to remove all styles assigned for the container div's and all custom styles on the page and see how it goes?


    Regards,
    Maria Ilieva
    Telerik
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top