Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
138 views

My users need to copy and paste a link to their file that we would like to use fileexplorer to manage.

Is there an event where this could be shown perhaps outside of the control , or in the path bar?

 

Example:

Path bar currently shows user  "/MyFiles/"  when "My Picture.jpg" is selected

I would like to show  "https://www.foo.com/abx345/MyFiles/My%20Picture.jpg" somewhere on the page.  It doesn't matter if it is inside the control or outside.

 

Thanks.

 

Vessy
Telerik team
 answered on 07 Apr 2020
3 answers
232 views
Hi, I would like to include a GridButtonColumn in my grid which, when clicked, it would reset some fields of my database from code behind.  However, I would like to show the user a RadConfirm window such as the one that appears when you press the delete icon in the delete button column, that asks the user if he/she is sure that he wants to execute such reset.  If the user answers "no" or "cancel" then the code behind would not be executed.

Is there anyway I can do this or any tutorial or code library that I can use to accomplish this??

Thanks in advance,
Manuel
Dave
Top achievements
Rank 1
 answered on 07 Apr 2020
8 answers
603 views
I am using the IMage gallery successfully except for a few images which are higher than they are wide, and when rendered in the control, it rotates them sideways. I want to prevent this without modifying the image. How can I get the control to display the image
Peter Milchev
Telerik team
 answered on 07 Apr 2020
6 answers
1.9K+ views

I've been working with an application using a fairly old version of Telerik (2012.3.1205.40 , looks like) and I've been looking for a way to modify the style of the column headers in exported Excel files made from a RadGrid.  I've tried to attack this a number of ways, but the ExportCellFormatting event and related don't seem to cover the column headers, and attempting to manipulate the HeaderStyle of the RadGrid/the MasterTableView has also had no effect on how the exported column headers look.  I've had no problems styling the actual data fields, just the headers.  I'm sure I'm missing something very obvious to do this, but haven't found anything clear to point me at it in various searches online and looking through documentation/the API.

The function firing off the export is straightforward:

protected void lnkExportExcel_Click(object sender, EventArgs e)
{
    radgridResult.ExportSettings.ExportOnlyData = true;
    radgridResult.ExportSettings.OpenInNewWindow = true;
    radgridResult.ExportSettings.IgnorePaging = true;
...
    radgridResult.MasterTableView.ExportToExcel();
}

The omitted piece is just some wrangling of the exported file's name and shouldn't matter.

TIA!
Evan
Top achievements
Rank 1
 answered on 07 Apr 2020
3 answers
131 views
I’m loading stuff into the RadFileExplorer with both JavaScript and server-side code. My problem is sometime things are not visible until I resize my browsers window. So, some code that I want is fired upon the windows resize, I want to fire that code manually. So, my question is, what JavaScript code is being fired when I resize the window for the RadFileExplorer?
Vessy
Telerik team
 answered on 07 Apr 2020
2 answers
287 views

When doing a copy / paste of numeric values from excel to RadSpreadsheet initial zero values are lost. So, when I copy for example value 07657656 it gets pasted as 7657656.

Is there any workaround this behavior?

Giorgos
Top achievements
Rank 1
 answered on 03 Apr 2020
8 answers
148 views

In our application we use a RadEditor with

this.EditModes = EditModes.All

 

and

this.NewLineMode = EditorNewLineModes.P

 

so that the user can write text that is then translated into a paragraph html element. 

We also use this code for formatting options

this.StripFormattingOptions = EditorStripFormattingOptions.MSWordRemoveAll
                        | EditorStripFormattingOptions.ConvertWordLists
                        | EditorStripFormattingOptions.Span;

 

The Problem: For some reason our RadEditor is allowing the user to backspace so far that the <p> element for the NewLineMode actually gets deleted and removed, and the following text that is entered by the user is no longer translated into the paragraph html we need from the html mode. Does anyone know why this might be happening to the RadEditor? Perhaps we have some scripts/styles that are crossing the functionality but I have done a pretty thorough read through and figured it would be worth asking to see if anyone has an idea off the top of their head.

Any help is much appreciated and thank you.

 

Dave

Rumen
Telerik team
 answered on 03 Apr 2020
1 answer
231 views

Is there any way to get current rows  from RadGrid on Server side, because I want to call some method end set some of the fields only for currently showed rows. I'm using OnNeedDataSource and i have grouping and sorting in my RadGrid. 

For better understanding here is example:

I have 1000 elements in database and i want my method to apply only on items that i'm showing (10/20/50) one current page of paggination. 

