Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
98 views
Hello,

I'm creating a web application for a reservation system where i'm using the RadScheduler control in my page for managing all the reservations where the advanced form is being used to handle the insert and edit functionality.

Upon client request, I implemented the TimeLine view with resources being displayed at the left side of the control. Here a serious problem showed up where I was unable to create a new reservation in the timeline view by dragging the mouse over the time slots for selecting a specified period of time to be bind to the advanced form. When a double click is done the advanced form is called and the time shown in it is the duration of the slot (15 minutes).

I need to know how to implement this functionality in the time line view (time slot selection before insert like in Day view).

Thanks in advance.
Regards.
Hristo Valyavicharski
Telerik team
 answered on 10 Feb 2015
0 answers
96 views
Since Q1 2015 Beta/Q1 2015 the default dimensions of the SVG rendering element in RadHtmlChart have changed from pixels to percentages (i.e., width="100%" and height="100%").

The actual RadHtmlChart dimensions are now defined by its wrapper and default height of 400px.

The change may affect the appearance of a chart that has no dimensions defined which is placed inside a div element with inline-block style and no width.

Telerik Admin
Top achievements
Rank 1
Iron
 asked on 10 Feb 2015
27 answers
973 views
I have a SQL Server table with over 2 million rows.  It's well optimized and I have a stored procedure that, given the start of a word, can return 10 matching records very quickly.  However, I'm trying to see if this can be used via the RadAutoCompleteBox. 

