The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

Datepickerfield error

  1. #1

    Datepickerfield error

    Hi I am having a problem with the Datepickerfield control.

    If i place one on my page i am getting an error as follows...
    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Ext.Net.Mobile.DatePickerFieldBase.set_RawValue(Ob ject value) at Ext.Net.Mobile.DatePickerFieldBase.LoadPostData(St ring postDataKey, NameValueCollection postCollection) at Ext.Net.Mobile.Field.System.Web.UI.IPostBackDataHa ndler.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.Page.ProcessPostData(NameValueCollec tion postData, Boolean fBeforeLoad) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.admin_mobile_flexmobile_aspx.ProcessRequest(Ht tpContext context) at System.Web.HttpApplication.CallHandlerExecutionSte p.System.Web.HttpApplication.IExecutionStep.Execut e() at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously)


    I am not even trying to set a date on it.
    It happens on page load and every subsequent direct event triggers the same error.
    If i put it on a blank page it seems ok so it must be clashing with something on my page.

    I have tried removing numerous things from page without success.
    My page is too big to post so just wondering if you know anything about this error.

    Also on the empty page where it does load if i try to set a date on it from page load it throws an error also saying object can't be found.

    Thanks
    Last edited by Fergus; Sep 11, 2017 at 4:45 PM.
  2. #2
    Hello @Fergus!

    We don't know about this issue, as we have an example that uses the date field without issues here: http://mobile.ext.net/#demo/formpanel

    There should indeed be some library competing with Ext.NET Mobile and breaking the component.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    As you can see from this example when you click on the button it throws an error.

    Even though the direct event is empty.
    Even if i set visible=false for the datepickerfield it is still the same.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestGridPanel.aspx.vb" Inherits="Admin_Mobile_TestGridPanel" %>
    
    <%@ Register Assembly="Ext.Net.Mobile" Namespace="Ext.Net.Mobile" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager runat="server" AjaxTimeout="60000" ScriptMode="Debug" InitScriptMode="Linked"></ext:ResourceManager>
            <ext:Viewport runat="server">
                <Items>
                    <ext:Toolbar runat="server" Docked="Top">
                        <Items>
                            <ext:Button runat="server" Text="Update" ID="btn1">
                                <DirectEvents>
                                    <Tap OnEvent="ListUsers">
                                        <EventMask ShowMask="true"></EventMask>
                                    </Tap>
                                </DirectEvents>
                            </ext:Button>
                            <ext:DatePickerField
                                runat="server" DateFormat="d"
                                DestroyPickerOnHide="true"
                                Name="date"
                                Label="Start Date">
                                <Picker runat="server" YearFrom="1990" DateValue="2016-06-24" />
                            </ext:DatePickerField>
                            
                        </Items>
                    </ext:Toolbar>
    
    
                </Items>
            </ext:Viewport>
    
        </form>
    </body>
    </html>
    Partial Class Admin_Mobile_TestGridPanel
        Inherits System.Web.UI.Page
    
        Private Sub Admin_Mobile_TestGridPanel_Load(sender As Object, e As EventArgs) Handles Me.Load
            listUsers(Nothing, Nothing)
    
            'dpf1.SetValue(Date.Now)
            btn1.SetText("hello")
        End Sub
    
        Protected Sub listUsers(sender As Object, e As DirectEventArgs)
    
        End Sub
    
    
    End Class
  4. #4
    Hello, @Fergus!

    Your code has an error where you bind the Tap event. You are using ListUsers where you defined an listUsers method. Notice the lowercase.

    When I fixed that error I could load the page and click the button, no error happens at all on my side.
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hi,
    Thanks for pointing that out. But still the same error here.

    I have changed both references to ListUsers.

    I am using Latest version of chrome with the downloaded ext.net 4.4 dlls.

    Click image for larger version. 

