This is a migrated thread and some comments may be shown as answers.

RadGrid MasterTableViewEditForm RadDateTimePicker

8 Answers 214 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon Adkins
Top achievements
Rank 2
Jon Adkins asked on 17 Aug 2009, 08:06 PM
All,
I have two RadDateTimepickers within a MasterTableViewEditForm view in a radgrid. Everything works fine, but after interacting with the page or hitting the cancel button a few times, then I get the following error:

'this.get_timeview()' is null or not an object.

This only happens after going to edit a record and then hitting the cancel button after three times.
Below is the code for my RadGrid:
<telerik:RadGrid ID="RadGrid2" runat="server" AllowAutomaticDeletes="True"   
                                                             
    AllowAutomaticInserts="True" AllowAutomaticUpdates="True"   
                                                           AutoGenerateEditColumn="True"   
                                       DataSourceID="SqlDataSource2" GridLines="None"   
                                                             
    ShowGroupPanel="True" Skin="Web20" Width="95%" AllowPaging="True" ShowFooter="True"   
                        PageSize="5">  
                        <mastertableview autogeneratecolumns="False"   
                                                           datasourceid="SqlDataSource2"   
                            CommandItemDisplay="Top">  
                            <EditItemTemplate> 
                                  
                            </EditItemTemplate> 
                            <nestedviewtemplate> 
                                 
                            </nestedviewtemplate> 
                            <CommandItemSettings AddNewRecordText="Add New Day" /> 
                            <expandcollapsecolumn visible="True">  
                            </expandcollapsecolumn> 
                            <Columns> 
                                <telerik:GridTemplateColumn HeaderText="Delete?" UniqueName="TemplateColumn">  
                                    <ItemTemplate> 
                                        <asp:ImageButton ID="btndeleteday" runat="server" CommandName="DeleteDay"   
                                            Height="25px" ImageUrl="~/images/recyclebin.png"    
                                            Width="25px" onclick="btndeleteday_Click" /> 
                                        <cc1:ConfirmButtonExtender ID="btndeleteday_ConfirmButtonExtender"   
                                            runat="server" ConfirmOnFormSubmit="True"   
                                            ConfirmText="Are you sure you want to delete this day?" Enabled="True"   
                                            TargetControlID="btndeleteday">  
                                        </cc1:ConfirmButtonExtender> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID"   
                                                                   ReadOnly="True" SortExpression="ID"   
                                    UniqueName="ID">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="LeaveType" HeaderText="Type"   
                                                                   SortExpression="LeaveType"   
                                    UniqueName="LeaveType">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="LeaveRequestDate" HeaderText="Request Date"   
                                                                   SortExpression="LeaveRequestDate"   
                                    UniqueName="LeaveRequestDate">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="LeaveHours" HeaderText="Hours"   
                                                                   SortExpression="LeaveHours"   
                                    UniqueName="LeaveHours">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="StartTime" DataType="System.DateTime"   
                                                                   HeaderText="Start Time"   
                                    SortExpression="StartTime" UniqueName="StartTime">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridBoundColumn DataField="EndTime" DataType="System.DateTime"   
                                                                   HeaderText="End Time"   
                                    SortExpression="EndTime" UniqueName="EndTime">  
                                </telerik:GridBoundColumn> 
                            </Columns> 
                            <editformsettings editformtype="Template">  
                                <editcolumn uniquename="EditCommandColumn1">  
                                </editcolumn> 
                                <formtemplate> 
                                <fieldset style="padding:10px;">  
                                <legend style="padding:5px;"><b>Edit Action: </b> 
                               <b> - </b> 
                           <asp:Label ID="lblstatus" Font-Bold="True" Font-Italic="True"   
                               Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'  runat="server" /> 
                       </legend> 
                                    <asp:SqlDataSource ID="LeaveTypes" runat="server"   
                                                           ConnectionString="<%$ ConnectionStrings:TimetrexLeaveTestingConnectionString %>"   
                                                             
                                        SelectCommand="SELECT [ID], [LeaveType] FROM [LeaveTypes]">  
                                    </asp:SqlDataSource> 
                                    <table class="TableNonImportantText" style="table-layout: auto; text-align: left; white-space: nowrap; width: 100%">  
                                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="The following errors need to be corrected before you can Edit/Insert a day!" /> 
                                        <tr> 
                                            <td class="style63" nowrap="nowrap">  
                                                Leave Type:</td> 
                                            <td class="style54">  
                                                <telerik:RadComboBox ID="drptypeleave" Runat="server" DataSourceID="LeaveTypes"   
                                                    DataTextField="LeaveType" DataValueField="ID" Skin="Web20"   
                                                    SelectedValue='<%# Bind("LeaveType_Fkey") %>'>  
                                                </telerik:RadComboBox> 
                                            </td> 
                                            <td class="style61">  
                                                </td> 
                                            <td class="style61">  
                                                &nbsp;</td> 
                                            <td class="style60">  
                                                </td> 
                                            <td class="style54">  
                                                <asp:Label ID="lblid" runat="server" Text='<%# eval("LeaveRequest_Fkey") %>'   
                                                    Visible="False"></asp:Label> 
                                                <asp:Label ID="lblLeaveDateID" runat="server" Text='<%# eval("ID") %>'   
                                                    Visible="False"></asp:Label> 
                                            </td> 
                                            <td class="style56">  
                                                </td> 
                                            <td class="style54">  
                                                </td> 
                                            <td class="style54">  
                                                </td> 
                                        </tr> 
                                        <tr> 
                                            <td class="style63" nowrap="nowrap">  
                                                Start Time:</td> 
                                            <td class="style58" nowrap="nowrap">  
                                                <telerik:RadDateTimePicker ID="RadDateTimePickerStart" Runat="server"   
                                                                                   Culture="English (United States)"    
                                                                                   Skin="Web20"   
                                                    DbSelectedDate='<%# Bind("StartTime") %>'>  
                                                    <calendar skin="Web20" usecolumnheadersasselectors="False"   
                                                                                   userowheadersasselectors="False"   
                                                        viewselectortext="x">  
                                                    </calendar> 
                                                    <timeview cellspacing="-1">  
                                                    </timeview> 
                                                    <timepopupbutton hoverimageurl="" imageurl="" /> 
                                                    <datepopupbutton hoverimageurl="" imageurl="" /> 
                                                </telerik:RadDateTimePicker> 
                                            </td> 
                                            <td class="style62" nowrap="nowrap">  
                                                <asp:RequiredFieldValidator ID="BeginValidator" runat="server"   
                                                    ControlToValidate="RadDateTimePickerStart"   
                                                    ErrorMessage="An begin date is required to submit a leave request!"   
                                                    Text="*"></asp:RequiredFieldValidator> 
                                            </td> 
                                            <td class="style62" nowrap="nowrap">  
                                                &nbsp;</td> 
                                            <td class="style60" nowrap="nowrap">  
                                                End Time:</td> 
                                            <td class="style58" nowrap="nowrap">  
                                                <telerik:RadDateTimePicker ID="RadDateTimePickerEnd" Runat="server"   
                                                                                   Culture="English (United States)" 
                                                                                   Skin="Web20"   
                                                    DbSelectedDate='<%# Bind("EndTime") %>'>  
                                                    <calendar skin="Web20" usecolumnheadersasselectors="False"   
                                                                                   userowheadersasselectors="False"   
                                                        viewselectortext="x">  
                                                    </calendar> 
                                                    <timeview cellspacing="-1">  
                                                    </timeview> 
                                                    <timepopupbutton hoverimageurl="" imageurl="" /> 
                                                    <datepopupbutton hoverimageurl="" imageurl="" /> 
                                                </telerik:RadDateTimePicker> 
                                            </td> 
                                            <td class="style45" nowrap="nowrap">  
                                                <asp:RequiredFieldValidator ID="EndValidator" runat="server"   
                                                    ControlToValidate="RadDateTimePickerEnd"   
                                                    ErrorMessage="An end time is required to submit a leave request! "   
                                                    Text="*"></asp:RequiredFieldValidator> 
                                            </td> 
                                            <td class="style41">  
                                                &nbsp;</td> 
                                            <td class="style41">  
                                            </td> 
                                        </tr> 
                                        <tr> 
                                            <td class="style63" nowrap="nowrap">  
                                                <asp:Button ID="btnUpdate" runat="server"   
                                                                                   CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'   
                                                                                   Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'   
                                                                                   Width="79px" /> 
                                            </td> 
                                            <td class="style58" nowrap="nowrap">  
                                                <asp:Button ID="btncancel" runat="server" CausesValidation="False"   
                                                                                   CommandName="Cancel" Text="Cancel"   
                                                    Width="79px"  /> 
                                            </td> 
                                            <td class="style62" nowrap="nowrap">  
                                                &nbsp;</td> 
                                            <td class="style62" nowrap="nowrap">  
                                                &nbsp;</td> 
                                            <td class="style60" nowrap="nowrap">  
                                                &nbsp;</td> 
                                            <td class="style58" nowrap="nowrap">  
                                                &nbsp;</td> 
                                            <td class="style45" nowrap="nowrap">  
                                                &nbsp;</td> 
                                            <td class="style41">  
                                                &nbsp;</td> 
                                            <td class="style41">  
                                                &nbsp;</td> 
                                        </tr> 
                                        <tr> 
                                            <td class="style54" colspan="9">  
                                                <div id="validation" runat="server" visible="true" > 
                                                    <asp:CustomValidator ID="HoursPositive" runat="server"   
                                                        ControlToValidate="RadDateTimePickerStart" ErrorMessage=""   
                                                        OnServerValidate="ServerValidate"></asp:CustomValidator> 
                                                    <asp:CustomValidator ID="HoursCheck" runat="server"   
                                                        ControlToValidate="RadDateTimePickerStart" ErrorMessage=""   
                                                        OnServerValidate="ServerValidate"></asp:CustomValidator> 
                                                    <asp:CustomValidator ID="NoDays" runat="server"   
                                                        ControlToValidate="RadDateTimePickerStart" ErrorMessage=""   
                                                        OnServerValidate="ServerValidate"></asp:CustomValidator> 
                                                    <asp:CustomValidator ID="HoursUsable" runat="server"   
                                                        ControlToValidate="RadDateTimePickerStart" ErrorMessage=""   
                                                        OnServerValidate="ServerValidate"></asp:CustomValidator> 
                                                </div> 
                                            </td> 
                                        </tr> 
                                    </table> 
                                    <telerik:RadAjaxManager ID="RadAjaxManager3" runat="server">  
                                        <ajaxsettings> 
                                            <telerik:AjaxSetting AjaxControlID="grddays">  
                                                <updatedcontrols> 
                                                    <telerik:AjaxUpdatedControl ControlID="grddays"   
                                                                                       LoadingPanelID="radajaxloadingpanel1" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="btnsubmit" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="lblhoursannual" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="lblhourssick" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="lblhoursjury" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="lblhoursbereavement" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="lblhoursmilitary" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="lblhourscomp" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="lblhourswithoutpay" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="lblholidaypay" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="txtcomments" /> 
                                                    <telerik:AjaxUpdatedControl ControlID="validationsummary1" /> 
                                                </updatedcontrols> 
                                            </telerik:AjaxSetting> 
                                            <telerik:AjaxSetting AjaxControlID="grddays">  
                                                <updatedcontrols> 
                                                    <telerik:AjaxUpdatedControl controlid="grddays" /> 
                                                </updatedcontrols> 
                                            </telerik:AjaxSetting> 
                                        </ajaxsettings> 
                                    </telerik:RadAjaxManager> 
                                    <br /> 
                                    </fieldset></formtemplate>  
                            </editformsettings> 
                            <CommandItemTemplate> 
                                <table class="style11">  
                                    <tr> 
                                        <td class="style54">  
                                            <asp:Image ID="Image6" runat="server" Height="25px"   
                                                                               ImageUrl="~/images/folder_green.png"   
                                                Width="25px" /> 
                                        </td> 
                                        <td> 
                                            <asp:LinkButton ID="LinkButton4" runat="server" CommandName="InitInsert">Add New   
                                            Day</asp:LinkButton> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </CommandItemTemplate> 
                        </mastertableview> 
                        <clientsettings allowdragtogroup="True">  
                        </clientsettings> 
                    </telerik:RadGrid> 
