Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
91 views

This problem occurs after uploading the site

All controls are displayed in disarray

See photos

plz help me

komeil
Top achievements
Rank 1
 asked on 19 Nov 2019
2 answers
144 views

Hello 

I am using RadGrid, which is using BatchEditing.

The grid has columns: From, To and Hours.

I am updating on Client column Hours as a difference of From and To: (From: 6:00 To: 10:30 Hours: 4:30).

This change needs to be done when the column is changed.

I am using the event "ClientSettings-ClientEvents-OnBatchEditCellValueChanged" to check if columns in question were changed and to prepare the result. However, I cannot use batchEditingManager.changeCellValue() in this event, because the event of changing the cell is not done yet. I will get an exception. I am currently waiting to user click and updating cells in that event, which is not optimal. I tried more events but with similar problems.

I know how to get cells, how to change them etc.

I just need the correct event after a cell is done updating or update function which will not loop to an existing event.

Thank you.

Igor
Top achievements
Rank 1
 answered on 19 Nov 2019
3 answers
173 views
I am trying to get a RadGrid to support both Virtualization and Custom Paging.  I can get either to work fine, but not both together.  This is my code for NeedDataSource below.  It seems that CurrentPageIndex  is always set to 0.  I would expect that to increment with the virtual scrolling.

  protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            
            int startRowIndex = RadGrid1.CurrentPageIndex * RadGrid1.PageSize;
            int maxRows = RadGrid1.PageSize;
            var reportDetails = DataAccess.GetReportDetails(Convert.ToInt32(reportSummary["ReportSummaryId"]), startRowIndex, maxRows);
            RadGrid1.DataSource = reportDetails;
        }

        protected void RadAjaxPanel_Init(object sender, EventArgs e)
        {
            //SET THE TOTAL # OF ROWS IN THE OVERALL REPORT
            string userKey = Common.GetUserKeyFromCookie(Request);
            DataTable reportSummaryTable = DataAccess.GetReportSummary(userKey, "SelectFollows");
            reportSummary = reportSummaryTable.Rows[0];
            int recordCount = Convert.ToInt32(reportSummary["RecordCount"]);
            RadGrid1.MasterTableView.VirtualItemCount = recordCount;
            RadGrid1.VirtualItemCount = recordCount;
        }



The code from my ASPX is:

<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel" OnInit="RadAjaxPanel_Init" LoadingPanelID="RadAjaxLoadingPanel1">
        <telerik:RadGrid AutoGenerateColumns="False" ID="RadGrid1" PageSize="100" OnNeedDataSource="RadGrid1_NeedDataSource" runat="server">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <GroupingSettings CaseSensitive="false" />
            <MasterTableView AllowCustomPaging="true" AllowPaging="true" TableLayout="Fixed">
                <Columns>
                    <telerik:GridBoundColumn UniqueName="ScreenName" HeaderText="ScreenName" HeaderStyle-Width="250px" DataField="ScreenName"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="ProfileImage" HeaderText="Photo" HeaderStyle-Width="250px" DataField="ProfileImage"></telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings ReorderColumnsOnClient="true" AllowColumnsReorder="true" ColumnsReorderMethod="Reorder">
                <Virtualization EnableVirtualization="true" InitiallyCachedItemsCount="100"
                    LoadingPanelID="RadAjaxLoadingPanel1" ItemsPerView="100" />
                <Scrolling AllowScroll="true" EnableVirtualScrollPaging="true" UseStaticHeaders="true" ScrollHeight="500px" />
                <Resizing AllowColumnResize="true" />
            </ClientSettings>
            <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
        </telerik:RadGrid>

    </telerik:RadAjaxPanel>
Eyup
Telerik team
 answered on 19 Nov 2019
4 answers
101 views

Hello,

there is a bug with linear-gradient mixin. When no gradient is defined, invalid css is generated.

For example:

Upload.Bootstrap.scss

