Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
97 views
Hide  Timeline views.
bassam
Top achievements
Rank 1
Veteran
 answered on 27 May 2020
2 answers
238 views

We have a need to be able to select from ~15,000 rows and need to use the RadGrid virtualization for a continuous grid instead of the "paging" mechanism.  We have encountered 2 issues that hopefully you can assist with. 

Issue 1:

When a user scrolls down in the grid - say row 5000, and they select a row, the code-behind does not receive the correct values that are displayed to the user but instead the value of the row as initially set - guessing since the grid doesn't really change, just the values. You can see this behavior in the sample code provided by setting a break in RadGrid1_ItemCommand and looking at the values coming into the method vs what is displayed to the user at that row.  

Issue 2:

The scroll position is not maintained even when setting  - ClientSettings-Scrolling-SaveScrollPosition="true".

Attached is a screen capture of the issues and code from captures to verify.

Is it possible to correct these issues or workaround???

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SimpleGridVirtual.aspx.cs" Inherits="UX.SimpleGridVirtual" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
 
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="false" Skin="Silk" />
        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1"></telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel" LoadingPanelID="RadAjaxLoadingPanel1" CssClass="demo-container">
 
            <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" AllowPaging="true" PageSize="10000" AllowMultiRowSelection="true"
                AllowSorting="true" OnNeedDataSource="RadGrid1_NeedDataSource" ClientSettings-Selecting-AllowRowSelect="true" OnItemCommand="RadGrid1_ItemCommand" ClientSettings-Scrolling-SaveScrollPosition="true">
                 
                <ClientSettings ReorderColumnsOnClient="true" AllowColumnsReorder="true" ColumnsReorderMethod="Reorder" EnablePostBackOnRowClick="true">
                    <Virtualization EnableVirtualization="true" InitiallyCachedItemsCount="2000" ItemsPerView="100" />
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="500px" />
                    <Resizing AllowColumnResize="true" />
                </ClientSettings>
                 
                <MasterTableView>
                    <Columns>
                        <telerik:GridClientSelectColumn UniqueName="UserSelect" HeaderStyle-Width="100px"></telerik:GridClientSelectColumn>
                        <telerik:GridBoundColumn UniqueName="Column" HeaderText="Column" HeaderStyle-Width="300px" DataField="Column" Visible="true"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="Date" HeaderText="Date" HeaderStyle-Width="300px" DataField="Date"></telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
             
            </telerik:RadGrid>
        <asp:ListBox Height="300px" Width="300px" runat="server" ID="RowClickedStatus">
 
        </asp:ListBox>
 
        </telerik:RadAjaxPanel>
 
    </form>
</body>
</html>
 
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace UX
{
    public partial class SimpleGridVirtual : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("Get DataSource");
            RadGrid1.DataSource = GetDataSource();
        }
 
        private DataTable GetDataSource()
        {
            if (Session["datasource"] == null)
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("Column", typeof(string));
                dt.Columns.Add("Date", typeof(string));
                for (int i = 0; i < 10000; i++)
                {
                    dt.Rows.Add("Row " + i.ToString(), DateTime.Now.AddDays(i) + "_" + i.ToString());
                }
                Session["datasource"] = dt;
            }
            return Session["datasource"] as DataTable;
        }
 
        protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if ((string.Compare(e.CommandName, "RowClick", true) == 0) && (e.Item != null))
            {
                DataTable GridItems = Session["VirtualizationDataSource"] as DataTable;
                List<string> SelectedItems = (List<string>)Session["CurrentSelections"];
 
                string ColumnValue = e.Item.Cells[3].Text;
                RowClickedStatus.Items.Add(ColumnValue);
                System.Diagnostics.Debug.WriteLine("Got Value: " + ColumnValue);
                string DateValue = e.Item.Cells[4].Text;
            }
        }
    }
}

 

 

Van
Top achievements
Rank 1
Iron
Iron
 answered on 27 May 2020
2 answers
391 views

The code below works i the code behind but I need a rough equivalent doing this on the front end using js.

 

            RadWindow rw = new RadWindow();

          btn.Style.Add("position", "absolute");
            btn.Style.Add("bottom", "5px");
            btn.Style.Add("right", "10px");

 

         rw.ContentContainer.Controls.Add(btn);

 

 

 

Thanks in advance for any suggestions.

 

Doncho
Telerik team
 answered on 27 May 2020
8 answers
1.7K+ views

Hi, i've prepared a form using Rad controls and i need to use 3 controls to Upload files. I had some first problem to validate these controls, solved using hidden fields that I value when a file is uploaded.

So when I press the Submit button (RadButton) the page is actually validated, but if there are problems on some other fields than RadAsyncUpload, the result is that the upload control loses the correct information on display.

I'm using Ajax, Telerik UI R2 2019, the jquery version i see is v1.12.4, Page_ValidationVer = "125";

I've read many discussions, but there's something wrong in my case.

https://docs.telerik.com/devtools/aspnet-ajax/controls/button/how-to/radbutton-validation-and-client-side-event-handlers

 