Any help would be greatly appreciated.

8 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 20 Aug 2009, 11:02 AM
Hello Jon,

If your RadGrid is AJAX-ified, the described scenario usually happens when you initiate a new AJAX request before the response from the previous AJAX request has loaded. In this case, the client objects of your controls are not yet fully initializes when you initiate a new request.

If you are using AJAX, you need to make sure that a new request is initiated only after the previous has completed. The user can be notified of an ongoing AJAX request through the use of loading panels (e.g. RadAjaxLoadingPanel).

Sincerely yours,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jon Adkins
Top achievements
Rank 2
answered on 24 Aug 2009, 08:47 PM
Veli,

Thanks for the response. I already have it linked to an ajaxloading panel and the loading panel dissapears before the controls are completely rendered in the MasterTableViewEditForm. Is there a way to make the AjaxLoadingPanel show until it has completely finished. The code sample I gave was just a "Play" code sample. I can give a production sample if you like. Thanks again for all the help.

Thanks,
Jonathan Adkins
0
Veli
Telerik team
answered on 25 Aug 2009, 07:35 AM
Hi Jon,

If you can paste some sample code I can include in a project and run, I will be happy to look at this issue. Please, remember to provide the exact steps needed to reproduce the javascript errors you are getting.

If not, you will need to open a regular support ticket with an attached runnable project, so that we can be of better assistance to you. Please try to strip the project down to a minimum, so that the project best concentrates on reproducing the issue.