// ProgressBar
.ruFileProgressWrap {
    background-color: $progress-bg;
    background-image: linear-gradient($progress-gradient);
    border-radius: 2px;
}

results in

.RadUpload_Bootstrap .ruFileLI .ruFileProgressWrap {
  background-color: whitesmoke;
  background-image: linear-gradient();
  border-radius: 2px; }

So background-image value is invalid and should be "none"

.RadUpload_Bootstrap .ruFileLI .ruFileProgressWrap {
  background-color: whitesmoke;
  background-image: none;
  border-radius: 2px; }

 

This is problem in source files, Skin builder generates the same files etc. When this css is passed for some postprocessing in build process (postcss and autoprefixer for example), it fails.

 

Best Regards

René

René
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 18 Nov 2019
3 answers
278 views

Hello 

I am using RadGrid, which is using BatchEditing. I am using RadComboBox in a column, which is using LoadOnDemand.

This column is showing PROJECT_ID value in the grid. What I need to do, is to bind Column to show PROJECT_NAME.

Because of optimization, I cannot load PROJECT_NAME as a hidden column to the grid or something like that.

I need some Data source where I will have combinations PROJECT_ID  -> PROJECT_NAME and bind it to the column.

This is a solution we are using in different systems.

It is this achievable in Telerik RadGrid and RadCombobox?

Stripped demo code:

ASPX:

<%@ Page Title="Test Page" Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="TimeReport.Web.Pages.WebForm2" MasterPageFile="~/MasterPage.master" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"
   <link href="/Styles/mail.css" rel="stylesheet" />
</asp:Content>
 
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent"   runat="Server">
   <asp:Label CssClass="header" ID="Label1" runat="server" Text="content3" />
   <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" OnNeedDataSource="messages_NeedDataSource"
    AllowAutomaticInserts="True"
     AllowAutomaticUpdates="True" AllowPaging="True"
    AutoGenerateColumns="False"   PageSize="20"
           
    Width="100%"
    Height="100%"
    Style="border: 0; outline: none" AllowSorting="True">
    <MasterTableView CommandItemDisplay="Top" DataKeyNames="PERSON_ACTIVITY_ID"
      HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False"
      TableLayout="Fixed">
      <BatchEditingSettings EditType="Cell" HighlightDeletedRows="true" OpenEditingEvent="DblClick" />
      <SortExpressions>
        <telerik:GridSortExpression FieldName="PERSON_ACTIVITY_ID" SortOrder="Descending" />
      </SortExpressions>
      <CommandItemSettings ShowExportToExcelButton="True" ShowExportToPdfButton="True" />
      <Columns>
         <telerik:GridTemplateColumn HeaderText="Projekt" UniqueName="PROJECT_ID" DataField="PROJECT_ID" SortExpression="PROJECT_ID" HeaderStyle-Width="15%" ItemStyle-Width="15%"  >
          <ItemTemplate>
            <%#DataBinder.Eval(Container.DataItem, "PROJECT_ID")%>
          </ItemTemplate>
          <EditItemTemplate>
            <telerik:RadComboBox RenderMode="Lightweight" runat="server" ID="GCB_Project" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
              OnItemsRequested="PROJECT_ItemsRequested1" EnableLoadOnDemand="true" Width="100%" Height="300" ItemsPerRequest="10"  DataTextField="PROJECT_NAME" DataValueField="PROJECT_ID" >
            </telerik:RadComboBox>
          </EditItemTemplate>
 
<HeaderStyle Width="15%"></HeaderStyle>
 