My test page is not loading (no error but it's taking forever to load) and I am assuming this is because it's trying to look at ALL 2 million records?

<telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox1" InputType="Text"
                DataSourceID="SqlDataSource1" DataTextField="Title" Filter="StartsWith">
</telerik:RadAutoCompleteBox>
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
   ConnectionString="<%$ ConnectionStrings:MyConnectionString%>"
   SelectCommand="SELECT Title FROM dbo.AllKeywords ORDER BY Title">
</asp:SqlDataSource>

Am I doing something wrong?  Does anyone have experience in using RadAutoCompleteBox on very large data sets?
Mohammed BENKHDAR
Top achievements
Rank 1
 answered on 10 Feb 2015
1 answer
107 views
I have other project ,It can get "FilterExpression"

code below
=========================================================================================================================
<%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" CodeBehind="AdventureWork.aspx.cs" Inherits="Simple.RadGridSortAndPaging.Views.AdventureWork" EnableViewState="false" ViewStateMode="Disabled" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
    <title></title>
</head>
<body>
    <script type="text/javascript">
        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
                args.set_enableAjax(false);
            }
        }
    </script>
    <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>

        <%--<telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />--%>
        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel" LoadingPanelID="RadAjaxLoadingPanel1">
        </telerik:RadAjaxPanel>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <%--<ClientEvents OnRequestStart="onRequestStart" />--%>
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <%--<telerik:RadFormDecorator runat="server" DecorationZoneID="demo" EnableRoundedCorners="false" DecoratedControls="All" />--%>
        <asp:ValidationSummary runat="server" ID="ValidationSummary1" />
        <div>
            <div>
                <telerik:RadGrid ID="RadGrid1" runat="server" Culture="zh-TW" Width="990px"
                    AllowCustomPaging="True"
                    AllowPaging="True"
                    PageSize="12"
                    AllowSorting="True"
                    ShowFooter="True"
                    AllowAutomaticDeletes="True"
                    AllowAutomaticInserts="True"
                    AllowAutomaticUpdates="True"
                    AutoGenerateColumns="False"
                    AllowMultiRowSelection="True"
                    AllowMultiRowEdit="true"
                    OnNeedDataSource="RadGrid1_NeedDataSource">

                    <ExportSettings ExportOnlyData="True" OpenInNewWindow="True" IgnorePaging="False">
                        <Excel Format="ExcelML"></Excel>
                    </ExportSettings>
                    <ClientSettings EnableRowHoverStyle="true">
                        <Selecting AllowRowSelect="True"></Selecting>
                    </ClientSettings>
                    <EditItemStyle Wrap="False" />
                    <FilterMenu EnableImageSprites="False"></FilterMenu>
                    <MasterTableView CommandItemDisplay="Top" GridLines="none"
                        DataKeyNames="OrderID"
                        AllowFilteringByColumn="True"
                        AllowSorting="True"
                        ShowFooter="False"
                        ItemType="Simple.RadGridSortAndPaging.Models.Orders">
                        <CommandItemSettings ExportToPdfText="Export to PDF" ShowAddNewRecordButton="False" ShowRefreshButton="False" ShowExportToExcelButton="true"></CommandItemSettings>

                        <Columns>
                            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" Text="Edit" HeaderText="" UniqueName="Edit" />
                            <telerik:GridTemplateColumn HeaderText="BusinessEntityID" UniqueName="BusinessEntityID"
                                DataField="BusinessEntityID" SortExpression="BusinessEntityID">
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text="<%# BindItem.OrderID %>"></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text="<%# BindItem.OrderID %>"></asp:Label>
                                </EditItemTemplate>
                            </telerik:GridTemplateColumn>

                            <telerik:GridBoundColumn DataField="CustomerID" AutoPostBackOnFilter="True" FilterControlAltText="Filter CustomerID column" HeaderText="CustomerID" SortExpression="CustomerID" UniqueName="CustomerID">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID11" SortExpression="CustomerID" UniqueName="CustomerID11"
                                CurrentFilterFunction="Contains" AutoPostBackOnFilter="True" ShowFilterIcon="true" FilterDelay="2600" FilterControlAltText="Filter CustomerID column">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                                <HeaderStyle HorizontalAlign="Center" Width="70px"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="EmployeeID" FilterControlAltText="Filter EmployeeID column" HeaderText="EmployeeID" SortExpression="EmployeeID" UniqueName="EmployeeID">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="OrderDate" DataFormatString="{0:yyyy/MM/dd}" FilterControlAltText="Filter FirstName column" HeaderText="OrderDate" SortExpression="OrderDate" UniqueName="OrderDate">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="RequiredDate" DataFormatString="{0:yyyy/MM/dd}" FilterControlAltText="Filter RequiredDate column" HeaderText="MiddleName" SortExpression="RequiredDate" UniqueName="RequiredDate">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShippedDate" DataFormatString="{0:yyyy/MM/dd}" FilterControlAltText="Filter LastName column" HeaderText="ShippedDate" SortExpression="ShippedDate" UniqueName="ShippedDate">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipVia" FilterControlAltText="Filter ShipVia column" HeaderText="ShipVia" SortExpression="ShipVia" UniqueName="ShipVia">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Freight" FilterControlAltText="Filter Freight column" HeaderText="Freight" SortExpression="Freight" UniqueName="Freight">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipName" FilterControlAltText="Filter ShipName column" HeaderText="ShipName" SortExpression="AdditionalContactInfo" UniqueName="ShipName">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipAddress" FilterControlAltText="Filter ShipAddress column" HeaderText="ShipAddress" SortExpression="ShipAddress" UniqueName="ShipAddress">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipCity" FilterControlAltText="Filter ShipCity column" HeaderText="ShipCity" SortExpression="ShipCity" UniqueName="ShipCity">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipRegion" FilterControlAltText="Filter ShipRegion column" HeaderText="ShipRegion" SortExpression="ShipRegion" UniqueName="ShipRegion">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipCountry" FilterControlAltText="Filter ShipCountry column" HeaderText="ShipCountry" SortExpression="ShipCountry" UniqueName="ShipCountry">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>

                            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Delete" HeaderText="" UniqueName="Delete" />
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </div>
        </div>
        <br />
    </form>
</body>
</html>

=========================================================================================================================