I tried to intercept the validation in order to maybe implement something like this

https://www.telerik.com/forums/retain-uploaded-files-for-display-after-postback

but I can't, because if I try to call the function  Page_ClientValidate it always returns TRUE.

function Page_ClientValidate(validationGroup) {
    Page_InvalidControlToBeFocused = null;
    if (typeof(Page_Validators) == "undefined") {
        return true;
    }
    var i;
    for (i = 0; i < Page_Validators.length; i++) {
        ValidatorValidate(Page_Validators[i], validationGroup, null);
    }
    ValidatorUpdateIsValid();
    ValidationSummaryOnSubmit(validationGroup);
    Page_BlockSubmit = !Page_IsValid;
    return Page_IsValid;
}

 

Trying in debug i see that Page_Validators = undefined so the function exit with 'true' 

The form submit correctly and server-side i see Page.IsValid property values but I need to perform the submit only where all fields are compiled or the asyncupload controls mantains their state after validation.

 

Could there be confusion between client and server validation?

Do you have any ideas? Thanks

Cheah
Top achievements
Rank 1
Veteran
 answered on 27 May 2020
35 answers
1.6K+ views
Hello,

I can't set the hight to 100%, only the width.

My code:

 

<telerik:RadFileExplorer runat="server" ID="FileExplorer1" Width="100%" Height="100%"

 

 

OnClientItemSelected="OnClientItemSelected" style="display:block; float: none">

 

Vessy
Telerik team
 answered on 27 May 2020
1 answer
108 views

I am creating radwindows dynamically with js and I am using this syntax and when the window renders it doesn't move when prompted to. It stays in one fixed position

...

radWindow.set_behaviors("Telerik.Web.UI.WindowBehaviors.Move");

...

 

Thanks in advance for any suggestions.

Eric
Top achievements
Rank 1
Veteran
 answered on 26 May 2020
1 answer
405 views

Hi, i'm trying your control suite and i started to try the control in subject following the demo ccode of your website and all works fine if i use the default document ( <PdfjsProcessingSettings File="prev.pdf">
        </PdfjsProcessingSettings>). But what should i do if i want to pass the file name in runtime mode dynamically? I tried this:

 

.ASPX FILE

<%@ Page Language="VB" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="PdfProva._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.2/pdf.js"></script>
<script type="text/javascript">
    window.pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.2/pdf.worker.js';
</script>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        <telerik:RadAjaxPanel runat="server">
    <asp:Button ID="Button1" runat="server" Text="Get File Name" OnClick="Button1_Click" />
    <asp:Label ID="Label1" runat="server"></asp:Label>
    <telerik:RadPdfViewer runat="server" ID="RadPdfViewer1" Height="450px" Width="1000px"
        Skin="Default" RenderMode="Lightweight">
        <PdfjsProcessingSettings>
        </PdfjsProcessingSettings>
    </telerik:RadPdfViewer>
</telerik:RadAjaxPanel>
    </div>
        
    </form>
</body>
</html>

 

VB FILE

Imports Telerik.Web.UI

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim filename As String = Server.MapPath("~/prev.pdf")
        RadPdfViewer1.PdfjsProcessingSettings.File = filename
        Dim currentPage = RadPdfViewer1.ActivePage
        Dim result As String = String.Format("Opened file with name: <strong>{0}</strong> on page: <strong>{1}</strong><br />", filename, currentPage)
        Label1.Text = result
    End Sub
End Class

The result is that issue an error "PDF file fails to process".

How to solve?

 

Vessy
Telerik team
 answered on 26 May 2020
6 answers
158 views

There seems to be some format issues with the base Filter Window. It either does not show the save buttons without scrolling, and applying filters where the side menu pops out almost always requires scrolling. 

I can set a height or min height and that seems to help with seeing the buttons, but the slide out filter menu even with a min width or width sometimes requires scrolling. And sometimes (but not always) the filter box "blue area" in the screenshot widens to take up the entire window area.

Rumen
Telerik team
 answered on 26 May 2020
3 answers
215 views

I am trying to override the default  style of a radwindow using js...I see this is simple to do in the code behind, but I need a way to do it on the front end as well. This is what i've tried.

 

var radWindow = $find("<%=RadWindowManager1.ClientID%>").Open(null,null);
          radWindow.setSize(640, 480);
            radWindow._cssClass =  " customClass";
            radWindow.set_title("Fubar");
            radWindow.setActive(true);
            radWindow.SetModal(true);
            radWindow.center();
         
            radWindow.set_visibleStatusbar(false)
            radWindow.set_keepInScreenBounds(true);

 

The window opens but the custom class isn't applied. Thanks in advance for any suggestions.

Rumen
Telerik team
 answered on 26 May 2020
4 answers
358 views
I have a grid that I'm able to indent a set of text on the webpage but not able to maintain this formatting on PDF & Excel exporting.
Attila Antal
Telerik team
 answered on 25 May 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?