<ItemStyle Width="15%"></ItemStyle>
        </telerik:GridTemplateColumn>    
 
      </Columns>
      <PagerStyle Position="TopAndBottom" AlwaysVisible="True" />
    </MasterTableView>
    <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
 
    <ExportSettings>
      <Pdf PageWidth="">
      </Pdf>
    </ExportSettings>
 
    <ClientSettings AllowKeyboardNavigation="true" EnableRowHoverStyle="true">
      <Selecting AllowRowSelect="True" />
      <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    </ClientSettings>
 
    <PagerStyle Position="TopAndBottom" AlwaysVisible="True" />
    <FilterMenu RenderMode="Lightweight"></FilterMenu>
 
    <HeaderContextMenu RenderMode="Lightweight"></HeaderContextMenu>
  </telerik:RadGrid>
 
 
</asp:Content>

CS:

using System;
using System.Data;
using Telerik.Web.UI;
 
 
namespace TimeReport.Web.Pages
{
  public partial class WebForm2 : Api.Page
  {
    private const int ItemsPerRequest = 10;
 
    protected void Page_Load(object sender, EventArgs e)
    {
    }
 
    protected void PROJECT_ItemsRequested1(object sender, RadComboBoxItemsRequestedEventArgs e)
    {
      DataTable data = new Api.Projects(TRApiSessionContext.CurrentUser.Login).LoadBasic();  //Load DataTable for ComboBox
      int itemOffset = 0;
    int endOffset = 0;
    int count = 0;
      if (data == null)
      {
        e.EndOfItems = true;
      }
      else
      {
        itemOffset = e.NumberOfItems;
        endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);
        e.EndOfItems = endOffset == data.Rows.Count;
        count = data.Rows.Count;
      }
       
      for (int i = itemOffset; i<endOffset; i++)
      {
        ((RadComboBox)sender).Items.Add(new RadComboBoxItem(data.Rows[i]["PROJECT_FULL_NAME"].ToString(), data.Rows[i]["PROJECT_ID"].ToString()));
      }
    //  e.Message = GetStatusMessage(endOffset, count);
    }
 
    protected void messages_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
      RadGrid1.DataSource = new Api.Activities("vrabel").Load();  //Load DataTable for Grid
    }
  }
}

 

Thank you.

Attila Antal
Telerik team
 answered on 18 Nov 2019
1 answer
93 views
I cannot find a example of this, but is there a way to distinguish between edit mode types such as "Insert","Update"? I have the button for inserting and updating already configured to switch between the modes. 
Eyup
Telerik team
 answered on 18 Nov 2019
2 answers
941 views
Here is my RadGrid aspx :   

     
<telerik:RadGrid ID="grd_transactions" runat="server" GroupPanelPosition="Top" AutoGenerateColumns="False">
            <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
            <MasterTableView>
                <Columns>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Type column" HeaderText="Type" UniqueName="TemplateColumn_Type">
                        <HeaderStyle Font-Bold="True" Font-Size="Medium" Width="100px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemTemplate>
                            <asp:Label ID="lbl_Type" runat="server" Text="lbl_Type"></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Date_Time_UTC_GMT column" HeaderText="Date & Time (UTC/GMT)" UniqueName="TemplateColumn_Date_Time_UTC_GMT">
                        <HeaderStyle Font-Bold="True" Font-Size="Medium" Width="200px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemTemplate>
                            <asp:Label ID="lbl_Date_Time_UTC_GMT" runat="server" Text="lbl_Date_Time_UTC_GMT"></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_BTC_Investment_Address column" HeaderText="BTC Investment Address" UniqueName="TemplateColumn_BTC_Investment_Address">
                        <HeaderStyle Font-Bold="True" Font-Size="Medium" Width="600px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemTemplate>
                            <asp:Label ID="lbl_BTC_Investment_Address" runat="server" Text="lbl_BTC_Investment_Address"></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Deposit_Amount column" HeaderText="Deposit Amount" UniqueName="TemplateColumn_Deposit_Amount">
                        <HeaderStyle Font-Bold="True" Font-Size="Medium" Width="150px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemTemplate>
                            <asp:Label ID="lbl_Deposit_Amount" runat="server" Text="lbl_Deposit_Amount"></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Payout_Amount column" HeaderText="Payout Amount" UniqueName="TemplateColumn_Payout_Amount">
                        <HeaderStyle Font-Bold="True" Font-Size="Medium" Width="150px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemTemplate>
                            <asp:Label ID="lbl_Payout_Amount" runat="server" Text="lbl_Payout_Amount"></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Status column" HeaderText="Status" UniqueName="TemplateColumn_Status">
                        <HeaderStyle Font-Bold="True" Font-Size="Medium" Width="150px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        <ItemTemplate>
                            <asp:Label ID="lbl_Status" runat="server" Text="lbl_Status"></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>


