Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
128 views
Hi all,
I am getting JScript error as "Microsoft JScript runtime error: 'Telerik' is undefined" while running my project.
I have just tried configuring the project  from the menu bar 'Telerik->Rad controls for asp.net ajax->configure project' and it gives me this error.
Please find below my webconfig file.I could find some threads in forum about trouble shooting for the same.But that didn't solve my issue.
I am using .net 4.0 version.Please help me on this.
<?xml version="1.0"?>
<configuration>
    <connectionStrings>
        <add name="xxx" connectionString="Data Source=xxxx;Initial Catalog=xxx;Integrated Security=False; User ID=abc; Password=xxxx;" />     
    </connectionStrings>
    <appSettings>
    <add key="Telerik.Skin" value="Default" />
    <add key="Telerik.ScriptManager.TelerikCdn" value="Enabled" />
    <add key="Telerik.StyleSheetManager.TelerikCdn" value="Enabled" />
         
         
         
    </appSettings>
    <system.web>
        <compilation debug="true" targetFramework="4.0">
            <assemblies>
                <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
                <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
                <add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></assemblies></compilation>
        <pages>
            <controls>
                <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />
            </controls>
        </pages>
        <httpHandlers>
            <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
<add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" />
<!--<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />-->
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2012.2.607.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" verb="*" validate="false" />
      <add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false" />
        </httpHandlers>
        <httpModules>
            <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" />
            <add name="RadCompression" type="Telerik.Web.UI.RadCompression" />
        </httpModules>
    </system.web>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true">
            <remove name="RadUploadModule" />
            <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode" />
            <remove name="RadCompression" />
            <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode" />
        </modules>
        <handlers>
           <remove name="ChartImage_axd" />
<add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode" />
<remove name="Telerik_Web_UI_SpellCheckHandler_axd" />
<add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode" />
<remove name="Telerik_Web_UI_DialogHandler_aspx" />
<add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode" />
<remove name="Telerik_RadUploadProgressHandler_ashx" />
<add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode" />
<remove name="Telerik_Web_UI_WebResource_axd" />
<!--<add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode" />-->
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2012.2.607.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" />
      <add name="Telerik.Web.UI.WebResource"  path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2012.2.607.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" />
        </handlers>
    </system.webServer>
   
</configuration>
Milena
Telerik team
 answered on 15 Aug 2012
6 answers
200 views
Greetings.

I have a 100% code generated RadGrid.  It's purpose in life is to interrogate and render UI to support a Code-First Entity Framework model.

During entity edits/inserts, I would like to display a RadComboBox with checkboxes (multiselect) for child entities.  For example:

Editing Company X
ComboBox shows 20 potential employees (entire universe of the Employee entity)
Employees can be selected, and the child relationship between Company -> Employee (1 to many) are updated during RadGrid save.

Getting the combobox to appear and populate itself with the list of potential choices is no problem. I'm running into trouble when saving.  I'm trying to use the same approach that I use for other custom templates associated with the grid....


public IOrderedDictionary ExtractValues(Control container)
        {
            OrderedDictionary od = new OrderedDictionary();
            foreach (RadComboBoxItem item in rcb.Items)
            {
                if (item.Checked)
                   {
                    od.Add(name.Singularize(), item.Value); // bind the selected value to the FK Id
                }
            }
            return od;
        }

This fails for a couple reasons.  1) If I select more than one checkbox, I run into an issue trying to add the same key twice.  2) More importantly, even if I only select one item, the RadGrid update process doesn't like what I'm trying to do here (complains that a property named Employee was not found in Company).  This makes sense since Employee is a related collection, and obviously I need to be doing things differently in ExtractValues (or somewhere else).... I'm just not sure what/where.

Thanks!
Mike
Pavlina
Telerik team
 answered on 15 Aug 2012
1 answer
95 views
I am changing the chart series programmatically and the data type is not numeric it is a datetime field. How do I change this value type? here is my code so far:

