Telerik Forums
UI for ASP.NET AJAX Forum
14 answers
295 views

I get following error with RadMap:


[InvalidOperationException: Fehler während der Serialisierung oder Deserialisierung mit JSON-"JavaScriptSerializer". Die Länge der Zeichenfolge übersteigt den in der maxJsonLength-Eigenschaft festgelegten Wert.]
   System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat) +759618
   System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, SerializationFormat serializationFormat) +103
   System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse, SerializationFormat serializationFormat, MemberInfo currentMember) +178
   System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat serializationFormat) +47
   Telerik.Web.UI.AdvancedJavaScriptSerializer.Serialize(Object obj) +102
   Telerik.Web.UI.RadMap.DescribeComponent(IScriptDescriptor descriptor) +54
   Telerik.Web.UI.ScriptRegistrar.GetScriptDescriptors(Control control) +180
   Telerik.Web.UI.RadDataBoundControl.GetScriptDescriptors() +9
   System.Web.UI.ScriptControlManager.RegisterScriptDescriptors(IScriptControl scriptControl) +164
   Telerik.Web.UI.RadDataBoundControl.RegisterScriptDescriptors() +153
   Telerik.Web.UI.RadDataBoundControl.Render(HtmlTextWriter writer) +122
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   Telerik.Web.UI.ControlRenderer.Render(HtmlTextWriter writer) +148
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +169
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +169
   System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer) +334
   System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer) +58
   Telerik.Web.UI.OurUpdatePanel.Render(HtmlTextWriter writer) +264
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   Telerik.Web.UI.PreControlToAjaxify.Render(HtmlTextWriter writer) +147
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +169
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +169
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +47
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +169
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +47
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +169
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +11661639
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +47
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +53
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +169
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +169
   System.Web.UI.Page.Render(HtmlTextWriter writer) +40
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +1016
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +276
   System.Web.UI.Page.Render(HtmlTextWriter writer) +40
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4239

It seems  problem just occurs, when there are more then 3024 Markers on the map. Below this count there is now problem.

 

I allready changed the MaxJsonLength in the web.config. That changed nothing.


Versionsinformationen: Microsoft .NET Framework-Version:4.0.30319; ASP.NET-Version:4.8.4494.0

Chris
Top achievements
Rank 1
Iron
Iron
 answered on 14 Mar 2023
0 answers
188 views

Hello,

I am facing an issue wherein on the page following issue is coming:-

Request Failed. Try Again.

When I debugged the code then I found that the issue is actually coming due to this class file not found:- GanttProvider the actual error in the code is showing that:
The type or namespace name 'GanttProvider' could not be found (are you missing a using directive or an assembly reference?)


