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

I'm mapping locations.  some times companies have multiple assets at the same address or same Longitude/Latitude.  When this is rendered on the map it shows up as one pin and all the rest get lost in the ether.  I ran across some Kendo example that is supposed to pad the pins.  It doesn't work.  How do we get multiple pins to render at the same location or how do we get one pin to show multiple sets of data?

Map code is pretty simple:

    <telerik:RadMap RenderMode="Lightweight" runat="server" ID="mapSite" Zoom="4" CssClass="MyMap Rounded" Width="100%" Height="100%">
        <DataBindings>
            <MarkerBinding DataShapeField="Shape" DataTitleField="SITE_CITY" DataLocationLatitudeField="Latitude" DataLocationLongitudeField="Longitude" />
        </DataBindings>
        <LayersCollection>
            <telerik:MapLayer Type="Tile" Subdomains="a,b,c"
                UrlTemplate="https://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png"
                Attribution="">
            </telerik:MapLayer>
        </LayersCollection>
    </telerik:RadMap>

Code behind:

Binding code:

            Dim res = From x In db.SITEs
                      Where x.COMPANY.COMPANY_CODE.Equals(Session("Market").ToString)
                      Select New clsSiteData With {
                          .Shape = "PinTarget",
                          .SITE_ID = x.SITE_ID,
                          .SITE_CODE = x.SITE_CODE,
                          .SITE_NAME = x.SITE_NAME,
                          .SITE_ADDRESS_1 = x.SITE_ADDRESS_1,
                          .SITE_ADDRESS_2 = x.SITE_ADDRESS_2,
                          .SITE_CITY = x.SITE_CITY,
                          .STATE_CODE = x.STATE.STATE_CODE,
                          .POSTAL_CODE = x.SITE_POSTAL_CODE,
                          .BUILDING_ID = x.SITE_BUILDING_IDENTIFIER,
                          .PROPERTY_ID = x.PROPERTY_CODE.PROPERTY_CODE,
                          .Latitude = If(x.SITE_MAP_LAT, 0),
                          .Longitude = If(x.SITE_MAP_LON, 0)
                          }

            mapSite.DataSource = res.ToList
            mapSite.DataBind()

ItemDataBound:

Private Sub mapSite_ItemDataBound(sender AsObject, e As MapItemDataBoundEventArgs) Handles mapSite.ItemDataBound Dim htmlTemplate AsStringTry hlAssInv.Visible = CType(ViewState("Asset"), Boolean) htmlTemplate = getInnerHTML(tblTemplate) Dim marker As MapMarker = TryCast(e.Item, MapMarker) If marker IsNothingThenReturnEndIfDim item As clsSiteData = TryCast(e.DataItem, clsSiteData) marker.TooltipSettings.Content = [String].Format(htmlTemplate, item.SITE_CODE, item.SITE_NAME, item.SITE_ADDRESS_1, item.SITE_ADDRESS_2, item.SITE_CITY, item.STATE_CODE, item.POSTAL_CODE, item.BUILDING_ID, item.PROPERTY_ID, item.SITE_ID) Catch ex As Exception Dim xxx AsString = ex.Message.ToString End Try

End Sub


Kjell
Top achievements
Rank 1
Iron
Iron
 answered on 07 Jul 2024
1 answer
65 views

When Static header are enabled and few columns are fixed, 
Scenario:


1.If the Start and End Dates range are more than 1 month, the data is not exactly aligned with the Header dates after scrolling towards right.

2.If filter is applied, then the footer is displayed at very bottom. 

Vasko
Telerik team
 answered on 05 Jul 2024
1 answer
72 views

Hello, as I read from https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/functionality/track-changes-and-comments/track-changes#supported-commands only some track change commands are available.

For example, Delete row or column is not tracking.

So, I wanted to create workaround, which cancels row deletion and instead remove content of the cells (in TrackChange mode just mark as deleted). 

I just have the following idea, but it is not delete text:

function OnClientCommandExecuting(editor, args) {
    var commandName = args.get_commandName();
    var tool = args.get_tool();   
    var value = args.get_value();

    if (commandName === "DeleteRow") {
        args.set_cancel(true);
        var range = editor.getSelection().getRange();
        var tableRow = range.commonAncestorContainer;
        while (tableRow && tableRow.tagName !== "TR") {
            tableRow = tableRow.parentNode;
        }

        if (tableRow) {
            var cells = tableRow.cells;
            for (var i = 0; i < cells.length; i++) {
                var cellContent = cells[i].innerHTML;
                var cellRange = editor.get_document().createRange();
                cellRange.selectNodeContents(cells[i]);
                editor.getSelection().selectRange(cellRange);
                editor.executeCommand("Backspace", false, true);
            }
        }
    }
}

Any ideas to fix? Is it more easy solution? May be add to TR attribute "data-del" and define it in css? Is it possible to resolve it in backend? 

