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

Hi

Please help me out!

I have recently purchased a licence for the Q2 2016 devcraft tools and I am working on a website update...

I have a database in which numeric values have been recorded historically in an nvarchar column. I can't readily change the column type as it is in production and has several years of data in it.

However I would now like to use the aggregate function to put sum totals in a footer.  How can I achieve this from where we are now - i.e. with a non-numeric data column? Obviously I get an error just adding aggregate="Sum" ( 'Sum is not supported for type system.object').

I tried cheating by just changing the column from gridbound to gridnumeric but it is not so easily fooled!

Can you suggest what is the best way to get from the nvarchar database column I have now,  to getting an aggregate sum in the footer?

Thanks

Clive

Using Q2 2016 controls in VS 2015

 

Viktor Tachev
Telerik team
 answered on 31 May 2016
1 answer
117 views

I have a grid with two datetime column.

 

When i export this  to Excel the time part of the date is not getting exported. only the date exported.

Pavlina
Telerik team
 answered on 31 May 2016
5 answers
443 views

Hi,

How do I get RadImageGallery to restart the slideshow again, once it has finishes cycling through the images?

Thanks.

 

An

Viktor Tachev
Telerik team
 answered on 31 May 2016
1 answer
94 views

Hi, I used some code I found here to create a dependent grid.  When the user clicks on a row, it opens two dependent grids that filter based on the row he/she clicked on.  I am experiencing an error when I submit the form:

Exception of type 'System.Web.HttpUnhandledException' was thrown.
A control with ID 'ctl00$ctl04$fvlc$Form1$Grid1' could not be found for the trigger in UpdatePanel 'ctl00$ctl04$fvlc$Form1$Grid1Panel'.

 

As far as I can tell the Grid1 was defined in the form.

 

 <sq:AjaxManager ID="AjaxManager1" runat="server">
      <AjaxSettings>
            <sq:AjaxSetting AjaxControlID="Grid1">
                <UpdatedControls>
                    <sq:AjaxUpdatedControl ControlID="Grid1"></sq:AjaxUpdatedControl>
                    <sq:AjaxUpdatedControl ControlID="Grid2" LoadingPanelID="AjaxLoadingPanel1"></sq:AjaxUpdatedControl>
                    <sq:AjaxUpdatedControl ControlID="Grid3" LoadingPanelID="AjaxLoadingPanel1"></sq:AjaxUpdatedControl>
                </UpdatedControls>
                </sq:AjaxSetting>
            <sq:AjaxSetting AjaxControlID="Grid2">
              <UpdatedControls>
                    <sq:AjaxUpdatedControl ControlID="Grid2"></sq:AjaxUpdatedControl>
                    <sq:AjaxUpdatedControl ControlID="Grid3" LoadingPanelID="AjaxLoadingPanel1"></sq:AjaxUpdatedControl>
                </UpdatedControls>
            </sq:AjaxSetting>
         <sq:AjaxSetting AjaxControlID="Grid3">
                <UpdatedControls>
                    <sq:AjaxUpdatedControl ControlID="Grid3"></sq:AjaxUpdatedControl>
                </UpdatedControls>
            </sq:AjaxSetting>
        </AjaxSettings>
    </sq:AjaxManager>
    <sq:AjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server" Skin="Default"></sq:AjaxLoadingPanel>

 

Thanks for the help.

Viktor Tachev
Telerik team
 answered on 31 May 2016
1 answer
258 views
Telerik controls not responding after deploying in IIS. Telerik combobox and rad grid checkbox not getting loaded after deployed into IIS. Please respond.
Veselin Tsvetanov
Telerik team
 answered on 31 May 2016
1 answer
192 views

I am using Excel-Format="Biff" for my excel exports.

If there are no records in the grid, I get an index out of range error on clicking the export button. All other formats work fine. They just output an empty file but does not error out. I am unable to figure out why I get an index out of range error on the "biff" format export. Attached is the error details.

 

I also tried the code with advanced databinding using NeedDatasource event but I see the same behavior.

 

 

