Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
107 views

I have a main page with RadTabStrip/RadMultiPage setup. I'd like to trigger an update to a portion of that page when user makes a change in a RadPageView. So on my main page I have a portion that is a summary with datasource and form and numbers need to update as people make changes to various sub-pages.

On each of those RadPageView I have aspx pages with RadForms with (edit/update/cancel buttons). I'd also like to catch if a user tries to change tabs, navigate away from the page, or close with the X on the upper right browser if they are in edit mode on a RadPageView aspx page.

Any assistance would be greatly appreciated.

Peter Milchev
Telerik team
 answered on 10 Jun 2022
0 answers
54 views
I have a composite control that has a link button and RadAyncUpload in RadDataForm.
I access the control as follows using Javascript in a  WebForm.

var filelength = find("<%= CompositeControl1.RadAsyncUpload.ClientID %>").getUploadedFiles().length;

I am not sure how to access this control using javascript from RadDataForm.

I tried using the following,

 var container = $(".RadDataForm")[0];
 var uploaded = $telerik.findElement(container, "CompositeControl1");

I am not sure how to access RadAsyncUpload from the above.Any help is appreciated.Thank you.
T
Top achievements
Rank 1
 asked on 21 Feb 2022
1 answer
64 views

Using CSS and html need the below format like category and sub-categories (Definetly it should be like expanding and collapsing functionality). Could anyone please give me some ideas on aspx side as well as code-behind. That would be great.

 

 


Vessy
Telerik team
 answered on 25 Nov 2021
1 answer
93 views

I have a RadDataform, which has DropDownLists added to the Edit and Insert Item Templates :

<telerik:RadDataForm RenderMode="Lightweight" ID="FormCN" runat="server" 
                    OnNeedDataSource="FormCN_NeedDataSource" 
                    OnItemInserting="FormCN_ItemInserting"
                    OnItemUpdating="FormCN_ItemUpdating"
                    OnItemDeleting="FormCN_ItemDeleting"  
                    OnPreRender="FormCN_PreRender"                     
                    DataKeyNames="CN_SEQ"    
                    Skin="MetroTouch" >
         ...
                <ItemTemplate>
                  ...
                </ItemTemplate>
                    
                <EditItemTemplate>
                  ...
                        <div class="rdfRow">
                            <div class="rdfRight" >                               
                                <telerik:RadComboBox ID="cmbPrep" OnPreRender="cmbPrep_PreRender" OnSelectedIndexChanged="cmbPrep_SelectedIndexChanged" AutoPostBack="true" AllowCustomText="true" runat="server" Skin="MetroTouch" EmptyMessage="Prep" style="float:right;"></telerik:RadComboBox>                                               
                            </div>
                            <telerik:RadTextBox ClientEvents-OnLoad="setHeight" RenderMode="Lightweight" TextMode="MultiLine" ID="PREP" runat="server" Text='<%# Bind("PREP") %>' WrapperCssClass="rdfInput" />                            
                        </div>
                       ...
                </EditItemTemplate>

                <InsertItemTemplate>
                  ...
                        <div class="rdfRow">
                            <div class="rdfRight" >                               
                                <telerik:RadComboBox ID="cmbPrep2" OnPreRender="cmbPrep2_PreRender" OnSelectedIndexChanged="cmbPrep2_SelectedIndexChanged" AutoPostBack="true" AllowCustomText="true" runat="server" Skin="MetroTouch" EmptyMessage="Prep" style="float:right;"></telerik:RadComboBox>                                               
                            </div>
                            <telerik:RadTextBox ClientEvents-OnLoad="setHeight" RenderMode="Lightweight" TextMode="MultiLine" ID="PREP2" runat="server" Text='<%# Bind("PREP") %>' WrapperCssClass="rdfInput" />                            
                        </div>
                      ...
                </InsertItemTemplate>

 

Using NeedDataSource:

 Protected Sub FormCN_NeedDataSource(sender As Object, e As RadDataFormNeedDataSourceEventArgs)
        TryCast(sender, RadDataForm).DataSource = SourceDataTable
    End Sub

Public ReadOnly Property SourceDataTable() As DataTable
        Get
            Dim obj As [Object] = ViewState("SourceDataTable")
            If obj IsNot Nothing Then
                Return DirectCast(obj, DataTable)
            Else
                Dim strConnString As String = ConfigurationManager.ConnectionStrings(Session("mYear")).ConnectionString
                Dim con As OracleConnection = New OracleConnection(strConnString)

                cmdQuery = "SELECT QUEUE, BATCH_NUMBER, " &
                               "CN_SEQ, CN_YEAR, METHOD, " &
                               "PREPMETHOD, PREP, RECEIPT, " &
                               "SAMPPREP, SAMPANAL, CALIBRATION, " &
                               "BLANKS, SURROGATES, SPIKES, " &
                               "INTERNSTANDARD, SAMPLES, OTHER, " &
                               "DUPLICATES, SERIALDILUTION " &
                               "FROM CN_DETAILS " &
                               "WHERE QUEUE = '" & cmbQueue.SelectedValue & "' AND BATCH_NUMBER = " & cmbBatchNumber.SelectedValue & " "

                Dim cmd As OracleCommand = New OracleCommand(cmdQuery)

                cmd.Connection = con
                cmd.CommandType = CommandType.Text
                Dim da As OracleDataAdapter = New OracleDataAdapter(cmd)

                Dim dt As New DataTable()
                da.Fill(dt)
                ViewState("SourceDataTable") = dt
                Return dt

                cmd.Dispose()
                con.Close()
                con.Dispose()
            End If
        End Get

    End Property