<div class="demo-container no-bg">
                <telerik:RadGrid runat="server"
                    ID="OrdiniDashboard_Grid"
                    OnNeedDataSource="OnNeedDataSource_OrdiniDashboard"
                    RenderMode="Lightweight"
                    PageSize="10"
                    AllowSorting="True"
                    AllowMultiRowSelection="True"
                    AllowPaging="True"
                    ShowGroupPanel="True"
                    AutoGenerateColumns="False"
                    OnPreRender="GridOrdDashboard_PreRender"
                    OnItemCreated = "OnItemCreated">
                    <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="True" Position="Bottom"></PagerStyle>
                    <MasterTableView
                        Width="100%"
                        GroupLoadMode="Client"
                        ShowGroupFooter="true"
                        ClientDataKeyNames="IdOrder, IdCliente,TipologiaCliente,RagSoc,NomeU,CognomeU,Confirm,PriorityId,PriorityCompleteName,FlagPagamento,StatoPagamento, OrdineEsportato, OrdineEsportatoName, totaleImporto,totaleValue">
                        <GroupByExpressions>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField
                                        FieldAlias="DataScadenza"
                                        FieldName="DataScadenza"
                                        HeaderText="<%$ Resources: Doc_Labels, dataScadenza %>"
                                        FormatString="{0:dd/MM/yyyy}"
                                        HeaderValueSeparator="from date: "></telerik:GridGroupByField>
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField
                                        FieldName="DataScadenza"></telerik:GridGroupByField>
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                            <telerik:GridGroupByExpression>
                                <SelectFields>
                                    <telerik:GridGroupByField
                                        FieldAlias="StatoOrdineValue"
                                        FieldName="StatoOrdineValue"
                                        HeaderText="Stato"></telerik:GridGroupByField>
                                </SelectFields>
                                <GroupByFields>
                                    <telerik:GridGroupByField
                                        FieldName="StatoOrdineValue"></telerik:GridGroupByField>
                                </GroupByFields>
                            </telerik:GridGroupByExpression>
                        </GroupByExpressions>

                        <Columns>

                        <telerik:GridBoundColumn
                                AutoPostBackOnFilter="false"
                                DataField="IdOrder"
                                DataType="System.Int32"
                                UniqueName="IdOrder"
                                Display="false"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center">
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn
                                AutoPostBackOnFilter="false"
                                DataField="IdCliente"
                                DataType="System.Int32"
                                UniqueName="IdCliente"
                                Display="false"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center">
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn
                                AutoPostBackOnFilter="false"
                                SortExpression="NumeroOrdine"
                                Groupable="false"
                                HeaderText=" <%$ Resources: Doc_Labels, numero %>"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                DataField="NumeroOrdine"
                                Display="true"
                                Aggregate="Count"
                                FooterAggregateFormatString="Ordini totali: {0}"
                                UniqueName="NumeroOrdine">
                            </telerik:GridBoundColumn> 

                            <telerik:GridBoundColumn AutoPostBackOnFilter="false"
                                SortExpression="JobName"
                                Groupable="false"
                                DataField="JobName"
                                Display="true"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                HeaderText=" <%$ Resources: Doc_Labels, jobName %>">
                            </telerik:GridBoundColumn>

                            <telerik:GridTemplateColumn
                                AutoPostBackOnFilter="false"
                                SortExpression="Cliente"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                UniqueName="Cliente"
                                DataField="Cliente"
                                GroupByExpression="Cliente Group By Cliente"
                                Groupable="true"
                                HeaderText=" <%$ Resources: Doc_Labels, cliente %>">
                                <ItemTemplate>
                                    <a href="../../../Views/settings/Clienti/Gestione_Cliente.aspx?idCliente="></a>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

                            <telerik:GridBoundColumn
                                UniqueName="DataOrdine"
                                AutoPostBackOnFilter="false"
                                SortExpression="DataOrdine"
                                HeaderText=" <%$ Resources: Doc_Labels, dataEmissione %>"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                HeaderButtonType="TextButton"
                                DataField="DataOrdine"
                                GroupByExpression="DataOrdine Group By DataOrdine"
                                Groupable="true"
                                DataFormatString="{0:dd/MM/yyyy}"
                                Display="true">
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn
                                AutoPostBackOnFilter="false"
                                SortExpression="DataScadenza"
                                HeaderText=" <%$ Resources: Doc_Labels, dataScadenza %>"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                HeaderButtonType="TextButton"
                                DataField="DataScadenza"
                                DataFormatString="{0:dd/MM/yyyy}"
                                Display="true">
                            </telerik:GridBoundColumn>

                            <telerik:GridTemplateColumn
                                AutoPostBackOnFilter="false"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                UniqueName="Confirm"
                                SortExpression="StatoOrdineValue"
                                HeaderButtonType="TextButton"
                                GroupByExpression="StatoOrdineValue Group By StatoOrdineValue"
                                HeaderText=" <%$ Resources: Doc_Labels, stato %>"
                                DataField="StatoOrdineValue"
                                DataType="System.String">
                                <ItemTemplate>
                                    <div></div>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

                            <telerik:GridTemplateColumn
                                UniqueName="Priority"
                                HeaderText="Priority"
                                SortExpression="PriorityCompleteName"
                                DataType="System.String"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                DataField="PriorityCompleteName"
                                GroupByExpression="PriorityCompleteName Group By PriorityCompleteName">
                                <ItemTemplate>
                                    <span class="label label-sm circle popovers infoPopOver"
                                        style="color: white; background-color: rgb(132, 151, 152);"
                                        data-placement="top"
                                        data-trigger="hover"></span>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

                            <telerik:GridBoundColumn
                                UniqueName="StatoDocumentoFattura"
                                DataField="StatoDocumentoFattura"
                                SortExpression="StatoDocumentoFattura"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                HeaderText=" <%$ Resources: Doc_Labels, gestioneStatoDocumento %>"
                                GroupByExpression="StatoDocumentoFattura Group By StatoDocumentoFattura">
                            </telerik:GridBoundColumn>

                            <telerik:GridTemplateColumn
                                UniqueName="StatoPagamento"
                                SortExpression="StatoPagamento"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                HeaderText="<%$ Resources:Doc_Labels, statoPagamento %>"
                                HeaderStyle-HorizontalAlign="Center"
                                GroupByExpression="StatoPagamento Group By StatoPagamento"
                                DataField="StatoPagamento">
                                <ItemTemplate>
                                    <i class="fa fa-euro popovers"
                                        data-placement="top"
                                        data-trigger="hover"
                                        style="width: 100%"></i>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

                            <telerik:GridBoundColumn
                                UniqueName="TipoPagamento"
                                DataField="TipoPagamento"
                                SortExpression="TipoPagamento"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                HeaderText=" <%$ Resources: Doc_Labels, tipoPagamento %>"
                                GroupByExpression="TipoPagamento Group By TipoPagamento">
                            </telerik:GridBoundColumn>

                            <telerik:GridTemplateColumn
                                UniqueName="OrdineEsportato"
                                DataField="OrdineEsportato"
                                SortExpression="OrdineEsportato"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                HeaderText=" <%$ Resources: Doc_Labels, esportato %>"
                                GroupByExpression="OrdineEsportatoName Group By OrdineEsportatoName">
                                <ItemTemplate>
                                    <i class=" fa fa-check-circle  popovers infoPopOver"
                                        data-placement="top"
                                        data-trigger="hover"
                                        style="width: 2%"></i>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

                            <telerik:GridBoundColumn
                                UniqueName="DataEsportazioneOrdine"
                                DataField="DataEsportazioneOrdine"
                                SortExpression="DataEsportazioneOrdine"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                HeaderText="Data Esportazione Ordine"
                                DataFormatString="{0:dd/MM/yyyy}"
                                GroupByExpression="DataEsportazioneOrdine Group By DataEsportazioneOrdine">
                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn
                                UniqueName="Autore"
                                DataField="Autore"
                                SortExpression="Autore"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                HeaderText=" <%$ Resources: Doc_Labels, autore %>"
                                GroupByExpression="Autore Group By Autore">
                            </telerik:GridBoundColumn>

                            <telerik:GridTemplateColumn
                                AutoPostBackOnFilter="false"
                                DataType="System.Decimal"
                                UniqueName="totaleImporto"
                                Display="true"
                                Aggregate="Sum"
                                FooterAggregateFormatString="Imponibile: {0:C}"
                                HeaderText="<%$ Resources: Doc_Labels, imponibile %>"
                                DataField="totaleImporto"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                Groupable="false">
                            </telerik:GridTemplateColumn>

                            <telerik:GridTemplateColumn
                                AutoPostBackOnFilter="false"
                                DataType="System.Decimal"
                                UniqueName="totaleValue"
                                Display="true"
                                Aggregate="Sum"
                                FooterAggregateFormatString="Totali: {0:C}"
                                HeaderText="<%$ Resources: Doc_Labels, totali %>"
                                DataField="totaleValue"
                                HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-VerticalAlign="Middle"
                                ItemStyle-HorizontalAlign="Center"
                                Groupable="false">
                                <ItemTemplate>
                                    <div>
                                    </div>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings
                        ReorderColumnsOnClient="True"
                        AllowDragToGroup="True"
                        AllowColumnsReorder="True">
                        <ClientEvents
                            OnGroupExpanded="OrdDashboard_OnGroupExpandedCollapse"
                            OnGroupCollapsed="OrdDashboard_OnGroupExpandedCollapse"
                            OnRowCreated="OnRowDataBoundOrdini"
                            OnCommand="OnCommadFunction"></ClientEvents>
                        <Selecting AllowRowSelect="True" />
                        <Resizing
                            AllowRowResize="False"
                            AllowColumnResize="False"
                            EnableRealTimeResize="False"
                            ResizeGridOnColumnResize="False"></Resizing>
                    </ClientSettings>
                    <GroupingSettings ShowUnGroupButton="true" RetainGroupFootersVisibility="false" />
                </telerik:RadGrid>
            </div>

 

        public ResultData GetOrdiniListForDashboard(string filterExpression)
        {
            var result = new ResultData();
            MyRigaPrev rigaPrev = new MyRigaPrev();
            DocNewReport_footer_ord_prev_Result my;
            DALDocumentale db = new DALDocumentale(0);          // Database
            try
            {
                //IQueryable<MyOrdDashboard> list = null;
                var list = (from ord in db.Ordini
                            where (ord.TipologiaDocumento == null || ord.TipologiaDocumento == "order" && ord.IdOrder > 0)
                            join prioritySetts in db.Priority on ord.PriorityId equals prioritySetts.Id
                            into priority
                            from p in priority.DefaultIfEmpty()
                            select new MyOrdDashboard
                            {
                                IdOrder = ord.IdOrder ?? 0,
                                IdCliente = ord.IdCliente ?? 0,
                                TipologiaCliente = ord.TipologiaCliente ?? 0,
                                RagSoc = ord.RagSoc ?? "",
                                NomeU = ord.NomeU ?? "",
                                CognomeU = ord.CognomeU ?? "",
                                PriorityId = ord.PriorityId ?? 0,
                                NumeroOrdine = ord.NumeroOrdine ?? "",
                                JobName = ord.JobName ?? "",
                                DataOrdine = ord.DataOrdine,
                                DataScadenza = ord.DataScadenza,
                                Confirm = ord.Confirm ?? 0,
                                //PriorityName = p != null && !string.IsNullOrEmpty(p.Name) ? p.Name[0] : 'N',
                                PriorityCompleteName = p.Name ?? "Nessuna",
                                //StatoOrdine = ord.Confirm ?? 0,                                                                 // State of ordine:
                                StatoOrdineValue = ord.Confirm == 1 ? "In Coda" :                                                                    // 1 -- InCoda
                                                  (ord.Confirm == 2 ? "In Lavorazione" :                                                             // 2 -- InLavorazione
                                                  (ord.Confirm == 3 ? "Evaso" : "Annullato")),                                                       // 3 -- Evaso
                                                                                                                                                     // 4 -- Annullato
                                Cliente = ord.TipologiaCliente == 5 || ord.TipologiaCliente == 6 ? ord.RagSoc : ord.NomeU + " " + ord.CognomeU,      // Type of client: 
                                                                                                                                                     // private: NomeU + CognomeU
                                                                                                                                                     // company: RagSoc
                                StatoDocumentoFattura = ord.StatoDocumentoFattura == "fatturatoParziale" ? Resources.Doc_Labels.fatturatoParziale :
                                                        (ord.StatoDocumentoFattura == "fatturato" ? Resources.Doc_Labels.fatturato :
                                                        (ord.StatoDocumentoFattura == "nonFatturabile" ? Resources.Doc_Labels.nonFatturabile :
                                                        (ord.StatoDocumentoFattura == "daFatturare" ? Resources.Doc_Labels.daFatturare :
                                                        (ord.StatoDocumentoFattura == "" || ord.StatoDocumentoFattura == null ? Resources.Doc_Labels.daFatturare : "")))),


                                StatoGatewayTransazione = ord.StatoGatewayTransazione ?? 0,
                                StatoPagamento = ord.StatoGatewayTransazione == 0 ? Resources.Doc_Labels.nonEseguito : Resources.Doc_Labels.eseguito,
                                FlagPagamento = ord.StatoGatewayTransazione ?? 0,
                                IdGateway = ord.IdGateway ?? 0,
                                TipoPagamento = ord.TipologiaPagamento ?? Resources.Doc_Labels.nessuno,
                                OrdineEsportato = ord.OrdineEsportato ?? false,
                                OrdineEsportatoName = ord.OrdineEsportato != null ? Resources.Doc_Labels.esportato : Resources.Doc_Labels.nonesportato,
                                DataEsportazioneOrdine = ord.DataEsportazioneOrdine,
                                Autore = ord.EmessoDa,
                                //totaleImporto = Convert.ToDecimal((rigaPrev.getTotali(Convert.ToInt32(ord.IdOrder), "ordine", "").Imponibile)),
                                //totaleValue = Convert.ToDecimal((rigaPrev.getTotali(Convert.ToInt32(ord.IdOrder), "ordine", "").Totale)),
                            });

                //IQueryable<MyOrdDashboard> ordini = null;

                //replace DateTime.Parse
                int countDate = Regex.Matches(filterExpression, "DateTime.Parse").Count;
                var listaDate = new object[countDate];

                if (countDate > 0)
                {
                    //for the DateTime expression to work we need to handle them as
                    filterExpression = filterExpression.Replace("DateTime.Parse", string.Empty);

                    for (int i = 0; i < countDate; i++)
                    {
                        //Create a new Regular expression that covers all the date types!
                        System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(
                            "\\(\\\"" +
                                "\\d{1,2}[/-]\\d{1,2}[/-]\\d{2,4}" + //mm/dd/yyyy
                                "(?:" +
                                    "\\s*\\d{1,2}:\\d{1,2}:\\d{1,2}" + // hh:mm:ss
                                    "(?:" +
                                        "\\s*(?:AM|PM){0,2}" + // AM
                                    "){0,1}" +
                                "){0,1}" +
                            "\\\"\\)",
                            RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled
                            );

                        string date = regex.Match(filterExpression).ToString().Replace("\"", string.Empty).Replace("(", string.Empty).Replace(")", string.Empty);
                        DateTime d = Convert.ToDateTime(date);
                        filterExpression = regex.Replace(filterExpression, "@" + i.ToString(), 1);

                        listaDate[i] = d;
                    }
                }


                if (!String.IsNullOrEmpty(filterExpression))
                {
                    if (countDate > 0)
                    {
                        list = list.AsQueryable().Where(filterExpression, listaDate);
                    }
                    else
                    {
                        list = list.AsQueryable().Where(filterExpression);
                    }
                }



                result.Data = list.ToList();
                result.Count = list.Count();

            }
            catch (Exception e)
            {
                throw e;
            }

            return result;
        }



