Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
54 views
AutoCompleteBox loses its highlighting when the itemsource collection changes. To reproduce this issue type in the AutoCompleteBox and while it’s active and the popup is open, trigger a collection change event. The highlighting will automatically disappear, now if the collection changes again the highlighting reappears. This keeps toggling back and forth.

Attached is the screenshot.

Below are the code snippets.

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using Telerik.Windows.Controls;
 
namespace HighlightMatchingItemsText
{
    public class Country
    {
        public string Name { get; set; }
        public string Capital { get; set; }
    }
 
    public class ViewModel : ViewModelBase
    {
        private ObservableCollection<Country> countries;
 
        public ViewModel()
        {
            this.Countries = new ObservableCollection<Country>()
            {
                new Country() { Name = "Australia", Capital = "Canberra" },
                new Country() { Name = "Bulgaria", Capital = "Sofia" },
                new Country() { Name = "Canada", Capital = "Ottawa" },
                new Country() { Name = "Denmark", Capital = "Copenhagen" },
                new Country() { Name = "France", Capital = "Paris" },
                new Country() { Name = "Germany", Capital = "Berlin" },
                new Country() { Name = "India", Capital = "New Delhi" },
                new Country() { Name = "Italy", Capital = "Rome" },
                new Country() { Name = "Norway", Capital = "Oslo" },
                new Country() { Name = "Russia", Capital = "Moscow" },
                new Country() { Name = "Spain", Capital = "Madrid" },
                new Country() { Name = "United Kingdom", Capital = "London" },
                new Country() { Name = "United States", Capital = "Washington, D.C." },
            };
 
            var o = System.Reactive.Linq.Observable.Start(() =>
            {
                //starts on a background thread.
                while (true)
                {
                    Thread.Sleep(6000);
                    this.Countries = new ObservableCollection<Country>()
                    {
                        new Country() { Name = "Australia", Capital = "Canberra" },
                        new Country() { Name = "Bulgaria", Capital = "Sofia" },
                        new Country() { Name = "Canada", Capital = "Ottawa" },
                        new Country() { Name = "Denmark", Capital = "Copenhagen" },
                    };
                    Console.WriteLine("Collection Changed");
                }
            });
 
        }
 
         public ObservableCollection<Country> Countries
        {
            get { return this.countries; }
            set
            {
                if (this.countries != value)
                {
                    this.countries = value;
                    this.OnPropertyChanged(() => this.Countries);
                }
            }
        }
    }
}

<UserControl x:Class="HighlightMatchingItemsText.Example"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:local="clr-namespace:HighlightMatchingItemsText"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300" Width="300">
    <UserControl.DataContext>
        <local:ViewModel />
    </UserControl.DataContext>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock Text="Type A in the autocomplete box, Australia gets highlighted. Keep the drop down open and wait for 6 seconds, the collection changes and the highlighting dissappears.
                   Wait for another 6 seconds, the collection changes and the highlighting reappaers. This keeps toggling. "
                   TextWrapping="Wrap"
                   FontWeight="Bold"
                   Margin="20"/>
        <telerik:RadAutoCompleteBox x:Name="AutoComplete"
                                    Grid.Row="1"
                                    Margin="20"
                                    ItemsSource="{Binding Countries}"
                                    TextSearchPath="Name"
                                    TextSearchMode="Contains"
                                    AutoCompleteMode="Suggest"
                                    >
        </telerik:RadAutoCompleteBox>       
    </Grid>
</UserControl>


Vladi
Telerik team
 answered on 17 Oct 2014
1 answer
112 views
Hello,

I'm trying to get the value of a GridBoundColumn of a row after I've hit the "edit" button for that particular row.  The reason I want to do this is because I have several RadComboBoxes that need to have its values preselected after I get the datasource and the databind done for each combo box.  Is there a way to do this, or is there another event after the ItemCreate command where I can set the SelectValue of a RadComboBox?
Eyup
Telerik team
 answered on 17 Oct 2014
1 answer
70 views
In my Ragdrid, on click of Add New record, I added a template with a textbox and a button. In the textbox, after typing first 4 letters of a name, it should give matching name suggestions just like google does. For this purpose, in the onPrerender of the user control which contains the text box and button, I have added 
  
 AjaxControlToolkit.ToolkitScriptManager.RegisterClientScriptBlock(this, typeof(string), this._TbName.ClientID, "NameSearch('" + this._TbName.ClientID +"');", true);


But the NameSearch method is never called. Whereas, if the text box is placed outside the radgrid, this method is called!
Is there some other approach which needs to be used when this is being done in the add new record template?
Radoslav
Telerik team
 answered on 17 Oct 2014
1 answer
89 views
My problem is that when I try to filter a table based on a value in RadComboBox, no event is fired. In order to even click on the combo box, its necessary to set the RenderMode of the combo box to native or else you cannot click the combo box. Any suggestions?                 

      <FilterTemplate>
                                <telerik:RadComboBox ID="radComboBoxLastName" DataSourceID="TeacherLastNameDDL" DataTextField="TeacherLastName" DataValueField="TeacherLastName"
                                    AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("TeacherLastName").CurrentFilterValue %>'
                                    runat="server" MaxHeight="200px" RenderMode="Native" OnClientSelectedIndexChanged="TeacherLastNameChanged" AutoPostBack="true">
                                    <Items>
                                        <telerik:RadComboBoxItem Text="All" Selected="true" />
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                    <script type="text/javascript">
                                        function TeacherLastNameChanged(sender, args) {
                                            var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                            tableView.filter("TeacherLastName", args.get_item().get_value(), "EqualTo");
                                        }
                                    </script>
                                </telerik:RadScriptBlock>
                            </FilterTemplate>



