Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
92 views

Is there any way to sort nodes based on hierarchyid?

currently default sorting based on alphabetical order.

 

Thanks in advance

Hari
Top achievements
Rank 1
 asked on 28 Jan 2022
0 answers
95 views

Hello,

I have a form to show/update Staff information. There is a  RadComboBox (CheckBoxes =True,  DataSourceID = "sds_multiSites", DataTextField = "Site", DataValueField = "idSite"), that Iist all the Sites in our organization.

When the form loads, I read a table where I find the Staff-MultiSitesSelected. I read all the Sites where the staff works and I check this sites in the RadComboBox. I sort the RadComboBox by the TextValue, using rcb_multiSites.SortItems(New SortCheckedComboItemsFirst()), and this function let me keep the checked items at the top of the list.

Problem: When updating the combo selection, unchecking some items (that are at the top) and selecting new items. After the refresh, the new checked items are wrong even if I don't sort again. The selected index is wrong because is counting the old-checked items that were at the top.

 Any suggestions?

cc

ASP.NET

<telerik:RadComboBox ID="rcb_multiSites" Runat="server" DataSourceID="sds_multiSites" DataTextField="Site" DataValueField="idSite"    CheckBoxes = "True" EnableCheckAllItemsCheckBox = "true" AutoPostBack = "false" ></telerik:RadComboBox>          

VB.NET read the selection from a table and check the selected items in the combo

  Private Sub create_new_employee_SaveStateComplete(sender As Object, e As EventArgs) Handles Me.SaveStateComplete
        Dim i As Integer ' event launched after load form

        If Not IsPostBack Then
            Dim conn3 As String = DirectCast(ConfigurationManager.ConnectionStrings("HR_ConnStr").ConnectionString, String)
            Dim queryStr3 As String = "SELECT * FROM StaffSites WHERE IDPerson = @IDPerson ORDER BY Name"

            Using myConnection3 As New SqlConnection(conn3)
                Dim myCommand3 As New SqlCommand(queryStr, myConnection3)
                myConnection3.Open()
                myCommand3.Parameters.AddWithValue("@IDPDSProfilesPerson", IDPDSProfilesEmployee)
                Dim MyReader3 As SqlDataReader = myCommand3.ExecuteReader

                If MyReader3.HasRows Then
                    While (MyReader3.Read())
                        Dim idSite As String = MyReader3("IDSite")
                        Dim indexItem As Integer =  rcb_multiSites.FindItemIndexByValue(idSite)
                        rcb_multiSites.Items(indexItem).Checked = True
                    End While
                    rcb_multiSites.Sort = RadComboBoxSort.Ascending
                    rcb_multiSites.SortItems(New SortCheckedComboItemsFirst())
                    rcb_multiSites.AllowCustomText = True
                End If
            End Using
        End If
    End Sub

This function sort the list and keeps the checked Items at the top. The function is from a sample in this website

VB.NET

   Public Class SortCheckedComboItemsFirst
        Implements IComparer
        Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements IComparer.Compare
            Dim p1 As New RadComboBoxItem()
            Dim p2 As New RadComboBoxItem()

            If TypeOf x Is RadComboBoxItem Then
                p1 = TryCast(x, RadComboBoxItem)
            Else
                Throw New ArgumentException("Object is not of type RadComboBoxItem.")
            End If

            If TypeOf y Is RadComboBoxItem Then
                p2 = TryCast(y, RadComboBoxItem)
            Else
                Throw New ArgumentException("Object is not of type RadComboBoxItem.")
            End If

            Dim cmp As Integer = 0

            If p1.Checked Then

                If p2.Checked = False Then
                    Return -1
                    'uncomment for skipping the sorting of the checked items
                    'Else 'this line
                    ' Return 1 'this line
                End If
            ElseIf p2.Checked Then
                Return 1
            End If

            If p1.ComboBoxParent.Sort = RadComboBoxSort.Ascending Then
                'here we compare the Values of the items
                'cmp = [String].Compare(p1.Value, p2.Value, Not p1.ComboBoxParent.SortCaseSensitive)
                cmp = [String].Compare(p1.Text, p2.Text, Not p1.ComboBoxParent.SortCaseSensitive)
            End If
            If p1.ComboBoxParent.Sort = RadComboBoxSort.Descending Then
                'here we compare the Values of the items
                'cmp = [String].Compare(p1.Value, p2.Value, Not p1.ComboBoxParent.SortCaseSensitive) * -1
                cmp = [String].Compare(p1.Text, p2.Text, Not p1.ComboBoxParent.SortCaseSensitive) * -1
            End If
            Return cmp
        End Function
M
Top achievements
Rank 2
 updated question on 27 Jan 2022
1 answer
135 views

Hi,

My main thread is  "Check All" feature is not working as expected with Load On Demand

As there is limitation on LoadOnDemand feature in RadComboBox control, as a workaround I used RadMultiSelect with Virtualization.

But when I add the below line it showing console error.

<VirtualSettings ItemHeight="26" ValueMapper="valueMapper" />

As you requested in main thread I am attaching current implementation to investigate the problem. 

Attaching relevant files for your reference since full project can't upload due to max size exceed.

Highly appreciate your quick response.

Thanks