Greetings,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rory
Top achievements
Rank 1
answered on 15 Jan 2011, 12:15 AM
I have the same error.

Our Scenario.

A Page1.aspx with a RadGrid and AjaxManager. When you click edit on Grid1 we open a RadWindow based on a UserControl1.ascx this user control is an edit form. On this edit form Usercontrol1.ascx we have a UserControl2.ascx this 2nd control contains a Grid2 that uses a time picker with inline editing. When we try to edit the Grid2 we get the same error as described above and the DatePickers and RadComboBox in the inline editor do not work.

Please Help.
0
Veli
Telerik team
answered on 17 Jan 2011, 09:35 AM
Hi Rory,

We may need to look at your particular scenario to be able to identify what exactly is causing this issue. Consider opening a regular support ticket where you can send us some sample code or, ideally, a small runnable project we can debug locally. In the mean time, you may want to look for possible javascript errors on page. Also, note that, as previously mentioned, you need to make sure any pending AJAX requests finish completely before you interact further with the page.

Veli
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Rory
Top achievements
Rank 1
answered on 18 Jan 2011, 05:58 AM
Hi Veli,
I can look into making a working project and opening a ticket but that will take a few days. I know that the error is coming from the use of a RadWindow to open a UserControl.ascx that contains a Grid with TimeDatePicker. I tried turning off Ajax and the error is still there. I turned off the DatePicker and the error stopped but this is not good since we need the Picker. I've pasted the error and section of code in Telerik that is broken. Let me know if have any other ideas? Perhaps a RadWindowManager setting? 
Thanks.