On DropDownList Selected Item Changed, I need to populate it's associated textbox with the ddl value. This works well for the EditItem:

 Protected Sub cmbPrep_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs)
        Dim cmbItem As RadComboBox = TryCast(sender, RadComboBox)
        Dim radTextBox As RadTextBox = cmbItem.Parent.FindControl("PREP")
        radTextBox.Text = e.Value.ToString
    End Sub

How do I replicate this functionalit for the InsertItem? I tried this:

Protected Sub cmbPrep2_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs)
        Dim cmbItem As RadComboBox = TryCast(sender, RadComboBox)
        Dim radTextBox As RadDataFormInsertItem = cmbItem.Parent

        'radTextBox.Text = e.Value.ToString

        Dim insertedItem As RadDataFormInsertItem = TryCast(radTextBox, RadDataFormInsertItem)

        Dim newValues As New Hashtable()
        insertedItem.ExtractValues(newValues)
        newValues("PREP") = e.Value.ToString
        newValues("CN_SEQ") = 9999999
        newValues("CN_YEAR") = "2020"
        newValues("QUEUE") = cmbQueue.SelectedValue
        newValues("BATCH_NUMBER") = cmbBatchNumber.SelectedValue

        Dim dt As DataTable = ViewState("SourceDataTable")

        Dim newRow As DataRow = dt.NewRow()

        For Each entry As DictionaryEntry In newValues
            newRow(DirectCast(entry.Key, String)) = entry.Value
        Next

        dt.Rows.Add(newRow)
        ViewState("SourceDataTable") = dt
    End Sub

The corresponding InsertItem textbox is not updated, however, if you click cancel and return to View, the item text is there. What am I missing please?

Attila Antal
Telerik team
 answered on 12 Jun 2020
6 answers
161 views
I have a RadDataForm that is databound to a SQLDataSource.  If I use a RadTextBox within a Div within the EditTemplate, the value entered into that RadTextBox is sent to the database.  However, if I put that RadTextBox within a Table->TableRow->TableCell in the Div, the value entered into that RadTextBox is never sent to the database, nor is it still in the form after the update.  Are there restrictions on how controls can be embedded within the EditTemplates when editing data?
Doncho
Telerik team
 answered on 23 Mar 2020
3 answers
113 views

I can determine if a RadDataForm Is in Insert mode with code like this:

if ($find("<%= frmClaim.ClientID %>")._isItemInserted) { ...

 

 

 

But how can I determine if a RadDataForm is in edit mode from client side JavaScript?

Vessy
Telerik team
 answered on 11 Mar 2020
1 answer
47 views

I have a RadDataForm that contains several RadDropdownLists.   They are all using client binding each with their own instance of RadClientDataSource.

 

How can I unsure the dropdown list data is retrieved and bound before the dataform data is retrieved and attempted to bind?

 

eg.  I have event handler on OnSetValues as follows:

<telerik:RadDataForm RenderMode="Lightweight" runat="server" ID="RadDataForm1"
    DataKeyNames="RecordID" RenderWrapper="true"  ClientDataSourceID="RadClientDataSource1">
    <ClientSettings>
        <ClientEvents OnSetValues="dataFormSetValues" OnGetValues="dataFormGetValues" OnDataFormCreated="dataFormCreated"       />
    </ClientSettings>

 

function dataFormSetValues(sender, args) { 
 
        var dataItem = args;
 
       $telerik.findControl(document, "EditJobTypeDD").findItemByValue(dataItem.JobType).select();
 }

 

The .select() in the javascript function above will fail occasionally when the webservice for the form data returns quicker than the webservice to populate the dropdown list, because there are no items in the dropdownlist yet.

 

Is there a best practice to implement this sort of scenario correctly?

Eyup
Telerik team
 answered on 02 Jan 2020
1 answer
37 views

I started with this demo:   Live Demos\DataForm\Data-Binding\Client-Data-Source-Binding

 

The demo code is working well.

 

However, I run into a problem when I try to add a TimePicker or DateTimePicker to the EditItemTemplate or InsertItemTemplate,  as it is seems to be causing the ItemTemplate to not "hide".    Also,  the clock icon on the picker fails to display the popup with the list of times.

 

Pasting the following into the EditItemTemplate or InsertItemTemplate is causing it to break:

 

<div class="rdfRow">
    <telerik:RadTimePicker RenderMode="Lightweight" ID="temp" Width="100px" runat="server" dateinput-label="" DateInput-DateFormat="HH:mm" TimeView-TimeFormat="HH:mm"></telerik:RadTimePicker>
</div>

 

 

There are no problems however if I add the above control elsewhere in the page.    A DatePicker works fine.   

 

There are no console errors and this behaviour occurs in both Chrome and Edge.

Rumen
Telerik team
 answered on 20 Dec 2019
3 answers
156 views
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
Attila Antal
Telerik team
 answered on 19 Aug 2019
3 answers
229 views

Is it possible to use a userControl for the edit and insert item templates and take advantage of automatic update/inserts.   In my (limited) testing, I can get the edit template to populate, it just can't find the fields when updating.  

Alternatively, is it possible to use either the edit or insert itemTemplate for both insert and update functions?   

My edit and insert templates are identical, I'd like to only have to maintain it in one place.  

 

 

 

 

Attila Antal
Telerik team
 answered on 04 Apr 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?