Name:	ExtNetDatepickerField.JPG 
Views:	1 
Size:	42.1 KB 
ID:	25043

    When i click on the button the error happens and also the text in the datepicker at the bottom becomes smaller.

    Strange you are not getting same error.

    I attach new code with an alert statement. If you expand the datepicker field first then click the button.

    Tried testing in Firefox but neither button or datefield react to click.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestGridPanel.aspx.vb" Inherits="Admin_Mobile_TestGridPanel" %>
    
    <%@ Register Assembly="Ext.Net.Mobile" Namespace="Ext.Net.Mobile" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager runat="server" AjaxTimeout="60000"></ext:ResourceManager>
            <ext:Viewport runat="server">
                <Items>
                    <ext:Toolbar runat="server" Docked="Top">
                        <Items>
                            <ext:Button runat="server" Text="Update" ID="btn1">
                                <DirectEvents>
                                    <Tap OnEvent="ListUsers">
                                        <EventMask ShowMask="true"></EventMask>
                                    </Tap>
                                </DirectEvents>
                            </ext:Button>
                            <ext:DatePickerField runat="server" >
    <%--                            <Picker runat="server" YearFrom="1990" DateValue="2016-06-24" />--%>
                            </ext:DatePickerField>
                            
                        </Items>
                    </ext:Toolbar>
    
    
                </Items>
            </ext:Viewport>
    
        </form>
    </body>
    </html>
    Imports Ext.Net.Mobile
    
    Partial Class Admin_Mobile_TestGridPanel
        Inherits System.Web.UI.Page
    
        Private Sub Admin_Mobile_TestGridPanel_Load(sender As Object, e As EventArgs) Handles Me.Load
            'listUsers(Nothing, Nothing)
    
            'dpf1.SetValue(Date.Now)
            btn1.SetText("hello")
        End Sub
    
        Protected Sub ListUsers(sender As Object, e As DirectEventArgs)
            Ext.Net.Mobile.X.Msg.Alert("", "test").Show()
    
        End Sub
    Thanks
  6. #6
    If you do not see the error i wonder if this has something to do with me using a touch screen laptop.
    I remember it causing other problems before.
  7. #7
    Hello, @fergus!

    There's something unclear here to me...

    I am using Latest version of chrome with the downloaded ext.net 4.4 dlls.
    Ext.NET Mobile is in version 4.1.0. Your test cases also look like an Ext.NET Mobile for the namespace they import. Can you confirm the Ext.NET version you are using?

    Assuming you are using Ext.NET Mobile 4.1.0, I have looked your second test case. Okay, it calls the direct event on tap, no name casing issues, and it then failed, but not a request error.

    In fact, there's an issue with the

    Ext.Net.Mobile.X.Msg.Alert("", "test").Show()
    Where it does try to create an alert message dialog with a null title and it breaks. Was this the cause I'm sure we would be talking about something completely different, so I just went ahead and added something to the title, and voila, it works just fine.

    Here's an animated gif of the test case running here: 62103-helloBtnClick.gif.

    In the animation, it shows "galaxy s5" emulation on google chrome. Before that, I used also the "laptop w/ touchscreen" emulation mode, and the same result attained.

    The testbed does not feature native touchscreen so this may be the issue, as you suggested. If you have google chrome installed there, can you check if your example runs fine if you run it in device emulation mode (if in doubt how to activate this, check this out). I believe it would be easier for us both test in google chrome + device emulation mode instead of getting the same set up you have over there on our side. At least we can then be sure whether this is or not an issue that chrome can reproduce in device emulation mode.

    Any chance you have installed both Ext.NET and Ext.NET.Mobile NuGet packages on the same project? Maybe try a fresh project.

    In your first error message, you posted an error that looks like it reflects a null reference due to the default value bound to the date picker field. But now I see in the last test case you dropped even this default value and still have an issue with null reference. Can you copy-paste that stack strace from last test case? Maybe there's something to it that could hint the source of the issue.

    The error in the alert call shouldn't be triggering a null reference like it does for you. Just js error on client-side.
    Fabrício Murta
    Developer & Support Expert
  8. #8
    Hello @fergus!

    It's been a while since we last posted a follow-up here and still no feedback from you. Do you still need help on this issue? We'd really love to be able to help, but we would need more information on your scenario to reproduce the issue.

    Just as a side not, we've recently launched a hotfix 4.1.1 for Ext.NET Mobile, but it just addresses an issue with android 8 phones (which completely prevents such devices -- or most of them -- from loading Ext.NET pages).

    We may mark this thread as closed if you don't post a feedback here in 7+ days from now. But don't worry, even if we mark this as closed, you'll be able to post follow-ups whenever you are able to, and we'll reopen the thread.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Mar 24, 2017, 2:45 AM
  2. [CLOSED] DatePickerField - Date format
    By sveins12 in forum Mobile Premium Help
    Replies: 5
    Last Post: Feb 27, 2017, 8:36 AM
  3. [CLOSED] DatePickerField - Javascript error
    By sveins12 in forum Mobile Premium Help
    Replies: 4
    Last Post: Feb 02, 2017, 11:48 PM
  4. Replies: 4
    Last Post: Nov 04, 2016, 4:17 AM
  5. Replies: 2
    Last Post: Jul 29, 2009, 2:57 PM

Tags for this Thread

Posting Permissions