Now in code behind i want to fill those labels inside TemplateColumns like this :  
 

DataTable table = new DataTable();
table.Columns.Add("Type", typeof(string));
table.Columns.Add("Date & Time (UTC/GMT)", typeof(string));
table.Columns.Add("BTC Investment Address", typeof(string));
table.Columns.Add("Deposit Amount", typeof(string));
table.Columns.Add("Payout Amount", typeof(string));
table.Columns.Add("Status", typeof(string));
table.Rows.Add("1", "2", "3", "4" ,"5", "6");
table.Rows.Add("1", "2", "3", "4", "5", "6");
table.Rows.Add("1", "2", "3", "4", "5", "6");
table.Rows.Add("1", "2", "3", "4", "5", "6");
table.Rows.Add("1", "2", "3", "4", "5", "6");
grd_transactions.DataSource = table;
grd_transactions.DataBind();


Here is the wrong output.

How can i access those labels & fill them?
Zakhaliya Ivarnovich
Top achievements
Rank 1
 answered on 16 Nov 2019
1 answer
136 views

A client wanted text selected by default when entering edit mode, so I did some research and applied the solution noted below.

Using RadGrid with VB.NET, Batch Edit Mode with GridTemplateColumns. 

When clicking a cell that has a RadComboBox, the BatchEditOpened function doesn't return the correct reference to the control when clicking a cell on the same row that is INPUT only.

Here is a link to a sample App that replicates the pattern described:
https://1drv.ms/u/s!AtPkHVExQn29bhZgXpAMSX2LKgQ

All you need to do is add the latest Telerik DLLs to the project and it should compile.  Excluded them from the ZIP file at the above link.

 

The real page is wired up to a SQL Server database, but I was able to use the XML Data Source from the Sample Applications to replicate the issue.

 

Here is the page design:

<telerik:RadCodeBlock runat="server">
    <script type="text/javascript">
 
        function BatchEditOpened(sender, args) {
            var batchManager = sender.get_batchEditingManager();
            var theCell = batchManager._getDataControl(args.get_row(), args.get_columnUniqueName());
 
            if (theCell.tagName == "INPUT") {
                setTimeout(function () {
                    theCell.select();
                }, 30)
            }
        }
 
    </script>
</telerik:RadCodeBlock>
 
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid2" runat="server" ShowStatusBar="true" OnNeedDataSource="RadGrid2_NeedDataSource"
    OnInsertCommand="RadGrid2_InsertCommand" OnUpdateCommand="RadGrid2_UpdateCommand"
    OnDeleteCommand="RadGrid2_DeleteCommand">
 
    <MasterTableView AutoGenerateColumns="false" DataKeyNames="CustomerID" EditMode="Batch" CommandItemDisplay="Top">
        <Columns>
 
            <telerik:GridTemplateColumn HeaderStyle-Width="50px" AllowSorting="true" SortExpression="CustomerID" ItemStyle-BorderColor="Black" ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="0.5px" HeaderText="L3" UniqueName="L3" ItemStyle-CssClass="rgRightItem" HeaderStyle-CssClass="rgCenterHeader">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblCustomerId" Text='<%# Eval("CustomerID") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox runat="server" ID="txtCustomerId" Text='<%# Eval("CustomerID") %>'></asp:TextBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
 
            <telerik:GridTemplateColumn HeaderStyle-Width="175px" AllowSorting="true" SortExpression="ContactName" HeaderText="Contact Name Header" UniqueName="ContactName" SortedBackColor="LemonChiffon" ItemStyle-CssClass="rgLeftItem" HeaderStyle-CssClass="rgLeftHeader">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblContactName" Text='<%# Eval("ContactName") %>'></asp:Label>
                     
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadComboBox runat="server" ID="editContactName" EnableLoadOnDemand="True" DataTextField="ContactName"
                        OnItemsRequested="editContactName_ItemsRequested" DataValueField="ID"
                        HighlightTemplatedItems="true" Height="140px" DropDownAutoWidth="Enabled" Sort="Ascending">
                    </telerik:RadComboBox>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
 
 
        </Columns>
    </MasterTableView>
    <ClientSettings>
        <ClientEvents OnBatchEditOpened="BatchEditOpened" />
    </ClientSettings>