<%@ WebService Language="C#" Class="GanttService" %> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Script.Services; using System.Web.Services; using System.Web.SessionState; //using Telerik.Web.UIusing Telerik.Web.UI.Gantt; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] publicclassGanttService : System.Web.Services.WebService, IRequiresSessionState { private WebServiceController _controller; public WebServiceController Controller { get { if (_controller == null) { _controller = new WebServiceController(new GanttProvider()); } return _controller; } } [WebMethod(EnableSession = true)] public IEnumerable<CustomTaskData> GetTasks() { var ddd = Controller.GetTasks<CustomTaskData>(); var provider = new GanttProvider(); foreach (var item in ddd) { //item.Dependency = provider.GetSuccessorByTaskID((int)item.ID); item.Dependency = provider.GetPredecessorByTaskID((int)item.ID); } return ddd; } [WebMethod(EnableSession = true)] public IEnumerable<CustomTaskData> InsertTasks(IEnumerable<CustomTaskData> models) { var plannerRefId = HttpContext.Current.Session["GanttPlannerRefId"] != null ? Convert.ToInt32(HttpContext.Current.Session["GanttPlannerRefId"]) : 0; var plannerId = HttpContext.Current.Session["GanttPlannerID"] != null ? Convert.ToInt32(HttpContext.Current.Session["GanttPlannerID"]) : 0; var plannerType = HttpContext.Current.Session["GanttPlannerType"] != null ? HttpContext.Current.Session["GanttPlannerType"].ToString() : "project"; if (plannerType.Equals("vendor", StringComparison.InvariantCultureIgnoreCase)) { foreach (var item in models) { item.RootVendorID = plannerRefId; item.PlannerID = plannerId; } }else { foreach (var item in models) { item.ProjectID = plannerRefId; item.PlannerID = plannerId; } } return Controller.InsertTasks<CustomTaskData>(models); } [WebMethod(EnableSession = true)] public IEnumerable<CustomTaskData> UpdateTasks(IEnumerable<CustomTaskData> models) { var plannerRefId = HttpContext.Current.Session["GanttPlannerRefId"] != null ? Convert.ToInt32(HttpContext.Current.Session["GanttPlannerRefId"]) : 0; var plannerId = HttpContext.Current.Session["GanttPlannerID"] != null ? Convert.ToInt32(HttpContext.Current.Session["GanttPlannerID"]) : 0; var plannerType = HttpContext.Current.Session["GanttPlannerType"] != null ? HttpContext.Current.Session["GanttPlannerType"].ToString() : "project"; if (plannerType.Equals("vendor", StringComparison.InvariantCultureIgnoreCase)) { foreach (var item in models) { item.RootVendorID = plannerRefId; item.PlannerID = plannerId; } }else { foreach (var item in models) { item.ProjectID = plannerRefId; item.PlannerID = plannerId; } } return Controller.UpdateTasks<CustomTaskData>(models); } [WebMethod(EnableSession = true)] public IEnumerable<CustomTaskData> DeleteTasks(IEnumerable<CustomTaskData> models) { return Controller.DeleteTasks<CustomTaskData>(models); } [WebMethod(EnableSession = true)] public IEnumerable<DependencyData> GetDependencies() { return Controller.GetDependencies(); } [WebMethod(EnableSession = true)] public IEnumerable<DependencyData> InsertDependencies(IEnumerable<DependencyData> models) { return Controller.InsertDependencies(models); } [WebMethod(EnableSession = true)] public IEnumerable<DependencyData> DeleteDependencies(IEnumerable<DependencyData> models) { return Controller.DeleteDependencies(models); } [WebMethod(EnableSession = true)] public IEnumerable<Telerik.Web.UI.Gantt.ResourceData> GetResources() { return Controller.GetResources(); } [WebMethod(EnableSession = true)] public IEnumerable<AssignmentData> GetAssignments() { return Controller.GetAssignments(); } [WebMethod(EnableSession = true)] public IEnumerable<AssignmentData> InsertAssignments(IEnumerable<AssignmentData> models) { return Controller.InsertAssignments(models); } [WebMethod(EnableSession = true)] public IEnumerable<AssignmentData> UpdateAssignments(IEnumerable<AssignmentData> models) { return Controller.UpdateAssignments(models); } [WebMethod(EnableSession = true)] public IEnumerable<AssignmentData> DeleteAssignments(IEnumerable<AssignmentData> models) { return Controller.DeleteAssignments(models); } } [System.Runtime.Serialization.DataContract] publicclassCustomTaskData : TaskData { [System.Runtime.Serialization.DataMember] publicstring Description { get; set; } [System.Runtime.Serialization.DataMember] publicint? ProjectID { get; set; } [System.Runtime.Serialization.DataMember] publicint? PlannerID { get; set; } [System.Runtime.Serialization.DataMember] publicstring CusTaskType { get; set; } [System.Runtime.Serialization.DataMember] publicdouble? CusDuration { get; set; } [System.Runtime.Serialization.DataMember] publicdouble? CusActualHour { get; set; } [System.Runtime.Serialization.DataMember] publicint? VendorID { get; set; } [System.Runtime.Serialization.DataMember] publicstring Vendor { get; set; } [System.Runtime.Serialization.DataMember] publicint? RootVendorID { get; set; } [System.Runtime.Serialization.DataMember] publicstring RootVendorName { get; set; } [System.Runtime.Serialization.DataMember] publicstring ProjectName { get; set; } [System.Runtime.Serialization.DataMember] publicstring Dependency { get; set; } [System.Runtime.Serialization.DataMember] publicint? PlannerTaskID { get; set; } [System.Runtime.Serialization.DataMember] publicint? ItemRefID { get; set; } public override void CopyFrom(ITask srcTask) { base.CopyFrom(srcTask); Description = ((CustomTaskData)srcTask).Description; ProjectID = ((CustomTaskData)srcTask).ProjectID; PlannerID = ((CustomTaskData)srcTask).PlannerID; CusTaskType = ((CustomTaskData)srcTask).CusTaskType; CusDuration = ((CustomTaskData)srcTask).CusDuration; CusActualHour = ((CustomTaskData)srcTask).CusActualHour; VendorID = ((CustomTaskData)srcTask).VendorID; Vendor = ((CustomTaskData)srcTask).Vendor; RootVendorID = ((CustomTaskData)srcTask).RootVendorID; RootVendorName = ((CustomTaskData)srcTask).RootVendorName; ProjectName = ((CustomTaskData)srcTask).ProjectName; PlannerTaskID = ((CustomTaskData)srcTask).PlannerTaskID; ItemRefID = ((CustomTaskData)srcTask).ItemRefID; Dependency = ((CustomTaskData)srcTask).Dependency; } public override void CopyTo(ITask destTask) { base.CopyTo(destTask); ((CustomTaskData)destTask).Description = Description; ((CustomTaskData)destTask).ProjectID = ProjectID; ((CustomTaskData)destTask).PlannerID = PlannerID; ((CustomTaskData)destTask).CusTaskType = CusTaskType; ((CustomTaskData)destTask).CusDuration = CusDuration; ((CustomTaskData)destTask).CusActualHour = CusActualHour; ((CustomTaskData)destTask).VendorID = VendorID; ((CustomTaskData)destTask).Vendor = Vendor; ((CustomTaskData)destTask).RootVendorID = RootVendorID; ((CustomTaskData)destTask).RootVendorName = RootVendorName; ((CustomTaskData)destTask).ProjectName = ProjectName; ((CustomTaskData)destTask).PlannerTaskID = PlannerTaskID; ((CustomTaskData)destTask).ItemRefID = ItemRefID; ((CustomTaskData)destTask).Dependency = Dependency; } }