protected void OnNeedDataSource_OrdiniDashboard(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {

            DocNewGroupingTemplate docNewGroupingTemplate = new DocNewGroupingTemplate();
            docNewGroupingTemplate.GroupingTemplateDetailsList = new List<DocNewGroupingTemplateDetails>();
            ControllerGroupingTemplate ctrlGroupTemp = new ControllerGroupingTemplate();
            string sortExpression = String.Empty;

            Helper helper = new Helper();
            if (!helper.isValid(HttpContext.Current.Session))
            {
                return;
            }
            try
            {
                int groupingId = 0;
                if (HttpContext.Current.Session["GroupingTemplateComboBox"] != null)
                {
                    groupingId = Int32.Parse(HttpContext.Current.Session["GroupingTemplateComboBox"].ToString());
                    if(groupingId == -1)
                    {
                        docNewGroupingTemplate.GroupingName = "";
                        docNewGroupingTemplate.GroupingTemplateDetailsList = new List<DocNewGroupingTemplateDetails>();
                        docNewGroupingTemplate.GroupingTemplateDetailsList.Add(new DocNewGroupingTemplateDetails() { ColumnName = "DataScadenza", SortType = "Descending", GroupingSenderId = "dataScadenza", Type= "Data scadenza" });
                        docNewGroupingTemplate.GroupingTemplateDetailsList.Add(new DocNewGroupingTemplateDetails() { ColumnName = "StatoOrdineValue", SortType = "Descending", GroupingSenderId = "statoOrdineValue", Type = "Stato" });

                    }
                    else
                    {
                        docNewGroupingTemplate.GroupingName = ctrlGroupTemp.GetGroupingTemplateName(groupingId);
                        docNewGroupingTemplate.GroupingTemplateDetailsList = ctrlGroupTemp.GetGroupingTemplateDetailsList(groupingId);
                    }
                }

                string filterPeriod = HttpContext.Current.Session["FilterPeriod"].ToString();
                string filterExpression = String.Empty;

                if (filterPeriod != "Nessuno")
                {
                    string ricercaPerPeriodo = HttpContext.Current.Session["RicercaPerPeriodo"].ToString();
                    string fromDate = HttpContext.Current.Session["From"].ToString();
                    string toDate = HttpContext.Current.Session["To"].ToString();
                    DateTime currentDate = DateTime.Now;

                    if (ricercaPerPeriodo != "Personalizzato")
                    {
                        HttpContext.Current.Session.Add("From", String.Empty);
                        HttpContext.Current.Session.Add("To", String.Empty);
                        fromDate = String.Empty;
                        toDate = String.Empty;
                    }


                    if (!String.IsNullOrEmpty(filterPeriod) && !String.IsNullOrEmpty(ricercaPerPeriodo) && filterPeriod != "Nessuno")
                    {

                        switch (ricercaPerPeriodo)
                        {
                            case "Oggi":
                                filterExpression = $"({filterPeriod} >= DateTime.Parse(\"{currentDate.Date}\")) AND ({filterPeriod} <= DateTime.Parse(\"{currentDate.Date.AddHours(23).AddMinutes(59).AddSeconds(59)}\"))";
                                break;
                            case "Ieri":
                                currentDate = DateTime.Now.AddDays(-1);
                                filterExpression = $"({filterPeriod} >= DateTime.Parse(\"{currentDate.Date}\")) AND ({filterPeriod} <= DateTime.Parse(\"{currentDate.Date.AddHours(23).AddMinutes(59).AddSeconds(59)}\"))";
                                break;

                            case "QuestaSettimana":
                                DateTime monday = DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek + 1);
                                filterExpression = $"({filterPeriod} >= DateTime.Parse(\"{monday.Date}\")) AND ({filterPeriod} <= DateTime.Parse(\"{currentDate.Date.AddHours(23).AddMinutes(59).AddSeconds(59)}\"))";
                                break;

                            case "QuestoMese":
                                DateTime month = DateTime.Today.AddDays(-(int)DateTime.Today.Day + 1);
                                filterExpression = $"({filterPeriod} >= DateTime.Parse(\"{month.Date}\")) AND ({filterPeriod} <= DateTime.Parse(\"{currentDate.Date.AddHours(23).AddMinutes(59).AddSeconds(59)}\"))";
                                break;

                            case "SettimanaScorsa":
                                DateTime mondayOfLastWeek = currentDate.AddDays(-(int)currentDate.DayOfWeek - 6);
                                DateTime sundayOfLastWeek = currentDate.AddDays(-(int)currentDate.DayOfWeek);
                                filterExpression = $"({filterPeriod} >= DateTime.Parse(\"{mondayOfLastWeek.Date}\")) AND ({filterPeriod} <= DateTime.Parse(\"{sundayOfLastWeek.Date.AddHours(23).AddMinutes(59).AddSeconds(59)}\"))";
                                break;
                            case "MeseScorso":
                                DateTime lastMonth = new DateTime(currentDate.Year, currentDate.Month, 1);
                                DateTime first = lastMonth.AddMonths(-1);
                                DateTime last = lastMonth.AddDays(-1);
                                filterExpression = $"({filterPeriod} >= DateTime.Parse(\"{first.Date}\")) AND ({filterPeriod} <= DateTime.Parse(\"{last.Date.AddHours(23).AddMinutes(59).AddSeconds(59)}\"))";
                                break;
                            case "Personalizzato":
                                if (!String.IsNullOrEmpty(fromDate) && !String.IsNullOrEmpty(toDate))
                                    filterExpression = $"({filterPeriod} >= DateTime.Parse(\"{fromDate}\")) AND ({filterPeriod} <= DateTime.Parse(\"{toDate}\"))";
                                break;

                            case "Nessuno":
                                filterExpression = String.Empty;
                                break;

                            default:
                                filterExpression = String.Empty;
                                break;
                        }
                    }
                }


                ResultData result = GetOrdiniListForDashboard(filterExpression);

                if (groupingId != 0)
                {

                    OrdiniDashboard_Grid.MasterTableView.GroupByExpressions.Clear();
                    foreach (var item in docNewGroupingTemplate.GroupingTemplateDetailsList)
                    {
                        GridGroupByField field = new GridGroupByField();
                        field.FieldName = item.ColumnName;
                        field.HeaderText = item.Type;
                        if (item.SortType == "Ascending")
                            field.SortOrder = GridSortOrder.Ascending;
                        else if (item.SortType == "Descending")
                            field.SortOrder = GridSortOrder.Descending;
                        else
                            field.SortOrder = GridSortOrder.None;
                        GridGroupByField selectfield = new GridGroupByField();
                        selectfield.FieldName = item.ColumnName;
                        selectfield.HeaderText = item.Type;
                        selectfield.FormatString = "{0:dd/MM/yyyy}";
                        GridGroupByExpression ex = new GridGroupByExpression();
                        ex.GroupByFields.Add(field);
                        ex.SelectFields.Add(selectfield);
                        OrdiniDashboard_Grid.MasterTableView.GroupByExpressions.Add(ex);
                        
                    }                  

                    HttpContext.Current.Session.Add("GroupingTemplateComboBox", 0);
                }

                if (result.Count > 0)
                {
                    OrdiniDashboard_Grid.DataSource = result.Data;

                    
                }
                else
                {
                    OrdiniDashboard_Grid.DataSource = new List<MyOrdDashboard>();
                }

            }
            catch (Exception exe)
            {
                throw exe;
            }
        }