Thank you!

 

 

Rumen
Telerik team
 answered on 04 Jul 2024
1 answer
80 views

Telerik has the little Kendo ninja fellow as a constant icon on the bottom right of the window, and after a few seconds, it slides out to ask "Is this article helpful?  Yes/No".

My client wants a timed pop-out similar to that on each page, which after 10-15 seconds asks "Do you want more information?  Click here to contact us!" and then redirect to our contact page.  Or they can click to make it hide away (until the next page).

I'm suspecting the Notification widget will do this, but I'm not sure where to begin or if there is something better for this purpose.  Has anyone done something like this?

Vasko
Telerik team
 answered on 04 Jul 2024
2 answers
76 views

Hello,

Is any way to return:

1. Html with Track Change marks and comments to store it in the database for next edit session?

2. Auto accepted html.

I tried in cs: RadEditor1.Content - but it return content without changes, RadEditor1.GetHtml(EditorStripHtmlOptions.AcceptTrackChanges) - but also track changes were not accepted.

Can you provide any example, please?

Thank you!

Emin Sadigov
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 04 Jul 2024
0 answers
67 views
Is there any possibility to be able to make the EmptyMessage in a RadComboBox to be translated by the browser but the Drop-down list items to stay untranslated
Michael
Top achievements
Rank 1
 asked on 03 Jul 2024
1 answer
87 views

We have hundreds of log error messages regarding missing or problem loading ButtonSprites.gif.

This issue has been asked in 2019 ticket and we were informed it would be fixed in a new release.  It has yet to be fixed, and although I we are not experiencing any obvious issues, other than the error in the log, I have been tasked with resolving this.  

The exact message states:  "The requested resource 'pTelerik.Web.UI.Skins|Telerik.Web.UI.Skins.Sunset.FormDecorator.ButtonSprites.gif' does not exist or there was a problem loading it."

Please advise.

For reference, see our ticket #1453479 

Thank you,

Jeff.

Rumen
Telerik team
 updated answer on 28 Jun 2024
1 answer
80 views

So, first off, I am very new to programming and just started a position, but I have been working on an item for a bit now and am struggling to get it to work correctly.  I get stuck on a spceific line of code and I am not sure how to handle it as they are not text boxes. The errors I get are as follows: 

System.InvalidCastException: 'Unable to cast object of type 'Telerik.Web.UI.GridTextBoxColumnEditor' to type 'System.IConvertible'.' 

For this line: 

cmd.Parameters.Add("@Fill_Qty", SqlDbType.Int).Value = System.Convert.ToInt32(fillQtyEditor)

I also believe this will effect the maint_date and active_indicator cmds as well and would like any feedback. Additionally, the cmd that I am using for sql the values are null so seems to be bypassing that as well. I have scoured this site and documentation which has helped somewhat but nothing specific to this. 

 

