Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
140 views

Within a page, I have the following - 

<telerik:RadGrid ...

     <telerik:GridAttachmentColumn ... AllowedFileExtensions=".png,.gif,.jpg,.jpeg" ... />

</ telerik:RadGrid>

When editing an item within the grid, and clicking the 'Select' option on the grid's edit column related to the GridAttachmentColumn, I'm receiving this popup - 

 

I want to restrict the files a user can select to upload through this dialog to those defined within the 'AllowedFileExtensions' property of the control, either from within the HTML, or in the code behind.

How can I go about doing that? If this is not the correct place to be asking this question, where on the forum should I be asking this question?

Thanks.

Attila Antal
Telerik team
 answered on 16 Mar 2023
2 answers
458 views

How to un-highlight filtered yellow records. I used Ctrl+F to search keywords, those matching records were highlighed in yellow. Now I want to remove the highlighted(yellow) recorded. 

 

Jared
Top achievements
Rank 1
Iron
 answered on 15 Mar 2023
0 answers
129 views

I'd like to dynamically increase the grid size (add rows and or columns) when a user attempts to paste data that exceeds the default size.

Is there an event that I can capture that fires before the 'Cannot paste, because the copy area and the paste area are not the same size and shape' error occurs?

I've tried OnClientChanging and OnClientPaste but the error is thrown before either of these events fire.

John
Top achievements
Rank 1
Iron
 asked on 15 Mar 2023
14 answers
1.3K+ views

I have a Radgrid on ASP.NET Form (RadControls for ASP.NET AJAX Q2 2012 SP2 with VS 2010) , which is bound to a Linq data source and set it to have 10 records per page , sorting, filtering is enabled. Also have a hyper a link column (Radgrid Mastertable Databound column) on the Radgrid, such that a user can click it & navigate to another external page (details.aspx) from the list.  I am passing Master Table Primary Key that is Parent key of all rows in Detail Page. On the details page, they have "Back" button to return to the RadGrid page.

I am looking for sample code snippet on the Server/Client Side on how to specify the page/row index to set the RadGrid after data binding. The idea is to ensure the user navigates to the same Radgrid (Parent) page/row index they were originally on after exiting from details.aspx.

Thanks

gc_0620

Rumen
Telerik team
 updated answer on 15 Mar 2023
14 answers
278 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
181 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
89 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
121 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
338 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
135 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?