Doncho
Telerik team
 answered on 03 Apr 2020
3 answers
257 views

Hi,

I've been struggling to make the breadcrumb work for days.  I hope you can assist me here.

At first I thought it's because I'm using site.master and the full postback is giving me problem, so I took the code from https://demos.telerik.com/aspnet-ajax/menu/examples/programming/showpath/defaultcs.aspx and made a small project to follow along.  However, I'm still running into the same problem with RadMenu1.FindItemByUrl always returning null.

RadMenuItem currentItem = RadMenu1.FindItemByUrl(Request.Url.PathAndQuery);

 

 

Would you please let me know what am I missing in my setup?

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
 
<<%@ Register  tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link rel="stylesheet" type="text/css" href="styles.css" />
</head>
  
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
  
    <div class="demo-container size-medium no-bg">
        <div class="demo-content">
            <telerik:RadMenu RenderMode="Lightweight" ID="RadMenu1" runat="server" EnableRoundedCorners="true"
                EnableShadows="true" EnableTextHTMLEncoding="true" Skin="Silk">
                <Items>
                    <telerik:RadMenuItem Text="Products" NavigateUrl="DefaultCS.aspx?Page=Products">
                        <Items>
                            <telerik:RadMenuItem Text="UI for ASP.NET AJAX" NavigateUrl="DefaultCS.aspx?Page=ASP.NET AJAX Controls" />
                            <telerik:RadMenuItem Text="UI for WinForms" NavigateUrl="DefaultCS.aspx?Page=WinForms Controls" />
                            <telerik:RadMenuItem Text="UI for WPF" NavigateUrl="DefaultCS.aspx?Page=WPF Controls" />
                            <telerik:RadMenuItem Text="UI for Silverlight" NavigateUrl="DefaultCS.aspx?Page=Silverlight Controls" />
                            <telerik:RadMenuItem Text="Reporting" NavigateUrl="DefaultCS.aspx?Page=Telerik Reporting" />
                            <telerik:RadMenuItem Text="Data Access" NavigateUrl="DefaultCS.aspx?Page=Telerik OpenAccess ORM" />
                            <telerik:RadMenuItem Text="Sitefinity ASP.NET CMS" NavigateUrl="DefaultCS.aspx?Page=Sitefinity ASP.NET CMS" />
                            <telerik:RadMenuItem Text="Test Studio" NavigateUrl="DefaultCS.aspx?Page=WebUI Test Studio" />
                        </Items>
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="Consulting" NavigateUrl="DefaultCS.aspx?Page=Consulting">
                        <Items>
                            <telerik:RadMenuItem Text="On-site Training" NavigateUrl="DefaultCS.aspx?Page=On-site Training" />
                            <telerik:RadMenuItem Text="Consulting Express" NavigateUrl="DefaultCS.aspx?Page=Consulting Express" />
                            <telerik:RadMenuItem Text="Open Classes Training" NavigateUrl="DefaultCS.aspx?Page=Open Classes Training" />
                            <telerik:RadMenuItem Text="Online Training" NavigateUrl="DefaultCS.aspx?Page=Online Training" />
                            <telerik:RadMenuItem Text="Project Consulting" NavigateUrl="DefaultCS.aspx?Page=Project Consulting" />
                            <telerik:RadMenuItem Text="Telerik Webinars" NavigateUrl="DefaultCS.aspx?Page=Telerik Webinars" />
                        </Items>
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="Purchase" NavigateUrl="DefaultCS.aspx?Page=Purchase">
                        <Items>
                            <telerik:RadMenuItem Text="Buy Now" NavigateUrl="DefaultCS.aspx?Page=Buy Now" />
                            <telerik:RadMenuItem Text="Renewals & Upgrades" NavigateUrl="DefaultCS.aspx?Page=Renewals & Upgrades" />
                            <telerik:RadMenuItem Text="License Agreement" NavigateUrl="DefaultCS.aspx?Page=License Agreement" />
                            <telerik:RadMenuItem Text="FAQ" NavigateUrl="DefaultCS.aspx?Page=FAQ" />
                            <telerik:RadMenuItem Text="Purchase Orders" NavigateUrl="DefaultCS.aspx?Page=Purchase Orders" />
                            <telerik:RadMenuItem Text="Contact Sales" NavigateUrl="DefaultCS.aspx?Page=Contact Sales" />
                        </Items>
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="Support" NavigateUrl="DefaultCS.aspx?Page=Support">
                        <Items>
                            <telerik:RadMenuItem Text="Support by Product" NavigateUrl="DefaultCS.aspx?Page=Support by Product" />
                            <telerik:RadMenuItem Text="Documentation" NavigateUrl="/DefaultCS.aspx?Page=Documentation" />
                            <telerik:RadMenuItem Text="Demos" NavigateUrl="DefaultCS.aspx?Page=Demos" />
                            <telerik:RadMenuItem Text="Knowledge Base" NavigateUrl="DefaultCS.aspx?Page=Knowledge Base" />
                            <telerik:RadMenuItem Text="Telerik Trainer" NavigateUrl="DefaultCS.aspx?Page=Telerik Trainer" />
                            <telerik:RadMenuItem Text="Videos" NavigateUrl="DefaultCS.aspx?Page=Videos" />
                            <telerik:RadMenuItem Text="Skins" NavigateUrl="DefaultCS.aspx?Page=Skins" />
                        </Items>
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="Community" NavigateUrl="DefaultCS.aspx?Page=Community">
                        <Items>
                            <telerik:RadMenuItem Text="Forums" NavigateUrl="DefaultCS.aspx?Page=Forums" />
                            <telerik:RadMenuItem Text="Blogs" NavigateUrl="DefaultCS.aspx?Page=Blogs" />
                            <telerik:RadMenuItem Text="Events" NavigateUrl="DefaultCS.aspx?Page=Events" />
                            <telerik:RadMenuItem Text="Code Library" NavigateUrl="DefaultCS.aspx?Page=Code Library" />
                            <telerik:RadMenuItem Text="Learning Resources" NavigateUrl="DefaultCS.aspx?Page=Learning Resources" />
                            <telerik:RadMenuItem Text="Announcements" NavigateUrl="DefaultCS.aspx?Page=Announcements" />
                            <telerik:RadMenuItem Text="Free Products" NavigateUrl="DefaultCS.aspx?Page=Free Products" />
                        </Items>
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Text="Company" NavigateUrl="DefaultCS.aspx?Page=Company">
                        <Items>
                            <telerik:RadMenuItem Text="About Telerik" NavigateUrl="DefaultCS.aspx?Page=About Telerik" />
                            <telerik:RadMenuItem Text="Press Center" NavigateUrl="DefaultCS.aspx?Page=Press Center" />
                            <telerik:RadMenuItem Text="Careers" NavigateUrl="DefaultCS.aspx?Page=Careers" />
                            <telerik:RadMenuItem Text="Contact Us" NavigateUrl="DefaultCS.aspx?Page=Contact Us" />
                        </Items>
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadMenu>
  
            <div class="breadcrumb">
                <telerik:RadSiteMap ID="BreadCrumbSiteMap" runat="server" DataTextField="Text" DataNavigateUrlField="NavigateUrl" Skin="Silk">
                    <DefaultLevelSettings ListLayout-RepeatDirection="Horizontal" SeparatorText="/" Layout="Flow" />
                </telerik:RadSiteMap>
                <h3>
                    <asp:Literal runat="server" ID="PageTitleLiteral" /></h3>
            </div>
        </div>
  
    </div>
  
    </form>