C# Code
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    if (!e.IsFromDetailTable)
    {
        var radGrid = (RadGrid)sender;

        var where1 = RadGridHelper.GetFilterExpression(radGrid.MasterTableView, null);
        var orderBy1 = RadGridHelper.GetOrderBy(radGrid.MasterTableView);
        var filter = radGrid.MasterTableView.FilterExpression;
        var orderBy = radGrid.MasterTableView.SortExpressions.GetSortString();

        var skip = radGrid.MasterTableView.CurrentPageIndex * radGrid.MasterTableView.PageSize;
        var take = radGrid.MasterTableView.PageSize;
        var totalRowCount = 0;
        radGrid.DataSource = GetAllOrders(skip, take, orderBy, filter, out totalRowCount);

        if (e.RebindReason == GridRebindReason.InitialLoad
             || e.RebindReason == GridRebindReason.ExplicitRebind)
        {
            radGrid.VirtualItemCount = totalRowCount;
        }
    }
}
public IEnumerable<Orders> GetAllOrders(
    int startRowIndex, int maximumRows, string sortExpression, string filterExpression, out int totalRowCount)
{
    if (string.IsNullOrWhiteSpace(sortExpression))
    {
        sortExpression = "OrderID ASC";
    }
    NorthwindDbContext dbContext = new NorthwindDbContext();

    var query = dbContext.Orders.OrderBy(sortExpression);

    if (!string.IsNullOrWhiteSpace(filterExpression))
    {
        query = query.Where(filterExpression);
    }

    totalRowCount = query.Count();

    query = query.Skip(startRowIndex);
    query = query.Take(maximumRows);

    return query.AsNoTracking().ToList();
}
Maria Ilieva
Telerik team
 answered on 10 Feb 2015
12 answers
283 views
I am using .wav files to generate the audio. It works in all the popular browsers except Safari. I am using the latest version of safri and also have quicktime installed too but still it didn't work. Have anyone faced this issue earlier .  Can anyone help with this issue.
Slav
Telerik team
 answered on 10 Feb 2015
1 answer
191 views
Dear Friends,
I created RadGrid with Enabled = "false". The grid got disabled.

Now i want to enable Grid cells when Edit Button click through Javascript.

I tried Like this

<ClientEvents OnBatchEditOpened="OnBatchEditOpened" />

//Enable/Disable Grid cell
function OnBatchEditOpened(sender, args)
{   
    if(EventID=="EDIT") 
        args.get_cell().getElementsByTagName("input")[0].disabled = false;
}

but the grid and cells are not enabling.

How to Enable ? Or what is wrong in this code.

Regards,
Rajendran
Maria Ilieva
Telerik team
 answered on 10 Feb 2015
10 answers
1.8K+ views
Hi,
I am trying to set the width of a GridTemplateColumn from a stylesheet rather than in the aspx page but it doesnt seem to work.  For instance the below code works to set the GridTemplateColumn width to 30 pixels.


<telerik:GridTemplateColumn AllowFiltering="false" UniqueName="DeleteRecord" HeaderStyle-Width="30px" >
    <ItemTemplate>
        <asp:ImageButton ID="btnDeleteRecord" runat="server" ImageUrl="../../Common/Images/Icons/small/delete.gif" CommandName="DeleteRecord" CssClass="CursorHand"/>
    </ItemTemplate>
</telerik:GridTemplateColumn>

However, The following code does not:
<telerik:GridTemplateColumn AllowFiltering="false" UniqueName="DeleteRecord" HeaderStyle-CssClass="commandHeader" >
    <ItemTemplate>
        <asp:ImageButton ID="btnDeleteRecord" runat="server" ImageUrl="../../Common/Images/Icons/small/delete.gif" CommandName="DeleteRecord" CssClass="CursorHand"/>
    </ItemTemplate>
</telerik:GridTemplateColumn>

.commandHeader
{
    width:30px;
}


Is there a way around this problem? Or am i doing something wrong?