The error:
"Line: 6517
Error: 'this.get_timeView()' is null or not an object"

The Telerik Code piece:
{var a=Telerik.Web.UI.RadDateTimePicker.TimePopupInstances[this.get_timeView().get_id()];
0
Veli
Telerik team
answered on 18 Jan 2011, 08:46 AM
This error usually occurs when you have multiple RadDateTimePicker or RadTimePicker controls on the page and they are using a shared TimeView. If the shared time view is not AJAX-ified together with the pickers, you are getting this error after an AJAX postback. This is usually an AJAX-specific scenario and should not be reproducible with disabled AJAX. If you have completely disabled AJAX so that the page always makes full postbacks, and you are still getting this error, then the cause for this may lie elsewhere. In any case, we would not be able to suggest much without being able to reproduce this issue in your particular scenario. A live URL you can provide us may also help identify the cause for this.

Veli
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Rory
Top achievements
Rank 1
answered on 20 Jan 2011, 10:39 PM
Hello,
We discovered that our error is because we were using an HTA to view our application it appears HTAs and Iframes have issues and RadWindow uses an iframe container. We did however work around the error by using a GridTemplateColumn that contains a RadDateTimePicker instead of using the GridDateTimeColumn.
Thanks for the help.
Tags
Grid
Asked by
Jon Adkins
Top achievements
Rank 2
Answers by
Veli
Telerik team
Jon Adkins
Top achievements
Rank 2
Rory
Top achievements
Rank 1
Share this question
or