(it's a switch statement)

case "HOURS":
                                  sdsProjectVideos.SelectCommand = "asGetVideosByProjectIDSortHours";
                                  RadChart1.ChartTitle.TextBlock.Text = "HOURS WATCHED";
                                  sdsProjectChart.SelectCommand = "asGetVideosByProjectIDSortHoursChart";
                                  RadChart1.Series.Clear();
                                  ChartSeries chartSeries = new ChartSeries();
                                  chartSeries.Name = "Hours Watched";
                                  chartSeries.DataYColumn = "HoursWatched";
                                  RadChart1.Series.Add(chartSeries);
                                  lblHours.Font.Underline = true;
                                  break;
Ves
Telerik team
 answered on 15 Aug 2012
5 answers
248 views

I have telerik 2011.3.1305.35 -> Q3.
In a sharepoint 2010 visual webpart I have a RadTreeView control, when some particular menu options are selected I want to open radwindow(s) which has an asp:updatepanel and within which I have another radtree,radgrid,repeator, RadAynscUpload (not all in same window).
Folowing is the code I have for this requirement:
Issues I am facing currently:
1) Every time I click on any of these menu options the page is getting refreshed and then radwindow is getting opened, Can we avoid page refresh and just simple open radwindow?
2) One of these RadWindows has RadAsyncUpload (for multiple file uploads), when I select the files to be uploaded I am getting a javascript error saying 'Syntax error' but I can see the file uploaded to the control then when I click on the Upload button my code says the uploadedfiles count is zero. I know there are web.config changes to be done for radupload is that the same case for RadAsyncUpload, can you please specify those?
I have also tried asp:fileupload (even though its not multiple upload) it is uploading the documents correctly but it is closing the radwindow even though I specified trigger for the button.
Code:



