Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
102 views
How can I combine two display members in a GridDropDownColumn. For example my table has a column Item_Id. The item table has a Make and Model field. I want my combobox to display Make-Model.
Viktor Tachev
Telerik team
 answered on 17 Mar 2015
3 answers
160 views
I reviewed this example: http://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/columns/column-types/defaultcs.aspx and cannot seem to replicate this in my application.

                <telerik:GridDropDownColumn DataField="Item_Id" DataType="System.Int32" FilterControlAltText="Filter Item_Id column" HeaderText="Item"  UniqueName="Item_Id" AutoPostBackOnFilter="true" DataSourceID="EntityDataSourceItem" ListValueField="Id"  ListTextField="Model" AllowVirtualScrolling="true" ShowMoreResultsBox="true" ItemsPerRequest="10" SortExpression="Item_Id" EmptyListItemText="Select" AllowAutomaticLoadOnDemand="true" DropDownControlType="RadComboBox" >
                </telerik:GridDropDownColumn>
 
<asp:EntityDataSource ID="EntityDataSourceItem" runat="server" ConnectionString="name=autocalEntities" DefaultContainerName="autocalEntities" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="items"></asp:EntityDataSource>

Everything populates correctly on load but when I attempt to edit and retrieve a filtered list from the gridview i get the object reference not set to an instance of an object exception. Any idea what I am missing? 

Thanks,
Josh
Maria Ilieva
Telerik team
 answered on 17 Mar 2015
6 answers
468 views
I have a grid with a GridDateTimeColumn. I do InPlace editing on the grid. I need to validate that the date entered is a valid date. I can't see to determine how to do this. I tried the RequiredFieldValidator, but that doesn't work correctly. If I enter an invalid date, and click the update button, the date field gets the red box around it and the grid goes out of edit mode and reverts rebinds.

How can I flag the invalid date, notify the user the date is invalid and keep the grid in edit mode?

This is my grid.

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"
      AllowSorting="True" DataSourceID="Datasource"
      AllowAutomaticUpdates="true" AllowAutomaticInserts="true"
      AllowAutomaticDeletes="true" ShowFooter="true"
      Skin="Forest" PageSize="100"
      OnItemCommand="RadGrid1_ItemCommand"
      CellSpacing="0" GridLines="None">
      <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true"></Scrolling>
      </ClientSettings>
 
        <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" DataKeyNames="ID"
           AllowAutomaticUpdates="true" AllowAutomaticInserts="true"
           AllowAutomaticDeletes="true"  DataSourceID="Datasource"
           CommandItemDisplay="Top">
            <CommandItemTemplate>
                <div style="padding: 5px 5px;">
                        <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# Not RadGrid1.MasterTableView.IsItemInserted%>'><img style="border:0px;vertical-align:middle;" alt="" src="../Images/AddRecord.gif"/>Add new description</asp:LinkButton>  
                        <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../Images/Insert.gif"/>Add this description</asp:LinkButton>  
                        <asp:LinkButton ID="LinkButton7" runat="server" CommandName="CancelAll" Visible='<%# RadGrid1.MasterTableView.IsItemInserted%>'><img style="border:0px;vertical-align:middle;" alt="" src="../Images/Cancel.gif"/>Cancel</asp:LinkButton>  
                        <asp:LinkButton ID="LinkButton1" runat="server" CommandName="EditSelected" Visible='<%# RadGrid1.EditIndexes.Count = 0%>'><img style="border:0px;vertical-align:middle;" alt="" src="../Images/Edit.gif"/>Edit this description</asp:LinkButton>  
                        <asp:LinkButton ID="LinkButton5" runat="server" CommandName="UpdateEdited" Visible='<%# RadGrid1.EditIndexes.Count > 0%>'><img style="border:0px;vertical-align:middle;" alt="" src="../Images/Update.gif"/>Update this description</asp:LinkButton>  
                        <asp:LinkButton ID="LinkButton6" runat="server" CommandName="CancelAll" Visible='<%# RadGrid1.EditIndexes.Count > 0%>'><img style="border:0px;vertical-align:middle;" alt="" src="../Images/Cancel.gif"/>Cancel</asp:LinkButton>  
                        <asp:LinkButton ID="LinkButton8" OnClientClick="javascript:return confirm('Deactivate selected description?')" runat="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="../Images/Delete.gif"/>Deactivate selected description</asp:LinkButton>  
                        <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="../Images/Refresh.gif"/>Refresh description display</asp:LinkButton>
                </div>
            </CommandItemTemplate>
 
            <SortExpressions>
                <telerik:GridSortExpression FieldName="DateHoliday" SortOrder="Ascending" />
            </SortExpressions>
            <Columns>
                <telerik:GridBoundColumn DataField="ID"  UniqueName="ID" Visible="false" ReadOnly="true" />
                <telerik:GridBoundColumn DataField="Description" HeaderText="Description" UniqueName="Description"/>
                <telerik:GridDateTimeColumn DataField="DateHoliday" HeaderText="Date of Holiday" UniqueName="DateHoliday" PickerType="DatePicker" DataFormatString="{0:MM/dd/yyyy}" >
                    <ColumnValidationSettings EnableRequiredFieldValidation="true" >
                        <RequiredFieldValidator runat="server" ErrorMessage="Please enter a valid date."></RequiredFieldValidator>
                    </ColumnValidationSettings>
                </telerik:GridDateTimeColumn>
                <telerik:GridDateTimeColumn DataField="TimeOpen" HeaderText="Opening time" UniqueName="TimeOpen" PickerType="TimePicker" DataFormatString="{0:t}" />
                <telerik:GridDateTimeColumn DataField="TimeClosed" HeaderText="Closing Time" UniqueName="TimeClosed" PickerType="TimePicker" DataFormatString="{0:t}"/>
                <telerik:GridCheckBoxColumn DataField="Active" UniqueName="Active" HeaderText="Active" />
            </Columns>
        </MasterTableView>
        <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
            <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
        </ClientSettings>
         
    </telerik:RadGrid>