I am facing issue where I am trying to pass the object of GanntProvider class in WebServiceController constructor. It's an .ASMX file.

Kindly help me resolve this.

Thanks
Varun


Varun
Top achievements
Rank 1
 asked on 14 Mar 2023
0 answers
99 views

Hi all,

 

I have 2 RadGrid.

When a row is selected on the first Radgrid and if the second RadGrid contain only one value (after populating it) => 


I can from the code behind of the first RadGrid select the first and only row of the second via the code behind (OnSelectedIndexChanged event on the first Radgrid).

 

RadGrid2.MasterTableView.Items[0].Selected = true;

But the  JS code <ClientEvents OnRowSelected="RowSelected"/>  of the second is never called.

 

 

If I click on the row, the JS event is called correctly.

I try via a call =>


ScriptManager.RegisterStartupScript(this.Page, GetType(), "Selected", "RowSelected()", true);

But without succes => get an error =>

Uncaught TypeError: Cannot read properties of null (reading 'get_masterTableView')

Any suggestion ? 

Regards,

Didier

 

Didier
Top achievements
Rank 2
Iron
Iron
 updated question on 13 Mar 2023
1 answer
133 views

Hello,

I am trying to upload file to S3Bucket and after being uploaded needs to move it to a subfolder under the bucket.

Is there any automatic proccess to upload directly to a S3Bucket/UserID folder?

or we have to create the sub folder first?

 

Thanks

Michel

Attila Antal
Telerik team
 answered on 13 Mar 2023
0 answers
376 views

Hi, i try to export data table to excel file using following code https://docs.telerik.com/devtools/aspnet-ajax/knowledge-base/common-export-large-amount-of-data-to-pdf-xlsx-and-csv-using-the-telerik-document-processing-libraries?_ga=2.266990472.785509911.1678626449-162692405.1645090225&_gl=1*1ns64vr*_ga*MTYyNjkyNDA1LjE2NDUwOTAyMjU.*_ga_9JSNBCSF54*MTY3ODY3Nzk2OS4xMTguMS4xNjc4Njc4MzQwLjM1LjAuMA.. , in data table we have number columns which is not export correct format ,we need to change format for apply formulas, we need to avoid this, bcz each time need to change that format in order to sum the column,