Pavlina
Telerik team
 answered on 16 Oct 2014
1 answer
186 views
Hi,

We have a small issue when focus is set on a RadNumericTextBox on the client when using Firefox.
Source:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="input.aspx.vb" Inherits="TestaTredjepartWeb.input" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="s" runat="server">
    </asp:ScriptManager>
    <div>
        <telerik:RadNumericTextBox ID="aa" runat="server" Value="10000000">
        </telerik:RadNumericTextBox><br /><br />
        <asp:Button ID="btnSetFocus" runat="server" Text="Set Focus" OnClientClick="$find('aa').focus(); return false;" />
    </div>
    </form>
</body>
</html>

When pressing the "Set Focus" button, the input gets focus and selects all the text.
So far everything is OK, but when clicking in the textbox after this (to edit the value at the clicked position), nothing happens (seems to select all text again).
But when clicking the texbox a second time, the expected behavior happens (all text is not selected and the cursor is at the clicked position).

This only happens in Firefox, in IE it is working as expected!

Regards
Andreas
Konstantin Dikov
Telerik team
 answered on 16 Oct 2014
7 answers
501 views
Is there any way to create a stacked bar chart without explicitly creating different series? We have a table that returns three columns; Category, Status, and a numeric value. We'd like to have the chart show each category as a stacked bar, with the status items stacked together; however, we don't know up front how many different status values will exist in the result set. The original RadChart control supported this, but we can't figure out any way to do it within the RadHTMLChart.
Danail Vasilev
Telerik team
 answered on 16 Oct 2014
1 answer
156 views
Hello,

I have configured the Telerik editor to display the RadEditorStatistic module in the toolbar.xml file (<modules>
<module name="RadEditorStatistics" dockingZone="Bottom" enabled="true" visible="true" dockable="true" />
</modules>). However, the word and character count statistics does not show up at the bottom of the editor only with the design mode setting. I need to configure both design and preview mode to enable the character and word count display. Is the prerequisite to have preview mode setting enabled to display the word and character count?

Thanks,
Chuck 
Dobromir
Telerik team
 answered on 16 Oct 2014
1 answer
79 views
HI,

I have (In a rather compex asp.net page)  a grid inside an asp.net Panel .
The hierachy look like that:

...
<telerik:RadMultiPage  runat="server" ID="xxx" SelectedIndex="0" Height="100%" Width="100%">
<telerik:RadPageView  ID="xxx" runat="server" Height="100%" >
<telerik:RadAjaxPanel  ID="xxxl" runat="server"  Height="100%" Width="100%" LoadingPanelID="xxx">
<telerik:RadGrid  ID="xxx" runat="server"   ../



What I want is that the grid should have a FIXED height of say 500px. If there are more rows in the grid than one can Show in the 500px grid , vertical scrollbars should be displayed.

Of course the first I tried was to set the HEIGHT of the grid to height="500". Unfortunately this property has (in my case) no effect of the height of the grid.

What I currently get is that the height of the grid is determined by the number of rows that gets bound to the grid. If there are e.g. many rows bound to the grid the height of the grid is very very heigh, regardless of the height I set via the height property.

What am I doig wrong ? How can I force the grid to have a FIXED height of say 500 px asnd force the grid to Display vertical scrollbars if necessary ??

Hope one can help.

Best regards
Hans-Juergen 



Galin
Telerik team
 answered on 16 Oct 2014
1 answer
85 views
Dear Admin,
I am using RadGanttChart in one of my project I have large amount of filed in my Task table is there is way we can give edit button in RadGanttChart and redirect to edit task page or some how display popup to edit task other fileds?

Regards,
Shakti
Hristo Valyavicharski
Telerik team
 answered on 16 Oct 2014
8 answers
1.1K+ views
Hello, all.

I have a tricky dynamic/programmatic creation issue which is I think different from any of the other ones I've been reading about here, i.e. "how do I programmatically create a column?", "how do I programmatically create a grid?" etc. I'm familiar with all the online references regarding those and have no problems there. My scenario:

  1. I have a RadGrid that is declared statically in the ASPX page.
  2. This RadGrid contains all GridBoundColumns, except for one GridTemplateColumn.
  3. In this GridTemplateColumn, I have only an empty <ItemTemplate></ItemTemplate> declared. (I also tried declaring an empty <EditItemTemplate></EditItemTemplate>, makes no difference.)
  4. Based on a condition that is only available after the RadGrid is databound (i.e. I perform a check on the contents of a column, similar to "((TextBox)gridItem["RenderHint"].Controls[0]).Text")...
  5. ...I then dynamically create a control and add it to the GridTemplateColumn (e.g. create a TextBox tb, then do something like "gridItem["Value"].Controls.Add(tb);"). I've found that since the condition is based on the data in the item, I need to do this step in ItemDataBound.

Everything I've described so far works perfectly. So here's where the trouble begins.

When it comes time to persist data back to the DB, in my ItemCommand for the RadGrid which receives the "Save" (from e.CommandName), I have a call to GridEditableItem.ExtractValues. This call to ExtractValues finds and pulls data for every other column (which is in edit mode at any rate), except for my GridTemplateColumn! As described above, this is the column where I am dynamically instantiating and adding a control.

If I perform the instantiation and addition earlier as a test (e.g. Page_Init), then of course the control is found - but my condition which is based on data is not yet available. In other words, even though I would love to build the grid programmatically in Page_Init, I can't do so because I don't know what kind of control I need to instantiate that early!

Ideas please? Regards,

Allen

Chris
Top achievements
Rank 1
 answered on 16 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?