<telerik:RadGrid ID="rgParticipantBalances" runat="server" DataSourceID="_dataSrcBalances" OnPreRender="rgParticipantBalances_PreRender"
                OnItemCommand="rgParticipantBalances_ItemCommand" OnItemDataBound="rgParticipantBalances_ItemDataBound"
                OnItemCreated="rgParticipantBalances_ItemCreated" AllowFilteringByColumn="true"  >
                <FilterItemStyle HorizontalAlign="Left" />
                <MasterTableView TableLayout="Fixed" HierarchyDefaultExpanded="false" CommandItemDisplay="Top"
                    DataKeyNames="" EnableNoRecordsTemplate="true">
                    <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" ShowExportToExcelButton="true"
                        ExportToExcelText="" ExportToCsvText="" ExportToPdfText="" ExportToWordText=""
                        ShowExportToPdfButton="true" ShowExportToWordButton="true" ShowExportToCsvButton="true" />
                    <NoRecordsTemplate>
                        <div style="color: Red; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold">
                            <br />
                            Please select a plan to show activity for the specific plan.
                        </div>
                    </NoRecordsTemplate>
                    <Columns>
                        <telerik:GridTemplateColumn UniqueName="Participant" HeaderText="Participant" SortExpression="FullName"
                            HeaderStyle-HorizontalAlign="Left" CurrentFilterFunction="Contains" ShowFilterIcon="false"  DataField="FullName"
                            ItemStyle-HorizontalAlign="Left" FooterStyle-HorizontalAlign="Left" AutoPostBackOnFilter="true"
                            HeaderStyle-Width="16%" FilterControlWidth="130px" FilterControlToolTip="Input a name or part of name to search">
                            <ItemTemplate>
                                <%# Eval("FullName")%>
                            </ItemTemplate>
                            <FooterTemplate>
                                <asp:Label ID="lblGrandTotal" runat="server" Text="Grand Total" Font-Bold="true"></asp:Label>
                            </FooterTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
                <ExportSettings ExportOnlyData="true" IgnorePaging="true" FileName="Activity" OpenInNewWindow="true" HideStructureColumns="true"
                    SuppressColumnDataFormatStrings="false">
                    <Pdf PaperSize="A4" PageLeftMargin="5px" PageRightMargin="5px" PageWidth="297mm"
                        PageHeight="210mm" />
                    <Excel  Format="Biff"   />
                </ExportSettings>
            </telerik:RadGrid>

Maria Ilieva
Telerik team
 answered on 31 May 2016
4 answers
179 views

Hi,

I'm using OrgChart in one project to display some hierarchies. To adapt the look of it to my project design i'm using the code posted below.

Now, locally it works fine on all browsers I test it (chrome, IE 11, Firefox). If I publish it on the server (IIS 8.5 .NET 4.5) the look on IE change badly.(on other browsers looks fine)

Attached , the images with differences.

Remarks:

  • I force latest compatibility in header: <meta http-equiv="X-UA-Compatible" content="IE=edge"> so it is not a compatibility issue
  • AppPool is set to "Integrated" .NET CLR 4.0 no other special configurations
  • I use the latest update of telerik toolkit.
  • I had a similar  problem with RadTreeView, on IE11 the "plus/minus" default images were not displayed. that one i fix it with custom images from css but in this case will be a bit harder. 
  • RadOrg layout is fine using standard "look and feel"

Thank you, 

Ionel

 

 