Private Sub SpreadStreamProcessingForXLSXAndCSV(ByVal dt As DataTable, ByVal filename As String, ByVal Optional docFormat As SpreadDocumentFormat = SpreadDocumentFormat.Xlsx, ByVal Optional sheetName As String = "Sheet1")

        If dt Is Nothing Then
            Dim manager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)
            manager.Alert("No records to export to excel!")
            Exit Sub

        End If

        Using stream As MemoryStream = New MemoryStream()

            Using workbook As IWorkbookExporter = SpreadExporter.CreateWorkbookExporter(docFormat, stream)

                Using worksheetExporter As IWorksheetExporter = workbook.CreateWorksheetExporter(sheetName)

                    For i As Integer = 0 To dt.Columns.Count - 1

                        Using columnExporter As IColumnExporter = worksheetExporter.CreateColumnExporter()
                            columnExporter.SetWidthInPixels(100)

                        End Using
                    Next

                    ExportHeaderRows(worksheetExporter, dt)

                    For Each row As DataRow In dt.Rows

                        Using rowExporter As IRowExporter = worksheetExporter.CreateRowExporter()


                            For Each item In row.ItemArray
                                Dim normalFormat As SpreadCellFormat = New SpreadCellFormat()
                                normalFormat.FontSize = 10
                                normalFormat.VerticalAlignment = SpreadVerticalAlignment.Center
                                normalFormat.HorizontalAlignment = SpreadHorizontalAlignment.Center
                                Using cellExporter As ICellExporter = rowExporter.CreateCellExporter()
                                    cellExporter.SetValue(item.ToString())
                                    cellExporter.SetFormat(normalFormat)
                                End Using
                            Next
                        End Using
                    Next
                End Using
            End Using

            Dim output As Byte() = stream.ToArray()

            If docFormat = SpreadDocumentFormat.Csv Then
                FileExtension = "csv"
                filename = filename
                ContentType = "text/csv"
            ElseIf docFormat = SpreadDocumentFormat.Xlsx Then
                FileExtension = "xlsx"
                filename = filename
                ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            End If

            WriteFileToResponse(output, filename)
        End Using
    End Sub

    Private Sub ExportHeaderRows(ByVal worksheetExporter As IWorksheetExporter, ByVal dt As DataTable)
        Using rowExporter As IRowExporter = worksheetExporter.CreateRowExporter()
            Dim HeaderRowHeight As Double = 50
            rowExporter.SetHeightInPoints(HeaderRowHeight)
            Dim format As SpreadCellFormat = New SpreadCellFormat()
            format.IsBold = True
            format.Fill = SpreadPatternFill.CreateSolidFill(New SpreadColor(142, 196, 65))
            format.ForeColor = New SpreadThemableColor(New SpreadColor(255, 255, 255))
            format.HorizontalAlignment = SpreadHorizontalAlignment.Center
            format.VerticalAlignment = SpreadVerticalAlignment.Center

            For i As Integer = 0 To dt.Columns.Count - 1

                Using cellExporter As ICellExporter = rowExporter.CreateCellExporter()

                    cellExporter.SetFormat(format)
                    cellExporter.SetValue(dt.Columns(i).ColumnName)
                End Using
            Next
        End Using
    End Sub

    Private Sub WriteFileToResponse(ByVal content As Byte(), ByVal strfilename As String)
        Response.ContentType = ContentType
        Response.Headers.Remove("Content-Disposition")
        Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}.{1}", strfilename, FileExtension))
        Response.BinaryWrite(content)
        Response.[End]()
    End Sub
Please help to how to apply correct format for number columns, 
Note: We don't know which column is number column, so we need to pass General format for number column.

Regards
Aravind
Aravind
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 13 Mar 2023
0 answers
154 views

Is there a way to hide/unhide tabs(sheets) of a RadSpreadsheet control?

In Excel, one can simply right-click the tab and select to hide or unhide it.

John
Top achievements
Rank 1
Iron
 asked on 09 Mar 2023
0 answers
93 views

If I use "InsertImage" and insert a logo image (png) into the loaded image, it is not possible to save.

Nothing happens when I click the save button...

<telerik:ImageEditorTool CommandName="InsertImage" IsToggleButton="true" /> 

Kjell
Top achievements
Rank 1
Iron
Iron
 asked on 09 Mar 2023
0 answers
417 views
We are looking for a way to create Bar Chart with rounded corners from Server Side to export as Byte to Crystal Reports.

Is there a way to do with your solution from ASP.NET?
Pedro Angel
Top achievements
Rank 1
 asked on 08 Mar 2023
1 answer
106 views

Hi ,

 

I am using <telerik:GridDropDownColumn> inside radgrid of  aspnetAjax. I need to disable one column based on selection of item in GridDropDownColumn.

 

Is there a way to trigger event on selection change in GridDropDownColumn

 

I couldnt find right answer. can this be achieved? disabling one column inside radgrid based on selection of item inside dropdowncolumn in radgrid?

Regards,

Kiran

Attila Antal
Telerik team
 answered on 08 Mar 2023
0 answers
204 views

How do I save the image after I have made changes using  asp:button OnClick="xxx" (post back) to the database?

I have several controls (asp:Panel, asp:Label....) that I need to update after I change the image....

I'm reading my picture using OnImageLoading


    Protected Sub RadImageEditor1_ImageLoading(sender As Object, args As ImageEditorLoadingEventArgs)

        Dim MyConnection As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("MyConn").ConnectionString)

        Dim MyCommand As New SqlCommand("select ID, imagedata from bildbank_data where ID = @ID;", MyConnection)

        MyCommand.Parameters.Add(New SqlParameter("@ID", SqlDbType.Int, 4))
        MyCommand.Parameters("@ID").Value = lblPickUpId.Text

        If MyConnection.State = ConnectionState.Closed Then
            MyConnection.Open()
        End If

        Dim dr1 As SqlDataReader = MyCommand.ExecuteReader
        If dr1.Read Then
            If Not dr1("imagedata") Is DBNull.Value Then
                Dim imagedata As Byte() = dr1("imagedata")
                Dim s As New MemoryStream(imagedata.ToArray())
                Dim img As New Telerik.Web.UI.ImageEditor.EditableImage(s)

                args.Image = img
                args.Cancel = True
            End If
        End If

        dr1.Close()

        MyCommand.Dispose()
        MyConnection.Close()

    End Sub

Kjell
Top achievements
Rank 1
Iron
Iron
 asked on 08 Mar 2023
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?