Thanks,
Michael
Pavlina
Telerik team
 answered on 10 Feb 2015
5 answers
547 views
Hi
I have a radgrid in which , I want to set the back color of a cell in every row of  one column . I need to compare the value of the cell in this column in every row of the grid and if its not the same value as the previous row cell value , I had to set different color . For example the column name is datayear , and the first row of the grid has 2013 as the second row has 2012 and so on in that cell . some time the same cell value will be repeated . so I have to compare each row cell value and set the color of the cell how can I achieve this asp.net.vb
thanks for your help
Rajeswari raman
​
Eyup
Telerik team
 answered on 10 Feb 2015
1 answer
186 views
My grid has a template column that contains a radtextbox.  On postback, I want to obtain the value within each radtextbox but it is always returning blank values.  I have the radtextbox in the ItemTemplate, not the EditItemTemplate.  Do I need to do this from an EditItemTemplate and place every row in EditMode?  

Note that the function of the grid is a questionnaire so we want every textbox to be available when the page loads.  We don't want any edit/update links.  

<telerik:RadGrid ID="gvwTextQuestions" runat="server" Width="950px" AutoGenerateColumns="False" DataSourceID="sqlQuestions">
               <MasterTableView EditMode="InPlace" DataKeyNames="QuestionID" CommandItemDisplay="Top" DataSourceID="sqlQuestions">
                   <CommandItemTemplate>
                       <div style="padding-top: 10px; padding-bottom: 10px; padding-left: 10px;">
                           <asp:Label ID="lblHeader" runat="server" Text=""></asp:Label>
                       </div>
                   </CommandItemTemplate>
                   <CommandItemSettings ShowAddNewRecordButton="False" ShowRefreshButton="False"></CommandItemSettings>
                   <Columns>
                       <telerik:GridBoundColumn DataField="QuestionID" Visible="False" UniqueName="QuestionID" FilterControlAltText="Filter QuestionID column"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn FilterControlAltText="Filter QuestionNumber column" UniqueName="QuestionNumber" DataField="QuestionNumber">
                           <ItemStyle HorizontalAlign="Center" />
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Question" UniqueName="Question" FilterControlAltText="Filter Question column"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Required" FilterControlAltText="Filter Required column" UniqueName="Required" Visible="False">
                       </telerik:GridBoundColumn>
                       <telerik:GridTemplateColumn FilterControlAltText="Filter ResponseText column" UniqueName="ResponseText">
                           <ItemTemplate>
                               <telerik:RadTextBox ID="txtResponseText" Runat="server" Columns="90" Rows="6" TextMode="MultiLine" Width="700px">
                               </telerik:RadTextBox>
                           </ItemTemplate>
                           <ItemStyle HorizontalAlign="Left" />
                       </telerik:GridTemplateColumn>
                   </Columns>
               </MasterTableView>
           </telerik:RadGrid>
Eyup
Telerik team
 answered on 10 Feb 2015
27 answers
2.2K+ views
I'm working on creating an asp.net user control that contains a RadGrid.  Within the user control I want to define the columns in the RadGrid at runtime.  When the grid loads, if the page is not a postback, I generate and add the required columns to the grid.  So far this works as expected.  When the page displays the appropriate columns are visible.  However, when a postback occurs (paging, sorting, etc...) some of the column structure is lost.  For example, when I click on one of the column headers to sort the column, a postback occurs and when the page refreshes on the screen the column header text for every column is blank and the data is not sorted.  Another issue is that when I click the next page button, the postback occurs, the page changes but again the header text for every column is missing and the data in each cell shows "System.Data.DataRowView".  In some of my debugging I've found that when the page posts back on a page index change, each of the GridBoundColumn objects in the grid have lost their DataField property value and the HeaderText property value.  They do however keep their UniqueName property value.

Am I missing somthing to insure that these columns maintain their state upon postback?
Eyup
Telerik team
 answered on 10 Feb 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?