html .RadOrgChart_Default .rocItemContent,
       html .RadOrgChart_Default .rocItemTemplate {
           /*background-color: rgba(255,255,255,0.2);*/
           background-image: none;
           /*color: white;*/
           border:none;
           background:none;
           width:auto;
           min-width:300px;
           height:auto;
 
}
<telerik:RadOrgChart RenderMode="Lightweight" ID="RadOrgChartHorizontal" runat="server"
                   DataSourceID="SQLDataSourceHorizontalHierarchy"
                       DataFieldID="Contract_Key"
                       DataFieldParentID="Contract_Parent_Key"
                       DataTextField="Name"  EnableCollapsing="True" EnableGroupCollapsing="True"  Orientation="Horizontal">
                       <ItemTemplate >
                           <section class="panel panel-featured panel-featured-tertiary">
                               <div class="panel-body">
                                   <div class="widget-summary">
 
                                       <div class="widget-summary-col">
                                           <div class="summary">
                                               <h4 class="amount"><%#Eval("Name")%></h4>
                                               <div class="info">
                                                   <strong class="title"><%#Eval("Contract_Type_Name")%></strong>
                                                   <span class="text-primary">(<%#Eval("Contract_Type_Category")%>)</span>
                                               </div>
                                           </div>
                                           <div class="summary-footer">
                                               <a class="text-muted text-uppercase">Details</a>
                                           </div>
                                       </div>
                                   </div>
                               </div>
                           </section>
                       </ItemTemplate>
                       <RenderedFields>
                           <NodeFields>
                               <telerik:OrgChartRenderedField DataField="Name" Label="Name" />
                           </NodeFields>
                           <ItemFields>
                               <telerik:OrgChartRenderedField DataField="Contract_Type_Category" Label="Category" />
                           </ItemFields>
                           <ItemFields>
                               <telerik:OrgChartRenderedField DataField="Contract_Type_Name" Label="Type" />
                           </ItemFields>
                       </RenderedFields>
                   </telerik:RadOrgChart>

Veselin Tsvetanov
Telerik team
 answered on 31 May 2016
1 answer
106 views

I have inherited an application that has  used Telerik.Web.Mvc DLL. It was developed circa 2010. I needed to work on the menu sizes and I asked for help from the Telerik guys. They suggested that the application being so old I should migrate to the latest code. Which I did. But I lost all the Telerik.Web.Mvc sitemap part. And now I am lost. I am not sure what comes after SiteMapManager. I cannot find any documentation on it, I do not understand how to migrate.

Can somebody help me with this issue?

Thank you.

Veselin Tsvetanov
Telerik team
 answered on 31 May 2016
1 answer
162 views

I am changing the background color of a date ( that is being provided from the database ) by using the Calendar OnDayRender.  The problem is that when the page initially loads the background color is not present.  But if I change the month, then go back to the previous month, the background color appears.

 

ASP:

<telerik:RadDatePicker AutoPostBack="true" OnSelectedDateChanged="rdpEnd_SelectedDateChanged" ID="rdpEnd" ToolTip="" class="form-control" Style="width: 100%;" Height="30px" aria-describedby="ptoEndDate" runat="server">
 
<DatePopupButton ToolTip="" />
<Calendar runat="server" ShowRowHeaders="false" OnDayRender="CustomizeDay">
 
</Calendar>
</telerik:RadDatePicker>

 

C#

protected void CustomizeDay(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
  DateTime CurrentDate = e.Day.Date;
  using (DataClassesDataContext db = new DataClassesDataContext())
  {
    if(db.Calendars.Where(x => x.date.Value.Date == e.Day.Date).Any())
      {
       TableCell currentCell = e.Cell;
       currentCell.Style["background-color"] = "#000000";
      }
   }
}

   

Viktor Tachev
Telerik team
 answered on 31 May 2016
1 answer
228 views

hello 
i have the following problem
i have a radgrid which is totally builded in code behind because it must be bound to different data types
you can see a preview in this page
the user may update a record or insert a new one
when entering in edit mode, some rows in the edit form should be hidden based on the selection of the main item (the INST_MODEL value that cannot be changed in edit mode)
following is the codebehind of the ascx (i omit fo simplicity the part of code that builds customedittemplate)

so, when selecting an item with INST_MODEL = GA_CP-LI-COR LI-7200, for example, the rows with INST_SA[...] labels should be hidden

how can i do it?!

thanks a lot

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Collections;
using System.Data;
using System.Collections.Specialized;
using System.Web.UI.HtmlControls;
 
namespace SitefinityWebApp.EcoControls
{
    public partial class BADMView : System.Web.UI.UserControl
    {
        string conn = System.Configuration.ConfigurationManager.ConnectionStrings["connMulti"].ConnectionString;
        BadmVar bv = null;
        int idVar = 1000;
        int idSite = 0;
        int insertUserId = 0;
        public string I_MODEL="";
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["idutente"] = 127;
            Session["usname"] = "database";
            if (Session["idutente"] != null && Session["idutente"].ToString()!="")
            {
                insertUserId = int.Parse(Session["idutente"].ToString());
            }
        }
 
        protected void Page_Init(object sender, EventArgs e)
        {
            /***********************/
            //if (Request["idvar"] != null && Request["idvar"].ToString() != "0")
            if (Request["idsite"] != null && Request["idsite"].ToString() != "")
            {
                //Response.Write("idvar:: " + Request["idvar"].ToString());
                //idVar = int.Parse(Request["idvar"].ToString());
                //pickUpVars.SelectedValue = Request["idvar"].ToString();
                idSite = int.Parse(Request["idsite"].ToString());
                sitesDDL.SelectedValue = Request["idsite"].ToString();
            }
            else
            {
                return;
            }
            //1. Get theBadm Variable Infos
            SqlConnection cn = new SqlConnection();
            cn.ConnectionString = conn;
            cn.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = cn;
            cmd.CommandText = "...";
             
 
            //2. Build the grid
            RadGrid grid = new RadGrid();
            grid.ID = "instGrid";
            grid.DataSourceID = "sqlInst";
            grid.PageSize = 15;
            grid.AllowPaging = true;
            grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
            grid.AutoGenerateColumns = false;
            grid.AllowAutomaticUpdates = false;
            grid.AllowAutomaticInserts = false;
            grid.AllowAutomaticDeletes = false;
            grid.AllowMultiRowEdit = true;
            //grid.AllowMultiRowSelection = true;
            grid.Skin = "Bootstrap";
            grid.ItemCommand += new GridCommandEventHandler(instGrid_ItemCommand);
            grid.ItemDataBound += new GridItemEventHandler(instGrid_ItemDataBound);
 
            //2.1 Add Customers table 
            grid.MasterTableView.DataKeyNames = new string[] { "id_badmstorage", "value" };
            if (bv.ID != 1)
            {
                grid.MasterTableView.EditMode = GridEditMode.EditForms;
                grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
            }
            GridBoundColumn boundColumn = new GridBoundColumn();
            boundColumn.DataField = "id_badmstorage";
            boundColumn.HeaderText = "ID";
            boundColumn.ReadOnly = true;
            grid.MasterTableView.Columns.Add(boundColumn);
 
            //2.2 SET SQL DATA SOURCE...
             
            sqlInst.SelectCommand = "...";
            //3. Add grid columns...
            GridTemplateColumn tempC = null;
            tempC = new GridTemplateColumn();
            tempC.DataField = "value";
            tempC.HeaderText = bv.Name;
            tempC.UniqueName = "value";
            tempC.ItemTemplate = new MyTemplate("value", bv.CvIndex, true);
            tempC.EditItemTemplate = new CustomEditTemplate("value", true, bv.Unit, bv.CvIndex, bv.ID);
             
            grid.MasterTableView.Columns.Add(tempC);
             
            if (bv.QualifierList != null)
            {
                for (int i = 0; i < bv.QualifierList.Count; i++)
                {
                    string temp = (bv.QualifierList[i].QualIndex != "") ? bv.QualifierList[i].QualIndex : bv.QualifierList[i].RealQualName;
                    tempC = new GridTemplateColumn();
                    tempC.DataField = temp;
                    tempC.HeaderText = bv.QualifierList[i].QualName;
                    tempC.UniqueName = bv.QualifierList[i].QualName;
                    tempC.ItemTemplate = new MyTemplate(temp, bv.QualifierList[i].CvIndex, bv.QualifierList[i].Required);
                    tempC.EditItemTemplate = new CustomEditTemplate(temp, bv.QualifierList[i].Required, bv.QualifierList[i].Type, bv.QualifierList[i].CvIndex, bv.ID);
                    tempC.Visible = (i <= 5);
                    grid.MasterTableView.Columns.Add(tempC);
                }
            }
 
            //4. Edit commands
            if (bv.ID != 1)
            {
                GridEditCommandColumn eCol = new GridEditCommandColumn();
                eCol.UniqueName = "EditCommandColumn";
                grid.MasterTableView.Columns.Add(eCol);/**/
            }
 
            //5. delete command
            if (bv.ID != 1)
            {
                /*tempC = new GridTemplateColumn();
                tempC.UniqueName = "DeleteColumn";
                // tempC.HeaderText = "Delete";
                tempC.ItemTemplate = new DeleteTemplate("delete");
                grid.MasterTableView.Columns.Add(tempC);*/
            }
           // grid.ClientSettings.ClientEvents = new GridClientEvents(
            //6. Add the grid to the placeholder
             
            this.PlaceHolder1.Controls.Add(grid);
 
            //AJAX SETTINGS...
            AjaxSetting ajax = new AjaxSetting(grid.ID);
            AjaxUpdatedControl up = new AjaxUpdatedControl();
            up.ControlID = grid.ID;
            ajax.UpdatedControls.Add(up);
            up = new AjaxUpdatedControl();
            ajax.UpdatedControls.Add(up);
            RadAjaxManager1.AjaxSettings.Add(ajax);
        }
 
        private bool compareHTable(Hashtable tnew, Hashtable told)
        {
            foreach (string key in tnew.Keys)
            {
                if (tnew[key] != told[key])
                {
                    return false;
                }
            }
            return true;
        }
 
        public int IdVar
        {
            get { return idVar; }
        }
 
         
 
        protected void instGrid_ItemCommand(object sender, GridCommandEventArgs e)
        {
            string body = "";
            SqlConnection cn = new SqlConnection(conn);
            cn.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = cn;
 
            if (e.CommandName == "Update")
            {
                //Perform updates
            }
            else if (e.CommandName == "InitInsert")
            {
 
            }
            else if (e.CommandName == "Edit")
            {
                //Edit code
 
            }
            else if (e.CommandName == "PerformInsert")
            {
                //Insert code
            }
            else if (e.CommandName == "Delete")
            {
                
                GridEditableItem editedItem = e.Item as GridEditableItem;
                string idbm = editedItem.GetDataKeyValue("id_badmstorage").ToString();
                cmd.CommandText = "UPDATE BADMStorage16 SET dataStatus=404, deleteUserId="+insertUserId+", deletedDate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "' WHERE id_badmstorage=" + idbm;
                cmd.ExecuteNonQuery();
                body += "\nDeleted item for variable "+bv.Name+", record ID="+idbm+" by " + Session["usname"].ToString();
            }
            cn.Close();
             
        }
         
    }

Konstantin Dikov
Telerik team
 answered on 31 May 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?