Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
123 views
How can I set width of textbox, dropdown in edit mode while batch editing?
This code is not working :
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))
            {
                GridEditFormItem editItem = (GridEditFormItem)e.Item;
                TextBox txtbx = (TextBox)editItem["LVL"].Controls[0];
                txtbx.Width = Unit.Pixel(20);
            }
        }
I dont want to have half of textbox visible, example in attachment.


Jacek
Top achievements
Rank 1
 answered on 17 Oct 2014
7 answers
83 views
I'm using version 2013.3.1114.40 of the Telerik.Web.UI dll. When a user is typing in text into the RadEditor, IE8 crashes. What is the cause and what is a possible fix?

Thanks!
Marin Bratanov
Telerik team
 answered on 17 Oct 2014
1 answer
99 views
Hi guys,
I am using Telerik version 2014 Q1. I have a menu items with sub items, you can check attached image.
I want to set a value to the variable when I clicked on particular SubItem. There is load event, I tried to do, but its not working out.
Can anybody please let me know how to set a value to the variable when click on subitem.

Thanks in advance.

Nencho
Telerik team
 answered on 17 Oct 2014
1 answer
68 views
Hi,

We have to grids on a page that when on the update/insert command event, if the validation code finds an error, it adds an exclamation mark image to GridEditCommandColumn along with a corresponding tooltip to let the user know what the error was and where. It works perfectly in the top grid, which is essentially a parent grid for the one below it. The code below is showing how the validation/error works for both grids:

 protected void FundGrid_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            Telerik.Web.UI.GridEditableItem editedItem = e.Item as Telerik.Web.UI.GridEditableItem;

            Hashtable newValues = new Hashtable();
            editedItem.ExtractValues(newValues);

            Decimal grndkey = (Decimal)GroundGrid.MasterTableView.DataKeyValues[GroundGrid.SelectedItems[0].ItemIndex][GroundCardColumn.GroundId.ToString()];
            newValues[GroundFundingColumn.GroundId.ToString()] = grndkey;

            List<String> errorlist = new List<string>();
            GroundFunding gf = null;
            e.Canceled = !((IGroundCardTask)ServiceManager).UpdateFunding(this.UserContext, ref gf, newValues, errorlist);
            if (e.Canceled)
                showGridRowUpdateError(editedItem, errorlist);
            else
            {
                if (errorlist.Count > 0)
                {
                    handleFundingStatusChangedNotification(gf.GroundId, errorlist);
                }
            }
        }

And the following code is how the edit item and error list are displayed to the customer:

 private void showGridRowUpdateError(Telerik.Web.UI.GridEditableItem editItem, List<String> errors)
        {
            //
            TableCell cmdCell = ((Telerik.Web.UI.GridDataItem)editItem)["Cmd"];

            Image img = new Image();
            img.ID = "ErrorImage";
            img.ImageUrl = "~/Images/ErrorAlertSmall.gif";
            img.CssClass = "ErrorAlertPopup";

            cmdCell.Controls.Add(img);

            BulletedList bulletList = new BulletedList();
            bulletList.ID = "ErrorList";
            bulletList.CssClass = "ErrorBulletList";

            foreach (String sMessage in errors)
            {
                bulletList.Items.Add(new ListItem(sMessage));
            }

            ErrorToolTip.TargetControlID = img.ClientID;
            ErrorToolTip.IsClientID = true;
            ErrorToolTip.Controls.Add(bulletList);
            ErrorToolTip.Show();
        }

For some reason, this does not work on on the bottom Funding Grid. Works perfectly everywhere else in the solution, but not here. The grid is marked up as follows:

