RadDataForm

13 posts, 1 answers
  1. Leos
    Leos avatar
    57 posts
    Member since:
    Jul 2010

    Posted 03 Mar 2011 Link to this post

    Hello,
    firstly - big thanks for RadDataForm.

    I have some questions, maybe tips, for this new component.

    1) Is possible in customized DataForm use other component than DataFormXxxField?  For example Image. How? I tested TextBlock but data in Text property did not displayed (binded?).
    2) How to change width of Label?
    3) What is Mode property ? Possible values are AddNew, Edit, ReadOnly.
    4) I need to place READONLY item, for example ID field. I need to have this field ReadOnly in ALL modes, including Edit mode. I tested IsReadOnly (see code bellow) but in Edit mode I can .still modify this field. Because here is not somehing as "DataFormTextBlockField" (and I dont know how to create it - point 1)  I dont see any way how to solve it. Note that I have set attribute Editable to false too.
    <telerik:DataFormDataField Grid.Row="0" Label="Id"  IsReadOnly="True"  DataMemberBinding="{Binding Id}"/>

    5) Will be nice to use Display.Name attribute for Label ( in AutoGeneratedFields Mode ), but this was already answered yesterday.
    6) Does exist some way how to access/bind attributes in customized mode? For example how to bind Label to attribute Display.Name, or to show Description the same way how it is worked in AutoGenerate mode.
    7) When user moves with TAB key then Label (?) has probably TabStop set to true, because to move to next field two TABs are needed.

    Note: customized = AutoGenerateFields set to false and content is readed from specified DataTemplate.

    Thanks.
    Leos

    Sorry if my English is bad/easy.
  2. HDC
    HDC avatar
    214 posts
    Member since:
    Dec 2010

    Posted 08 Mar 2011 Link to this post

    I can not answer all of those question, but here is what i did:

     

    <telerik:RadDataForm.EditTemplate>
                       <DataTemplate>
                           <Grid>
                               <Grid.ColumnDefinitions>
                                   <ColumnDefinition Width="80"></ColumnDefinition>
                                   <ColumnDefinition></ColumnDefinition>
                               </Grid.ColumnDefinitions>
                               <Grid.RowDefinitions>
                                   <RowDefinition></RowDefinition>
                                   <RowDefinition></RowDefinition>
                               </Grid.RowDefinitions>
                               <telerik:Label Grid.Column="0" Grid.Row="0">Name:</telerik:Label>
                               <telerik:DataFormDataField Grid.Column="1" Grid.Row="0">
                                   <TextBox Text="{Binding Name, Mode=TwoWay}" IsEnabled="true"></TextBox>
                               </telerik:DataFormDataField>
                           </Grid>
                       </DataTemplate>
                   </telerik:RadDataForm.EditTemplate>

    The templates allow you to define the composition of the form. (there are three of them). The template allows to define whatever length you want the fields to have. It also allows you to do with tabbing whatever it is you want it to do. As for attributes, i suppose you can't have it both ways, if you define your own layout, your display attribute would not be taken into account. The other attributes (for example validation) would probably still be taken into account.

    I hope this helps you.... took me long enough to figure it out ;o)
  3. DevCraft banner
  4. Answer
    Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 09 Mar 2011 Link to this post

    Hi Leos,

    Directly on your questions:
    1) Is possible in customized DataForm use other component than DataFormXxxField?  For example Image. How? I tested TextBlock but data in Text property did not displayed (binded?).

    In case you need to place  and bind arbitrary control ( other than DataFormFileld) , you need to defne and set one or all of the 3 templates : ReadOnlyTemplate, EditTemplate, NewItemTemlate.
    Inside the template you may place a textbox or an image and the binding should look like : 
        <TextBox Text={Binding CurrentItem.MyProperty}/>
    *Please have in mind that this is valid for the beta only .We have decided to change this to 
        <TextBox Text={Binding MyProperty}/>  as this is more intuitive.

    2) How to change width of Label?
    For the beta version there is MinWidth of 200 px set for the label . For the official version this is going to be removed and some additional properties to control the label appearance should be introduced.

    3) What is Mode property ? Possible values are AddNew, Edit, ReadOnly.
    This property indicates what mode is the DataForm using at the moment e.g. if the user presses the Edit button , RadDataForm enters Edit mode and the Edit template is applied.

    4) I need to place READONLY item, for example ID field. I need to have this field ReadOnly in ALL modes, including Edit mode. I tested IsReadOnly (see code bellow) but in Edit mode I can .still modify this field. Because here is not somehing as "DataFormTextBlockField" (and I dont know how to create it - point 1)  I dont see any way how to solve it. Note that I have set attribute Editable to false too.

    You can place a TextBlock the way described in point 1.
    6) Does exist some way how to access/bind attributes in customized mode? For example how to bind Label to attribute
    You can only set these directly ( can not bind ) as the DataContext does not yet expose attributes info.

    7) When user moves with TAB key then Label (?) has probably TabStop set to true, because to move to next field two TABs are needed.
    This sounds like a bug and is going to be addressed immediately.

    In addition : Thankyou for the interest and the questions for RadDataForm . I am treating this post as a valuable beta version feedback and I am updating your Telerik points.

    In case you find anything else which needs an improvement or a fix , do not hesitate to contact me .

    Kind regards,
    Pavel Pavlov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  5. Leos
    Leos avatar
    57 posts
    Member since:
    Jul 2010

    Posted 09 Mar 2011 Link to this post

    Thank you to both.

    I have one more question. I need to submit data immediatelly when user commits with "OK" button.
    Note: this is idea (or better to say usual practice) of our customer, application is on intranet so there is not performance problem.
    This is working fine with editing, because here is EditEnded event where I can call SubmitChanges().
    But what about delete? Here does exist DeletingItem event only but record is deleted after it.
    I found one way -  using event CurrentItemChanged. But will be better to have DeletedItem event or something similar.
    I have also one idea - property ConfirmDelete and delete confirmation. If will be this property set to true, then DataForm will be set to similar mode as is EDIT mode and user must press OK to confirm deleting or Cancel to reject.

    Best regards,
    Leos

  6. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 11 Mar 2011 Link to this post

    Hi Leos,

    Thanks again for getting back to us! Your feedback is being directly taken in concern and the event requested has been added to the API of RadDataForm.
    This will ba available in the official version coming next week.
    I am updating your Telerik points.
    Regarding the confirmation dialog. We need some time to clear the concept of how to provide an easy and flexible way to the user for this one.

    All the best,
    Pavel Pavlov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  7. Leos
    Leos avatar
    57 posts
    Member since:
    Jul 2010

    Posted 16 Mar 2011 Link to this post

    Hi Pavel,

    please don't forget to add HeaderTemplate.
    Will be also fine to have some example how to modify visual frontend of DF.
    For example how to add custom buttons or move OK+CANCEL up, to main toolbar .
    Thanks.
    Leos
  8. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 16 Mar 2011 Link to this post

    Hello Leos,

    I am not sure we are going to add a header template property. Here are some details :
    the Header property is an object ( not a string) .  This means that except the standard header being a string , you may also place there an arbitrary UI element .  This to a high extent makes the presence of such property obsolete.

    Regarding your second query  - you are absolutely right , such article/ example  is needed , an I am going to take care for it .

    Greetings,
    Pavel Pavlov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  9. Rupert Henson
    Rupert Henson avatar
    8 posts
    Member since:
    Jul 2009

    Posted 12 Apr 2011 Link to this post

    Hi,

    I just upgraded to RadControls v2011_1_0411 (from v2011_1_0315 previously) in order to get the handy LabelStyle property for the RadDataForm, but in doing so I've found that the RadDataForm's Mode property is now read-only ?

    I'm using RadDataForm in a RadWindow, which I open in either Edit existing or Add New mode, so I need to set the mode in the constructor of the window based on a passed indicator, but that seems to be no longer possible (?).

    Previously I used to be able to:-

     

     

    If bNewMode Then

     

     

     

        Me.DataForm1.Mode = Data.DataForm.RadDataFormMode.AddNew

     

     

     

     

        Me.Header = "Add New Template..."

     

     

     

    Else

     

     

     

        Me.DataForm1.Mode = Data.DataForm.RadDataFormMode.Edit

     

        Me.Header = "Edit Template..."

    End

     

     

    If

     


    But now it's changed to a Dependency property so I tried the following:-

     

     

    If bNewMode Then

     

     

     

        Me.DataForm1.SetValue(RadDataForm.ModeProperty, Data.DataForm.RadDataFormMode.AddNew)

     

     

     

     

        Me.Header = "Add New Template..."

     

     

     

    Else

     

     

     

        Me.DataForm1.SetValue(RadDataForm.ModeProperty, Me.DataForm1.Mode = Data.DataForm.RadDataFormMode.Edit)

     

     

     

     

        Me.Header = "Edit Template..."

     

    End

     

     

    If

     


    But this fails at runtime, complaining about ModeProperty being read-only.

    Is there some other way I can change between Edit and AddNew modes of the RadDataForm at runtime as I used to be able to? (I do not supply the built in control action buttons for the user to select to add new or edit existing).

    Regards,

    Rupert.
  10. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 14 Apr 2011 Link to this post

    Hi Rupert Henson,

    Please excuse us for the inconvenience. We needed to avoid some discrepancies and also make the API compliant with the one of the MS Toolkit DataForm .

    You still have the control over the mode in RadDataForm by calling the respective methods - e.g. to enter edit mode - you need to call he BeginEdit() method. To enter thew insert mode - call the AddNew method etc.

    Sincerely,
    Pavel Pavlov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. jon
    jon avatar
    1 posts
    Member since:
    Apr 2011

    Posted 10 May 2011 Link to this post

    Any word on getting some examples on overriding the OK CANCEL button click events, moving them on the form, or adding additional buttons?
  12. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 11 May 2011 Link to this post

    Hello Jon,

     

    You may always predefine the template of RadDataForm and change it in the way you need.
    If you want to read more about RadDataForm's styling, please follow this link. 



    Best wishes,
    Vanya Pavlova
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Mian
    Mian avatar
    2 posts
    Member since:
    Dec 2014

    Posted 16 Dec 2014 in reply to HDC 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
  14. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 17 Dec 2014 Link to this post

    Hi,

    As you are using RadDataForm for ASP.NET Ajax, I would suggest you posting your question here: 
    http://www.telerik.com/forums/aspnet-ajax/dataform.

    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft banner