Protected Sub RadGrid1_ItemCreated(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) If e.Item.IsInEditMode Then Dim item As Telerik.Web.UI.GridEditableItem = TryCast(e.Item, Telerik.Web.UI.GridEditableItem) ' Add validator for PortalID (Non-nullable) Dim portalIDEditor As Telerik.Web.UI.GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("PortalID"), Telerik.Web.UI.GridTextBoxColumnEditor) AddRequiredFieldValidator(portalIDEditor.TextBoxControl, "PortalID") ' Add validator for asset_sn (Non-nullable) Dim assetSNEditor As Telerik.Web.UI.GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("asset_SN"), Telerik.Web.UI.GridTextBoxColumnEditor) AddRequiredFieldValidator(assetSNEditor.TextBoxControl, "Asset Serial Number") ' Add validator for asset_model (Nullable) Dim assetModelEditor As Telerik.Web.UI.GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("asset_model"), Telerik.Web.UI.GridTextBoxColumnEditor) AddRequiredFieldValidator(assetModelEditor.TextBoxControl, "Asset Model") ' Add validator for asset_location (Nullable) Dim assetLocEditor As Telerik.Web.UI.GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("asset_location"), Telerik.Web.UI.GridTextBoxColumnEditor) AddRequiredFieldValidator(assetLocEditor.TextBoxControl, "Location") ' Add validator for Fill_qty (Nullable but must be numeric if provided) Dim fillQtyEditor As Telerik.Web.UI.GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("Fill_qty"), Telerik.Web.UI.GridTextBoxColumnEditor) AddNumericValidator(fillQtyEditor.TextBoxControl, "Fill Quantity") Dim maintEditor As Telerik.Web.UI.GridDateTimeColumnEditor = CType(item.EditManager.GetColumnEditor("maint_Date"), Telerik.Web.UI.GridDateTimeColumnEditor) Dim actIndEditor As Telerik.Web.UI.GridCheckBoxColumnEditor = CType(item.EditManager.GetColumnEditor("active_indicator"), Telerik.Web.UI.GridCheckBoxColumnEditor) Dim notesEditor As Telerik.Web.UI.GridTextBoxColumnEditor = CType(item.EditManager.GetColumnEditor("Notes"), Telerik.Web.UI.GridTextBoxColumnEditor) ' Checks to see if items if item is 'PerformInsert' else check if it is 'UpdateButton' Dim buttonName As String = If(TypeOf item Is Telerik.Web.UI.IGridInsertItem, "PerformInsertButton", "UpdateButton") TryCast(item.FindControl(buttonName), Button).ValidationGroup = "gridFormValidation" Dim objConnection As SqlConnection Dim strSQL As String objConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("DC2_Data_WarehouseConnectionString_PRODUCTION").ConnectionString) ' Insert record strSQL = "INSERT INTO [data_warehouse].[dbo].[t_d_ATracker] ([PortalID],[asset_SN],[Fill_Qty],[Maint_Date],[asset_location],[asset_model],[active_indicator],[Asset_Notes]) " & "VALUES (@PortalID, @asset_SN, @Fill_Qty, @Maint_Date, @asset_location, @asset_model, @active_indicator, @Asset_Notes);" & "SELECT CAST(scope_identity() AS int);" Dim cmd As New SqlCommand(strSQL, objConnection) ' Add parameters cmd.Parameters.Add("@PortalID", SqlDbType.VarChar, 10).Value = portalIDEditor.Text cmd.Parameters.Add("@asset_SN", SqlDbType.VarChar, 20).Value = assetSNEditor.Text cmd.Parameters.Add("@Fill_Qty", SqlDbType.Int).Value = System.Convert.ToInt32(fillQtyEditor) cmd.Parameters.Add("@Maint_Date", SqlDbType.Date).Value = maintEditor cmd.Parameters.Add("@asset_location", SqlDbType.VarChar, 20).Value = assetLocEditor.Text cmd.Parameters.Add("@asset_model", SqlDbType.VarChar, 20).Value = assetModelEditor.Text cmd.Parameters.Add("@active_indicator", SqlDbType.Bit).Value = actIndEditor cmd.Parameters.Add("@Asset_Notes", SqlDbType.VarChar, -1).Value = notesEditor.Text End If End Sub

Private Sub AddRequiredFieldValidator(textBox As TextBox, fieldName As String)
    Dim validator As New CustomValidator()
    validator.ID = "CustomValidator_" & fieldName.Replace(" ", "_")
    validator.ControlToValidate = textBox.ID
    validator.ValidateEmptyText = True
    validator.ErrorMessage = String.Format("* {0} is required", fieldName)
    validator.ForeColor = Color.OrangeRed
    validator.ClientValidationFunction = "requiredFieldValidation"
    validator.ValidationGroup = "gridFormValidation"
    AddHandler validator.ServerValidate, AddressOf RequiredField_ServerValidate
    textBox.Parent.Controls.Add(validator)
End Sub

Private Sub AddNumericValidator(textBox As TextBox, fieldName As String)
    Dim validator As New CustomValidator()
    validator.ID = "CustomValidator_" & fieldName.Replace(" ", "_")
    validator.ControlToValidate = textBox.ID
    validator.ValidateEmptyText = True
    validator.ErrorMessage = String.Format("* {0} must be a numeric value", fieldName)
    validator.ForeColor = Color.OrangeRed
    validator.ClientValidationFunction = "numericFieldValidation"
    validator.ValidationGroup = "gridFormValidation"
    AddHandler validator.ServerValidate, AddressOf NumericField_ServerValidate
    textBox.Parent.Controls.Add(validator)
End Sub

Protected Sub RequiredField_ServerValidate(source As Object, args As ServerValidateEventArgs)
    args.IsValid = Not String.IsNullOrWhiteSpace(args.Value)
End Sub

Protected Sub NumericField_ServerValidate(source As Object, args As ServerValidateEventArgs)
    Dim value As String = args.Value.Trim()
    args.IsValid = String.IsNullOrEmpty(value) OrElse IsNumeric(value)
End Sub

 


Rumen
Telerik team
 answered on 24 Jun 2024
1 answer
84 views
Is there a way to upload all files in a directory via Dropzone?
Attila Antal
Telerik team
 answered on 21 Jun 2024
1 answer
78 views