Konstantin Dikov
Telerik team
 answered on 17 Mar 2015
7 answers
164 views
Hello,

I have a strange problem here. I have a grid where some rows are selectable and some are not based on certain criteria. The user can execute different queries to produce different results, which in-turn produces different unselectable rows. The problem is, the unselectableItemsIndex in the grid's client state is not staying in sync. The rows that were unselectable in the previous query become unselectable in the new result set. This problem seems to compound itself with each new query. In other words, it seems the unselectableItemsIndex array is just appended to.

Oh, this is all happening via AJAX.

Any help would be appreciated.

Blair
Angel Petrov
Telerik team
 answered on 17 Mar 2015
1 answer
85 views
Hi

RadTreeView OnNodeClick IE11 error event Fires unnecessary multiple times without the user clicking on the node. But in IE9, Chrome and firefox it works fine. Any suggestions?

<telerik:RadTreeView ID="xyz" runat="server" DataFieldID="Key" 
                                    DataFieldParentID="ParentKey" DataTextField="TreeName" DataValueField="Key" 
                                    OnClientNodeClicking="treeViewMiningEquipment_ClientClickHanlder"
                                    OnClientLoad="treeViewMiningEquipment_Load"
                                    OnNodeClick="treeViewMiningEquipments_NodeClick"
                                    >
Ivan Danchev
Telerik team
 answered on 17 Mar 2015
4 answers
152 views
Hi
I have a scheduler using the advanced template for edit & insert.
The End Date is set programmatically.
I want to hide the End Date input entirely (date picker, time picker and label) on both the edit and insert forms.
I am using this method to hide the all day checkbox and I can also hide the End Date picker using this method but the time picker and the End date label still appears on the Edit form.
I want to hide all controls for End Date Input on both Edit & Insert forms.
Thanks in advance
Chris

Protected Sub RadScheduler1_FormCreated(sender As Object, e As Telerik.Web.UI.SchedulerFormCreatedEventArgs)
    If (e.Container.Mode = SchedulerFormMode.AdvancedEdit) OrElse (e.Container.Mode = SchedulerFormMode.AdvancedInsert) Then
        Dim allDayCheckBox As CheckBox = DirectCast(e.Container.FindControl("AllDayEvent"), CheckBox)
        allDayCheckBox.CssClass = "Hide"
         
        Dim endDate As RadDatePicker = DirectCast(e.Container.FindControl("EndDate"), RadDatePicker)
        endDate.CssClass = "Hide"
 
        Dim startDate As RadDatePicker = TryCast(e.Container.FindControl("StartDate"), RadDatePicker)
        startDate.ClientEvents.OnDateSelected = "changeEndDate"
         
    End If
End Su
Ivan Danchev
Telerik team
 answered on 17 Mar 2015
1 answer
276 views
Hi,
in few words the problem is:
when i am trying to use $.event.trigger after an ajax request made with RadAjaxManager I am not able to catch the fired event in user controls.
If i put the event handler in default.aspx there is no problem and the event is "catch" but in user control the hndler is never fired...

Here my code, any suggestions? Thank you in advance...

Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
 
<%@ Register Src="~/WebUserControl1.ascx" TagPrefix="uc1" TagName="WebUserControl1" %>
 
 
<!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>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
        function onResponseEnd(sender, eventArgs) {
            console.log("response end");
            $.event.trigger({
                type: "myEvent",
                message: "event",
                time: new Date()
            });
        }
    </script>
        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1"></telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <ClientEvents OnResponseEnd="onResponseEnd"></ClientEvents>
        <AjaxSettings>           
            <telerik:AjaxSetting AjaxControlID="ButtonAddItem">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadListViewClips" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <div>
        <telerik:RadButton ID="ButtonAddItem" runat="server" Text="Add item" OnClick="OnRadButtonClick"></telerik:RadButton>
        <telerik:RadListView ID="RadListViewClips" AllowPaging="True" runat="server" Visible="True" OnNeedDataSource="RadListViewClipsOnNeedDataSource"
                allowsorting="true" ItemPlaceholderID="placeHolder" DataKeyNames="Id">
             <%-- <ClientSettings>
                  <ClientEvents OnListViewCreated="test"></ClientEvents>
              </ClientSettings>--%>
                  <LayoutTemplate>                                                               
                        <div id="placeHolder" runat="server">
                            <ul></ul>
                        </div>
                </LayoutTemplate>
                <ItemTemplate>
                    <li>
                       <%# Eval("Name") %><uc1:WebUserControl1 runat="server" id="WebUserControl1" />
                    </li>
                </ItemTemplate>
 
            </telerik:RadListView>
    </div>
    </form>