</telerik:RadGrid>

 

Here is the code behind:

Imports System
 
Imports Telerik.Web.UI
Imports System.Collections
 
Public Class test1
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
    End Sub
 
    Private Const FILE_PATH As String = "~/App_Data/Xml/XmlDataSourceExampleTemp.xml"
 
    Protected Sub RadGrid2_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs)
 
        Dim sourceDocument = LoadDocument(FILE_PATH)
        Dim customers = GetCustomersEnumeration(sourceDocument, "Customers", "Customer")
        Dim gridSource = From customer In customers
                         Select New With {.CustomerID = customer.Attribute("CustomerID").Value, .ContactName = customer.Attribute("ContactName").Value, .CompanyName = customer.Attribute("CompanyName").Value}
        CType(sender, RadGrid).DataSource = gridSource
 
    End Sub
 
    Private Function LoadDocument(path As String) As XDocument
 
        Dim sourceDocument As XDocument = XDocument.Load(Me.Server.MapPath(path))
        Return sourceDocument
 
    End Function
 
    Private Function GetCustomersEnumeration(sourceDocument As XDocument, rootNode As XName, childNode As XName) As IEnumerable(Of XElement)
 
        Dim customers = sourceDocument.Element(rootNode).Elements(childNode)
        Return customers
 
    End Function
 
    Protected Sub RadGrid2_UpdateCommand(source As Object, e As GridCommandEventArgs)
 
    End Sub
 
    Protected Sub RadGrid2_InsertCommand(source As Object, e As GridCommandEventArgs)
 
    End Sub
 
    Protected Sub RadGrid2_DeleteCommand(source As Object, e As GridCommandEventArgs)
 
    End Sub
 
    Protected Sub editContactName_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
        Dim combo As RadComboBox = TryCast(sender, RadComboBox)
        combo.Items.Add(New RadComboBoxItem("Alfreds Futterkiste", "0"))
        combo.Items.Add(New RadComboBoxItem("Antonio Moreno Taqueria", "1"))
        combo.Items.Add(New RadComboBoxItem("Around the Horn", "2"))
    End Sub
 
 
End Class
Attila Antal
Telerik team
 answered on 15 Nov 2019
5 answers
277 views
I get a trouble when using Excel-like Filtering with GridDateTimeColumn.
It doesn't worked.
Anyone give me an example about it. 
Many thanks !
Attila Antal
Telerik team
 answered on 15 Nov 2019
3 answers
583 views

I am trying to get the values from the RadGrid insert form and then insert those values from the form elements into a SQL database using a stored procedure. When I run the following code using the RadGrid insert command sub, empty values are inserted to the database.

Here is the code:

Protected Sub rg_InsertCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles rg.InsertCommand
        Dim item As GridEditFormInsertItem = CType(e.Item, GridEditFormInsertItem)
        Dim name As RadTextBox = TryCast(item.FindControl("txtName"), RadTextBox)
        Dim str As String = name.Text
    End Sub
Attila Antal
Telerik team
 answered on 14 Nov 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?