This is a migrated thread and some comments may be shown as answers.

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

3 Answers 73 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Mian
Top achievements
Rank 1
Mian asked on 17 Dec 2014, 04:28 AM
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

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 19 Dec 2014, 02:05 PM
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
0
Vidhi
Top achievements
Rank 1
answered on 14 Aug 2019, 02:13 PM

Hello,

I have the same problem the fields are not displaying of RadDataForm. Maria, I tried to remove all the styles from div and custom styles too but it's still the same. Please help me to solve this problem. 

Thanks in advance.

0
Attila Antal
Telerik team
answered on 19 Aug 2019, 12:22 PM

Hi Vidhi,

 

If using Internet Explorer I would suggest double checking its settings before further troubleshooting: Different appearance or behavior in Internet Explorer on local and production servers

As the next step, I suggest opening the Developer Tools of the browser and monitor the Console tab for any potential JavaScript errors. There is a change that there are some server-generated errors and if AJAX is enabled, it will most likely be shown as a JavaScript error. Take a look at the following Blog Post about using Developer Tools to debug an application in the browser: Get more descriptive errors by disabling AJAX

If by any chance AJAX is enabled, I recommend disabling it temporarily: Get more descriptive errors by disabling AJAX. Thus, the server-generated errors will show up on the surface giving you a more detailed explanation on the error.

The above steps would most likely point the direction for you to find the issue, however, in case the issue still persist, we would need some more detail on the current configuration (markup and code behind) to be able to give you a more accurate answer.

 

Kind regards, Attila Antal
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DataForm
Asked by
Mian
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Vidhi
Top achievements
Rank 1
Attila Antal
Telerik team
Share this question
or