I want to hide the Preview column that is withing a Template column and I'm not having any luck.

                                    <telerik:RadGrid ID="RadGridMaterials" runat="server" AllowPaging="True" AllowSorting="True" GridLines="None" Width="896px" PageSize="20">
                                        <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                        <MasterTableView AutoGenerateColumns="false" TableLayout="Fixed">
                                            <NoRecordsTemplate>
                                                No Material Records Found
                                            </NoRecordsTemplate>
                                            <Columns>
                                                <telerik:GridButtonColumn ButtonType="PushButton" HeaderText="" HeaderStyle-Width="50px" UniqueName="EditItem" Text="Edit" ConfirmText="Edit Item?" CommandName="EditItem" />
                                                <telerik:GridBoundColumn  DataField="itemsku" HeaderText="ID" HeaderStyle-Width="120px" />
                                                <telerik:GridBoundColumn  DataField="itemdesc" HeaderText="Description" HeaderStyle-Width="380px" />
                                                <telerik:GridBoundColumn  DataField="itemquantity" HeaderText="Quantity" HeaderStyle-Width="50px" ItemStyle-HorizontalAlign="Right" />
                                                <telerik:GridButtonColumn ButtonType="ImageButton" HeaderText="Adjust Quantity" HeaderStyle-Width="70px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" UniqueName="EditQty" ImageUrl="~\images\Edit-32.png" CommandName="EditQty" />
                                                <telerik:GridButtonColumn ButtonType="ImageButton" HeaderText="Rename" HeaderStyle-Width="70px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" UniqueName="Rename" ImageUrl="~\images\Edit-32.png" CommandName="Rename" />
                                                
                                                <%--<telerik:GridButtonColumn ButtonType="ImageButton" HeaderText="Preview" HeaderStyle-Width="60px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" UniqueName="Preview" ImageUrl="~\images\transparent.png" />--%>
                                                <telerik:GridTemplateColumn HeaderText="Preview" HeaderStyle-Width="50px">
                                                    <ItemTemplate>
                                                        <button id="Preview" type="button" data-toggle="modal" data-target="#renderingPDF" class="previewbutton">
                                                            <img src="/images/Adobe-32.png"
                                                        </button> 
                                                    </ItemTemplate>                                                
                                                </telerik:GridTemplateColumn>
                                                
                                                <telerik:GridButtonColumn ButtonType="ImageButton" HeaderText="Download" HeaderStyle-Width="60px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" UniqueName="Download" ImageUrl="~\images\transparent.png" />
                                                <telerik:GridButtonColumn ButtonType="ImageButton" HeaderText="Delete" HeaderStyle-Width="48px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" UniqueName="DeleteItem" ImageUrl="~\images\Garbage-Closed-32.png" ConfirmText="Delete Item?" CommandName="DeleteItem" />
                                                <telerik:GridBoundColumn  DataField="PDF" Display="false" UniqueName="PDF" />
                                                <telerik:GridBoundColumn  DataField="CartContentPk" Display="false" UniqueName="CartContentPk" />
                                                <telerik:GridBoundColumn  DataField="SavePk" Display="false" UniqueName="SavePk" />
                                                <telerik:GridBoundColumn  DataField="Type" Display="false" UniqueName="Type" />
                                                <telerik:GridBoundColumn  DataField="EventOrderItemsId" Display="false" UniqueName="EventOrderItemsId" />
                                                <telerik:GridBoundColumn  DataField="EventLinkPK" Display="false" UniqueName="EventLinkPK" />
                                            </Columns>
                                        </MasterTableView>
                                    </telerik:RadGrid>

  Private Sub RadGridMaterials_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridMaterials.ItemDataBound
            Try
                If TypeOf e.Item Is GridDataItem Then

                    Dim dataItem As GridDataItem = TryCast(e.Item, GridDataItem)
 '----------------------------------------------------------------------------------------------

                    'Dim btnPreview As button = TryCast(dataItem("Preview").Controls(0), button)
                    Dim btnPreview As HtmlButton = New HtmlButton
                    ' Try
                    btnPreview = CType(dataItem.FindControl("Preview"), HtmlButton)
                    'Catch ex1 As Exception
                    'LogException(New Exception("Define Button Preview" & ex1.Message.ToString))
                    'End Try

                    Try
                        If dataItem("PDF").Text = "&nbsp;" Or dataItem("CartContentPk").Text = "&nbsp;" Then
                            'btnPreview.Enabled = False
                            'btnPreview.ImageUrl = "~\images\transparent.png"
                            btnPreview.Visible = False
                        Else
                            'btnPreview.ImageUrl = "~\images\Adobe-32.png" 'Stuffed_Folder.png"
                            'btnPreview.Enabled = True
                            'btnPreview.ToolTip = dataItem("ItemSKU").Text
                            btnPreview.Visible = True
                            'btnPreview.OnClientClick = "window.open('" & dataItem("PDF").Text & "','','')"
                        End If
                    Catch ex As Exception
                        LogException(ex)
                    End Try

                    '----------------------------------------------------------------------------------------------
                End If

            Catch ex As Exception
                lblErrMessage.Text = ex.ToString
            End Try
        End Sub


Vasko
Telerik team
 answered on 20 Jun 2024
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?