Chandi

 

 

Attila Antal
Telerik team
 answered on 27 Jan 2022
1 answer
150 views

My team is using Telerik.UI.for.AspNet.Ajax.Net45 v 2020.3.1021. Due to having some clients on unsupported browsers, we need to redirect them to an older page that is compatible for them.

Do you offer any built-in functionality to determine if a Telerik control on a page is supported in the user's browser?

Vessy
Telerik team
 answered on 26 Jan 2022
1 answer
84 views

Regardless of browser, when you zoom out to text size 80% or less the text in the RadPanelBar disappears. 

Is there a way to make the text visible regardless of the zoom level?

/POE

Vessy
Telerik team
 answered on 26 Jan 2022
1 answer
172 views

I'm using the RadMap to show states of the USA.

layers[0] is Bing.
layers[1] contains a shape for every US state/territory.
layers[2-53] contain the counties (subdivisions) for each state/territory.

When the user clicks a state, I handle the shapeClick event to .show() the corresponding layer for the state's counties. This works fine.

Once layer 2 - 53 is shown, however, the shapeClick no longer fires when a shape in layer 1 is clicked, presumably because it is no longer "on top" and shapeClick is only fired for layer x. Is there a way to receive shapeClick events no matter which layer is "on top"?

If not, is there a way to get the data from the map's regular Click event and somehow use that to determine the shape that covers it in layer 1?

Vessy
Telerik team
 answered on 26 Jan 2022
1 answer
255 views

So in my RadGrid I have a template column that contains RadDropDownList in the EditItemTemplate.  When this is modified in a row I would like to loop through the RadGrid and modify the other RadDropDownList in the other rows.  I know how to loop through the grid but having trouble accessing the dropdown since the other rows are not in edit mode.   Using the changeCellValue(cellToUpdate, value) of the BatchEditingManager but not having any luck with updating the dropdown.  

<BatchEditingSettings EditType="Cell" />

<telerik:GridTemplateColumn HeaderText="IsBudget" UniqueName="IsBudget" SortExpression="IsBudget">
<ItemTemplate>
<asp:Label ID="lblIsBudget" runat="server" Text='<%# Eval("IsBudget") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadDropDownList ID="ddIsBudget" RenderMode="Lightweight" runat="server" DataValueField="IsBudget" >
<Items>
<telerik:DropDownListItem Text="False" Value="False" />
<telerik:DropDownListItem Text="True" Value="True" />
</Items>
</telerik:RadDropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>

Attila Antal
Telerik team
 updated answer on 26 Jan 2022
1 answer
159 views

I am using a masked text box to allow my users to enter text that also has literal text in the box for example the text box has a the literal text of "My name is : " and I want the user to enter text of a date.  Since every name is a different length  I added the small loop below.  Have not had anybody need more space.  I also set the RadMaskedTextBox to always selectAll when the field is entered.

 For i As Integer = 1 To 40
         radusertext.MaskParts.Add(New Telerik.Web.UI.FreeMaskPart())
 Next           
radusertext.SelectionOnFocus = SelectionOnFocus.SelectAll

 

Here are the issues I am having

1) The FreeMaskPart does not show any mask space holders.  This is good for the most part. when the user first enters the box and types there name all is good.  For example they enter the name "Paul"
2)  If the user leaves the text box and then re-enters it all text is selected.  The issue keeps coming where the user enters the textbox then clicks to the last char in this example the "l".  The reality is they clicked the end but they are not on the "l" they are at the end of the mask or in this example 36 charectors past the "l" 40 char of the mask - 4 char in "paul".  If they hit the backspace or the left arrow key it appears that nothing is happening even though they are moving back along the mask.   As stated in "1" above the "FreeMaskPart" option does not show any actual mask chars.

So what I need to be able to do is this:
1) not limit the mask to 40 chars but make is any lenght
2) when they re-enter the masked box and click the end of the box not have to hit the backspace or left arrow key 36 times from the example above 
3) least favorite option show an underline for the masked character. When using "New Telerik.Web.UI.FreeMaskPart()" there is no masked text indication so they at least see where the cursor is in the box

 

Any help on this would be greatly appreciated

Thanks
Paul

Doncho
Telerik team
 answered on 26 Jan 2022
1 answer
165 views

 

RadGrid, ASP.NET, Web

BackColor does not work ....in the source below.

           if (gv.Items.Count > 0)
            {
                foreach (GridDataItem item in gv.Items)
                {                    
                    if (item.Cells[2].Text == "Total")
                    {

                        item.BackColor = System.Drawing.Color.LightPink;

                        break;
                    }
                }
            }

 

Please Help Me

Doncho
Telerik team
 answered on 26 Jan 2022
1 answer
276 views

In Telerik:RadGrid , ASP.NET , Web,

<ClientSettings EnablePostBackOnRowClick="true">  
<Selecting RowClick="true" /> 
</ClientSettings>   
protected void RadGrid_ItemConmmand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "RowClick")
            {              
                var text = "";
                text += "Row was clicked";
                text += ", Index: " + eventArgs.get_itemIndexHierarchical();
                alert(text);
            }

Is the grammar correct?

Please Help Me

Doncho
Telerik team
 answered on 26 Jan 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?