</body>
</html>

Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
 
public partial class Default : System.Web.UI.Page
{
    private List<ItemState> CurrentDockStates
    {
        get
        {
            //Store the info about the added docks in the session. For real life
            // applications we recommend using database or other storage medium
            // for persisting this information.
            List<ItemState> currentDockStates = (List<ItemState>)Session["CurrentDockStatesMyPortal"];
            if (Equals(currentDockStates, null))
            {
                currentDockStates = new List<ItemState>();
                Session["CurrentDockStatesMyPortal"] = currentDockStates;
            }
            return currentDockStates;
        }
        set { Session["CurrentDockStatesMyPortal"] = value; }
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            RadListViewClips.DataSource = CurrentDockStates;
            RadListViewClips.DataBind();
        }
    }
 
    protected void RadListViewClipsOnNeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
    {
        RecreateItems();
    }
 
    private void RecreateItems()
    {
        var source = CurrentDockStates;
        RadListViewClips.DataSource = source;       
    }
 
    protected void OnRadButtonClick(object sender, EventArgs e)
    {
        CurrentDockStates.Add(new ItemState
            {
                Name = "Prova",
                Id = CurrentDockStates.Count
            });
        RadListViewClips.Rebind();
    }
}
 
internal class ItemState
{
    public string Name { get; set; }
    public int Id { get; set; }
}

WebControl.ascx --- Here function myEventHandler is never Fired!!!
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="TelerikWebApp1.WebUserControl1" %>
<script>
    $(document).on("myEvent", myEventHandler);
 
    function myEventHandler(e) {
        console.log("myEvent on: usercontrol");
}
</script>

Maria Ilieva
Telerik team
 answered on 17 Mar 2015
1 answer
69 views
Hi,

I have Shown the filter icon in the UI so that user can select their preferred filter condition and filter RadGrid. Rad grid filter is working perfectly for me But it is not working for '<' and '>' symbols. After giving these symbols when i hit 'ENTER', text box is flushed out and nothing happens with the grid. I have two columns which has these symbols so i need filter option to work for these columns.

Please suggest the ways by which i can achieve it.

Thanks
Abhishek
Eyup
Telerik team
 answered on 17 Mar 2015
4 answers
238 views
Hi,

I'm currently trying to implementing a rad grid with in line batch editing.

I have a GridDateTimeColumn with an associated RequiredFieldValidator

If I leave the datepicker empty and select to add a new row to the table the validator is not firing as expected. Therefore I am incorrectly able to add multiple rows with no date entered
Note that required field validators on other columns are firing correctly in this instance. it only appears to be an issue with the date picker


If however I enter a date in the date picker, and then remove it, the validator is firing  and I cannot add a new row (as expected)
Further to this if I re-enter the date, select to add a new row and then try to add an additional row without entering a date then the validator is firing in this scenario

Have you any advice on how the required field validator should be implemented to fire when adding a new row??

below is my column definition

<telerik:GridDateTimeColumn DataField="Date" HeaderStyle-Width="135px" HeaderText="Date" ColumnEditorID="dateEditor" 
 
                        SortExpression="Date" UniqueName="Date" PickerType="DatePicker" >
                        <ColumnValidationSettings EnableRequiredFieldValidation="True"  >
                            <RequiredFieldValidator  ForeColor="Red" ErrorMessage="This field is required"  ID="reqDateVal" ></RequiredFieldValidator
                        </ColumnValidationSettings
                     </telerik:GridDateTimeColumn>
 

Kostadin
Telerik team
 answered on 17 Mar 2015
6 answers
547 views
I have a problem with the OnTextChanged event of the RadComboBox. The combobox looks like this:

<telerik:RadComboBox ID="RadCB"  runat="server" Width="130px" AutoPostBack="true" OnTextChanged="RadCB_TextChanged" CheckBoxes="true" EnableCheckAllItemsCheckBox="true" Localization-CheckAllString="(All)" EmptyMessage="Select" CheckedItemsTexts="FitInInput" DropDownWidth="210px" MaxHeight="400px">
</telerik:RadComboBox>

It has some default values selected on page load. Then I change the values of a different combobox and click the search button.

Somehow the OnTextChanged event of the combobox above is fired even though the text and the selected values have NOT changed, which causes the values of the second combobox to be changed again. Is this the designed behavior?

Ajax is enabled on the page and both comboboxes are in the AjaxControls of the button.

Any help will be appreciated.
Ivan Danchev
Telerik team
 answered on 17 Mar 2015
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?