</body>
</html>

 

Code Behind:

using System;
using System.Collections.Generic;
using Telerik.Web.UI;
 
public partial class _Default : System.Web.UI.Page
{
    //If RadMenu is data bound, please use its DataBound event instead of PageLoad.
    protected void Page_Load(object sender, EventArgs e)
    {
        RadMenuItem currentItem = RadMenu1.FindItemByUrl(Request.Url.PathAndQuery);
        if (currentItem != null)
        {
            //Select the current item and his parents
            currentItem.HighlightPath();
            //Update the title of the
            PageTitleLiteral.Text = currentItem.Text;
            //Populate the breadcrumb
            DataBindBreadCrumbSiteMap(currentItem);
        }
        else
            RadMenu1.Items[0].HighlightPath();
 
    }
 
    private void DataBindBreadCrumbSiteMap(RadMenuItem currentItem)
    {
        List<RadMenuItem> breadCrumbPath = new List<RadMenuItem>();
        while (currentItem != null)
        {
            breadCrumbPath.Insert(0, currentItem);
            currentItem = currentItem.Owner as RadMenuItem;
        }
        BreadCrumbSiteMap.DataSource = breadCrumbPath;
        BreadCrumbSiteMap.DataBind();
    }
 
}

 

Thank you,

Helen

Doncho
Telerik team
 answered on 02 Apr 2020
1 answer
97 views

same as title, any have solution..?

 

 

Thanks

Vessy
Telerik team
 answered on 02 Apr 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
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
Bronze
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?