protected
void rtvDocuments_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
        {
  
            RadTreeNode clickedNode = e.Node;
  
            switch (e.MenuItem.Value)
            {
               case "AddDoc":
                    LoadAllGroups(rtvGroupstoAddDocs);
                    RegisterStartupScript(RadWndwUploadDocs.ClientID);
                    break;
                case "AddExistingGroup":
                    LoadAllGroups(rtvAllGroups); //loads all the groups
                    RegisterStartupScript(winGroupBrowse.ClientID);
                    break;
                case "AddExistingDoc":
                    LoadAllDocuments(); //loads all docs in grid
                    RegisterStartupScript(RadWndwAllDocs.ClientID);
                    break;
                //Other Cases here
             }
  
private void RegisterStartupScript(string RadControlId)
        {
            string script = string.Empty;
            script = "function f(){$find(\"" + RadControlId + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }
  
//If files uploaded and on upload button click, submit the documents to repeator and then upload them to SP document library.
//I tried both the control, when debugging AsyncUpload count is zero and getting "syntax error" on the page
//FileUpload uploads succesfully but closes the radWindow, but I want the window to be showing up, If this is the only solution and if RadAsyncUpload is not helpful for me.
        protected void SubmitButton_Click(object sender, System.EventArgs e)
        {
//If RadAsyncUpload is used.. I want this to be working because of multi uploads requirement.
            if (RadAsyncUpload1.UploadedFiles.Count > 0)
            {
  
                labelNoResults.Visible = false;
                Repeater1.Visible = true;
                Repeater1.DataSource = RadAsyncUpload1.UploadedFiles;
                Repeater1.DataBind();
  
                List<string> lstFileNames = new List<string>();
                foreach (UploadedFile file in RadAsyncUpload1.UploadedFiles)
                {
                    lstFileNames.Add(file.FileName);
  
                }
                //AddedControl ISODocuments to SharePoint document library
                AddDoc(lstFileNames);
  
            }
            else
            {
                labelNoResults.Visible = true;
                Repeater1.Visible = false;
            }
  
//If file upload is used.
 if (FileUpload1.PostedFile != null)
            {
                string siteUrl = SPContext.Current.Site.Url;
                using (SPSite siteColl = new SPSite(siteUrl))
                {
                    //Get SPWeb object representing a particular website
                    using (SPWeb webSite = siteColl.OpenWeb())
                    {
                        try
                        {
                            webSite.AllowUnsafeUpdates = true;
                            webSite.Lists.IncludeRootFolder = true;
                            //Get the document library in which documents will be uploaded
                            SPList docLibrary = webSite.Lists["UpLoadedDocuments"];
                            // objFileUpload is asp.net FileUpload Object
                            Stream FStream; string fname;
                            FStream = FileUpload1.PostedFile.InputStream;
                            int basenamestart = FileUpload1.PostedFile.FileName.LastIndexOf(@"\");
                            fname = FileUpload1.PostedFile.FileName.Substring(basenamestart + 1);
                            //Upload files into SharePoint document library
                            SPFile file = docLibrary.RootFolder.Files.Add(fname, FStream, true);
  
                            file.Update();
                        }
                        catch
                        { }
                    }
                }
            }
  
  
        }
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ABC.ascx.cs"
    Inherits="X.Y.Z" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2011.3.1305.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
     
   <telerik:RadScriptBlock runat="Server" ID="RadScriptBlock2">
        <script type="text/javascript">
    </script>
         <script type="text/javascript" src="/_layouts/js/MyCustom.js"></script>  
    </telerik:RadScriptBlock>
  
<telerik:RadTreeView ID="rtvDocuments" runat="server" EnableDragAndDrop="True" OnNodeDrop="rtvDocuments_HandleDrop"
        OnClientNodeDropping="onDropping" OnClientNodeDragging="onNodeDragging" MultipleSelect="true"
        EnableDragAndDropBetweenNodes="true" OnNodeExpand="rtvDocuments_NodeExpand" AllowNodeEditing="true"
        OnContextMenuItemClick="rtvDocuments_ContextMenuItemClick" OnNodeEdit="rtvDocuments_NodeEdit">
        <ContextMenus>
            <telerik:RadTreeViewContextMenu CssClass="ctxTreeMenu" ID="cMenuForGroups" runat="server">
                <Items>
                    <telerik:RadMenuItem Value="Rename" Text="Rename ..." Enabled="false" ImageUrl="/_layouts/Img/Outlook/rename.gif"
                        PostBack="false">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="NewFolder" Text="New Group"  ImageUrl="/_layouts/Img/Outlook/12.gif">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="AddDoc" Text="Add New Document" ImageUrl="/_layouts/Img/Outlook/journal.gif">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="Delete" Text="Delete Group" ImageUrl="/_layouts/Img/Outlook/7.gif">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem IsSeparator="true">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="Copy" Text="Clone ..." ImageUrl="/_layouts/Img/Outlook/10.gif">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="AddExistingGroup" Text="Add Existing Group">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="AddExistingDoc" Text="Add Existing Document">
                    </telerik:RadMenuItem>
                    <telerik:RadMenuItem Value="ViewAll" Text="View all Instances of ..." ImageUrl="/_layouts/Img/Outlook/searchFolder.gif">
                    </telerik:RadMenuItem>
                </Items>
                <CollapseAnimation Type="OutBack" />
            </telerik:RadTreeViewContextMenu>
</ContextMenus>
    </telerik:RadTreeView>
  <telerik:RadWindow ID="winGroupBrowse" runat="server"  EnableViewState="false"  Modal="true" Overlay="true" Width="875px" Height="545px"
     EnableShadow="true" DestroyOnClose="true" ShowContentDuringLoad="false" ReloadOnShow="true">
    <ContentTemplate>
           <div id="globalTree" class="globalTreeCont">
                <asp:UpdatePanel ID="pnlTree" Visible="true" runat="server">
                <ContentTemplate>
                    <telerik:RadTreeView CssClass="globalTree" OnNodeExpand="rtvDocuments_NodeExpand"
                        ID="rtvAllGroups" runat="server">
                    </telerik:RadTreeView>
                    </ContentTemplate>
                </asp:UpdatePanel>
    </ContentTemplate>
</telerik:RadWindow>
  <telerik:RadWindow ID="RadWndwAllDocs" runat="server"  EnableViewState="false"  Modal="true" Overlay="true" Width="875px" Height="545px"
     EnableShadow="true" DestroyOnClose="true" ShowContentDuringLoad="false" ReloadOnShow="true">
    <ContentTemplate>
                <asp:UpdatePanel ID="pnlGrid" Visible="true" runat="server">
                  <ContentTemplate>
                    <telerik:RadGrid ID="rgrdAllDocs" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="true"
                        AllowPaging="true" PageSize="10" AllowSorting="true" Height="100%" Width="100%">
                        <PagerStyle Mode="NextPrevAndNumeric"  />
                        <MasterTableView Height="100%" Width="100%">
                            <Columns>
                                <telerik:GridBoundColumn HeaderText="ID" DataField="ID" />
                                <telerik:GridBoundColumn HeaderText="Title" DataField="Title" />
                                <telerik:GridBoundColumn HeaderText="Description" DataField="Description" />
                                <telerik:GridBoundColumn HeaderText="ISOGroups" DataField="ISOGroupText" />
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                      </ContentTemplate>
                </asp:UpdatePanel>
                    </ContentTemplate>
</telerik:RadWindow>
  <telerik:RadWindow ID="RadWndwUploadDocs" runat="server"  EnableViewState="false"  Modal="true" Overlay="true" Width="875px" Height="545px"
     EnableShadow="true" DestroyOnClose="true" ShowContentDuringLoad="false" ReloadOnShow="true">
    <ContentTemplate>
               <asp:UpdatePanel ID="pnlUpload" Visible="true" runat="server" UpdateMode="conditional">
                                           <%-- If file upload is used instead of radAsyncUpload UNCOMMENT the trigger
                                             <Triggers>
                                               <asp:PostBackTrigger ControlID="SubmitButton" />
                                              </Triggers> --%>
                   <ContentTemplate>
                    <div class="grid grid_18 wizardMargin">
                    <div id="uploadCont">
                            <div class="columns">
                                <div class="col1">
                                    <h4>
                                        Groups on Page</h4>
                                    <div class="treeCont">
                             <telerik:RadTreeView CssClass="globalTree" OnNodeExpand="rtvDocuments_NodeExpand"
                        ID="rtvGroupstoAddDocs" runat="server"></telerik:RadTreeView>
                                    </div>
                                </div>
                                <div class="col2">
                                    <h4>
                                        Uploaded Files</h4>
                                    <div class="fileTree">
                                        <asp:Label ID="labelNoResults" runat="server" Visible="True">No uploaded files</asp:Label>
                                        <asp:Repeater runat="server" ID="Repeater1">
                                            <ItemTemplate>
                                                <div class="fileListStyle">
                                                    <%# DataBinder.Eval(Container.DataItem, "FileName").ToString() %>  (<%# DataBinder.Eval(Container.DataItem, "ContentLength").ToString() %>bytes)<br />
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </div>
                                </div>
                            </div>
                            <div class="uploadControls">
                                <h4>
                                    Select Files to Upload</h4>
                                <div class="FileDetails">
                                    <table class="uploadTable">
                                        <tbody>
                                            <tr>
                                                <td class="uploader">                                                
                                             <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" Skin="default">
                                                </telerik:RadAsyncUpload>
                                              
                                             //Tried asp fileupload, it is uploading files to document library and closing the radwindow.I donot want it to close it.
                                          //       <asp:FileUpload ID="FileUpload1" runat="server"  />
                                                    <asp:Button runat="server" ID="SubmitButton" Text="Upload files" OnClick="SubmitButton_Click" />  
                                           
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                         </div>
                   </ContentTemplate>
                </asp:UpdatePanel>
      </ContentTemplate>
   </telerik:RadWindow>

Any help is appreciated.

Plamen
Telerik team
 answered on 15 Aug 2012
1 answer
80 views
Hi,

I have an issue.
Can we hide the december month from thse.
see the attache image and code

here we setting the MultiViewRows based on  a calculation.

some times the fourth month data(available date) will be none and user cannot view the foirth month

is this possible..in schduler_PreRender event?

please reply me urg

 

 

protected void schduler_PreRender(object sender, EventArgs e)

 

{

 

RadCalendar popupCalendar = schduler.FindControl("SelectedDateCalendar") as RadCalendar;

 

popupCalendar.ShowOtherMonthsDays =

false;

 

popupCalendar.AutoPostBack =

true;

 

 

int count = GetMonthCount(lst.ToArray(), popupCalendar.SelectedDate).Count;

 

popupCalendar.MultiViewColumns = 2;

double _val = (double)count;

 

popupCalendar.MultiViewRows = (

int)Math.Round(_val/2);

 

 

 

 

 

popupCalendar.FocusedDate = lst[0];

popupCalendar.DayRender +=

new Telerik.Web.UI.Calendar.DayRenderEventHandler(popupCalendar_DayRender);

 

}

 

Maria Ilieva
Telerik team
 answered on 15 Aug 2012
11 answers
342 views
I did the same as on demo example. But I have no more place in header to display all filters. How I can put Date ranges one below the other?
berto
Top achievements
Rank 1
 answered on 15 Aug 2012
3 answers
201 views
Hello,

I am using "telerik reporting q1 2012". I am using Telerik.Reporting.Table and dynamically try to hide them. But it leave space when export to pdf. I have also try to put it in Panel. But the same issue. Please help me on this.

Regards,
Kunal
IvanY
Telerik team
 answered on 15 Aug 2012
1 answer
85 views
I have a RadDatePicker control on my page.

<telerik:RadDatePicker ID="rdDate" runat="server" ShowPopupOnFocus="true" ZIndex="30001"
            DateInput-DateFormat="MM/dd/yyyy" Width="100" TabIndex="1">
            <DateInput runat="server" ID="DateInput2" ClientEvents-OnBlur="CloseDatePopup">
            </DateInput>
            <DatePopupButton TabIndex="1" />
        </telerik:RadDatePicker>

In code behind, I am selecting the date like this
rdDate.SelectedDate = Convert.ToDateTime("08/08/2012");

I have screenshot of how it looks on page load and after I move my mouse over the RadDatePicker control.

Please suggest how I can fix this.

I am using
Telerik.Web.UI.dll (version 2012.1.215.35)
Telerik.Web.UI.Skins.dll (version 2012.1.215.35)
Milena
Telerik team
 answered on 15 Aug 2012
4 answers
245 views
Using a radgrid with AllowFilteringByColumn="true" I get this error:
“Invalid Column Name …”.

The SQL request used for data binding is :
SELECT myName AS [Another name] FROM TEST

So, I think the problem is the alias, but I don’t know how to solve it.

Could anyone help me, please?
Evelyne Schreiner
Top achievements
Rank 1
 answered on 15 Aug 2012
1 answer
199 views
Hi,

I have two raddatepicker columns as follows:
<telerik:GridTemplateColumn DataField="ItinDate" HeaderText="FromDate"  UniqueName="Date">
                                                <EditItemTemplate>
                                                    <telerik:RadDatePicker ID="ItinDateRadDatePicker" runat="server" Skin="Outlook"
                                                        DatePopupButton-TabIndex="-1" DbSelectedDate='<%# Bind("ItinDate") %>'  >
                                                     <ClientEvents OnDateSelected="CheckFromDate"  />
                                                    </telerik:RadDatePicker>
                                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ForeColor="Red"
                                                        ControlToValidate="ItinDateRadDatePicker" ErrorMessage="Invalid Date"
                                                        ValidationGroup="ItineraryGrid"></asp:RequiredFieldValidator>
                                                     
                                                </EditItemTemplate>
                                                
                                                <ItemTemplate>
                                                    <asp:Label ID="ItinDateLabel" runat="server"
                                                        Text='<%# Eval("ItinDate", "{0:MM/dd/yyyy}") %>'></asp:Label>
                                                    &nbsp;
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                             <telerik:GridTemplateColumn DataField="ItinToDate" HeaderText="ToDate"  UniqueName="ToDate">
                                                <EditItemTemplate>
                                                    <telerik:RadDatePicker ID="ItinToDateRadDatePicker" runat="server" Skin="Outlook"
                                                        DatePopupButton-TabIndex="-1" DbSelectedDate='<%# Bind("ItinToDate") %>' >
                                                         <ClientEvents OnDateSelected="CheckToDate"  />
                                                         
                                                    </telerik:RadDatePicker>
                                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator40" runat="server" ForeColor="Red"
                                                        ControlToValidate="ItinToDateRadDatePicker" ErrorMessage="Invalid Date"
                                                        ValidationGroup="ItineraryGrid"></asp:RequiredFieldValidator>
                                                  
                                                </EditItemTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="ItinDateToLabel" runat="server"
                                                        Text='<%# Eval("ItinToDate", "{0:MM/dd/yyyy}") %>'></asp:Label>
                                                    &nbsp;
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>

I have CheckFromDate and CheckToDate javascript functions to validate these dates against the trip begin and end dates on my form.
My javascript code is as follows:

 function CheckFromDate(sender, args) {
        try {
            var itinStartDtInput = $("#ctl00_MainContent_ItineraryGrid_ctl00_ctl02_ctl03_ItinDateRadDatePicker_dateInput_text");
            var tripStartDt = $("#ctl00_MainContent_TripStartDate_dateInput_text").val();
            var parsedStartDate = Date.parse(tripStartDt);
            //StartDt = parsedStartDate.getMonth() + 1 + "/" + parsedStartDate.getDate() + "/" + parsedStartDate.getYear();
            //alert("Start Date " + StartDt);

            var tripEndDt = $("#ctl00_MainContent_TripEndDate_dateInput_text").val();
            var parsedEndDate = Date.parse(tripEndDt);

            var ItinFromDt = args.get_newValue();
            var parsedItinFromDate = Date.parse(ItinFromDt);
            // alert("ItinFromDate " + ItinFromDt);

            if (parsedItinFromDate < parsedStartDate || parsedItinFromDate > parsedEndDate) {
                alert("Itinerary from date has to be between trip begin and end dates");
                args.IsValid = false;
                //return false;
                //args.set_cancel(true);
                window.setTimeout(function () { itinStartDtInput.select(); }, 20);
 
            }
            
        }
        catch (ex) {
            alert(ex);

        }
       
    }

    //// Check for Itinerary to date to be between trip begin and end dates
    function CheckToDate(sender, args) {
        try {
            var itinEndDtInput = $("#ctl00_MainContent_ItineraryGrid_ctl00_ctl02_ctl03_ItinToDateRadDatePicker_dateInput_text");
            var tripStartDt = $("#ctl00_MainContent_TripStartDate_dateInput_text").val();
            var parsedStartDate = Date.parse(tripStartDt);
            //StartDt = parsedStartDate.getMonth() + 1 + "/" + parsedStartDate.getDate() + "/" + parsedStartDate.getYear();
            //alert("Start Date " + StartDt);

            var tripEndDt = $("#ctl00_MainContent_TripEndDate_dateInput_text").val();
            var parsedEndDate = Date.parse(tripEndDt);

            var ItinToDt = args.get_newValue();
            var parsedItinToDate = Date.parse(ItinToDt);
            // alert("ItinFromDate " + ItinFromDt);

            if (parsedItinToDate < parsedStartDate || parsedItinToDate > parsedEndDate) {
                alert("Itinerary to date has to be between trip begin and end dates");
                //args.IsValid = false;
                //return false;
                //args.set_cancel(true);
                window.setTimeout(function () { itinEndDtInput.select(); }, 20);
            }

        }
        catch (ex) {
            alert(ex);
        }
    }

My problem is when user input the ItinDate, it runs the CheckFromDate validation and then the hits ok on the popup alert message, and can tab through to the next field, even if the date entered is not between the trip begin and end dates. How do I ensure that the user enters a valid date (which is between the tripbegin and end dates) before they tab to the next field on the grid?

Thanks, Janaki
Galin
Telerik team
 answered on 15 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?