<telerik:RadGrid ID="FundGrid" runat="server"
                                AutoGenerateColumns="False"
                                GridLines="None"
                                Width="740px"
                                onneeddatasource="FundGrid_NeedDataSource"
                                onitemdatabound="FundGrid_ItemDataBound"
                                OnItemCreated="FundGrid_ItemCreated"
                                ondeletecommand="FundGrid_DeleteCommand"
                                oninsertcommand="FundGrid_InsertCommand"
                                onupdatecommand="FundGrid_UpdateCommand"
                                OnDataBound="FundGrid_DataBound"
                                AllowMultiRowEdit="false"
                                Enabled="false"
                                EnableLinqExpressions="false">
                      <MasterTableView Caption="Funding Data for Ground Card: " EditMode="InPlace" ShowFooter="True" DataKeyNames="GroundId,FundingOrdBy" Width="740px">
                                    <RowIndicatorColumn>
                                        <HeaderStyle Width="20px" />
                                    </RowIndicatorColumn>
                                    <ExpandCollapseColumn>
                                        <HeaderStyle Width="20px" />
                                    </ExpandCollapseColumn>
                                    <Columns>
                                        <telerik:GridEditCommandColumn UniqueName="cmd" CancelText="Go Bac" EditText="Edit" InsertText="Insert"
                                            UpdateText="Update" ButtonType="ImageButton">
                                            <HeaderStyle Width="50px" />
                                        </telerik:GridEditCommandColumn>
                                        <telerik:GridBoundColumn HeaderText="Ground Id" DataField="GroundId" UniqueName="GroundId" ReadOnly="true" Visible="false">
                                            <HeaderStyle Width="100px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn HeaderText="Receiver Cost Ctr" DataField="ReceiverCostCtr" UniqueName="ReceiverCostCtr" MaxLength="10">
                                            <HeaderStyle Width="110px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn HeaderText="Receiver Network" DataField="ReceiverNetwork" UniqueName="ReceiverNetwork" MaxLength="24">
                                            <HeaderStyle Width="150px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn HeaderText="Receiver Activity" DataField="ReceiverOperation" UniqueName="ReceiverOperation" MaxLength="8">
                                            <HeaderStyle Width="110px" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridNumericColumn HeaderText="Hours" DataType="System.Decimal" Aggregate="Sum" FooterText=" " DataField="Hrs" DataFormatString="{0:F1}" UniqueName="Hrs" MaxLength="5">
                                            <HeaderStyle Width="40px" />
                                        </telerik:GridNumericColumn>
                                    </Columns>
                                </MasterTableView>
                                <ClientSettings>
                                    <Selecting AllowRowSelect="True" />
                                    <Scrolling AllowScroll="True" ScrollHeight="90px" UseStaticHeaders="True" />
                                    <ClientEvents OnRowContextMenu="FundingRowContextMenu" OnRowDblClick="RowDblClick" />
                                </ClientSettings>
                            </telerik:RadGrid>

Any help at all would be appreciated. Been struggling with this for several days and have not been able to add/clear any of the controls on the grid column.

Thanks,

- Joe
Eyup
Telerik team
 answered on 17 Oct 2014
2 answers
86 views
Hi Everyone,

I ran into a problem and was wondering if anyone have a solution.  I created a Radgrid, populate the grid with an EntityDataSource with Automatic CRUD. Everything works great expect I notice a huge paging issue.  If my PageSize="5" and I have 6 records which will give me two pages.  If I go to page 2 and delete the 6th row/item the RadGrid  show the grid as empty. It doesn't go to page 1 and display the remaining 5 rows. If I hit the refresh button on the grid, still not working.  I have to reload the page before it display the 5 record in the grid.  I try putting the grid in a RadAjaxPanel, still no luck.  If I used SqlDataSource, it work fine without any problems.  Is there something that I'm missing?

Anthony
Viktor Tachev
Telerik team
 answered on 17 Oct 2014
1 answer
206 views
Hi, 
I am using "UI for ASP.Net AJAX Q2 2014", Telerik.Web.UI.dll version is 2014.2.618.45, Visual studio 2013 and developing a website.
One of my requirement is to display pdf file with Agree/Do not Agree buttons. 
I am thinking to display pdf file contents in RadEditor ( editing disabled ).
I have pdf file stored into SQL Server database field and I am reading from database and converting to byte[].
Now I want to assign this byte[] to RadEditor so that it displays pdf text as it is with formatting. 
Can you tell me how should I assign byte[] to RadEditor to display that text? 

I will disable editing to it will just look like text, and will provide Agree/Do not agree button so I can capture button click and go accordingly. 
I will be putting this RadEditor in a webform, with above buttons, and will open up that form as Modal form using RadWindow, so user will need to click Agree to continue process. 

Thanks in advance, 


Marin Bratanov
Telerik team
 answered on 17 Oct 2014
2 answers
40 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
106 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
66 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
80 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
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?