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

[Solved] Grid text column throws JScript error on focus

0 Answers 6 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kathryn
Top achievements
Rank 1
Kathryn asked on 02 Apr 2013, 11:18 PM

Found this grid and loved all of the functionality.  The "ease of use" has proven something quite different (especially since we are using VB.NET).  I have got my cascading dropdowns in the grid working.  However, when I try to enter data into a text field, I get the following error (in jquery.validate.min.js): Microsoft JScript runtime error: Unable to get value of the property 'settings': object is null or undefined

Here's my model:

Public Class Page1Model
 
    <Display(Name:="Date Prepared:")> _
    Public Property DatePrepared() As DateTime
 
    <Display(Name:="Company Name:")> _
    <Required(ErrorMessage:="Company Name is required")> _
    Public Property CompanyName() As String
 
    <Display(Name:="Attention:")>
    Public Property Attention() As String
 
    <Display(Name:="Email:")> _
    <RegularExpression("\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage:="Invalid email format")> _
    Public Property Email() As String
 
    <Display(Name:="Phone #:")> _
    <RegularExpression("((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}", ErrorMessage:="Invalid phone format")> _
    Public Property Phone() As String
 
    <Display(Name:="Fax #:")> _
    <RegularExpression("((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}", ErrorMessage:="Invalid fax format")> _
    Public Property Fax() As String
 
    <Display(Name:="Business Description:")>
    Public Property BusinessDescription() As String
 
    Public Property LocationListing As List(Of LocationInformation)
End Class
 
 
Public Class LocationInformation
 
    <Display(Name:="Location #:")>
    Public Property LocationNumber As Int32
 
    <Display(Name:="Address:")>
    Public Property Address1 As String
 
    <Display(Name:="Suite:")>
    Public Property Address2 As String
 
    <Display(Name:="City:")> _
    <UIHint("City")> _
    Public Property CityID As Int32
    ' Public Property City As String
 
    <Display(Name:="State:")> _
    <UIHint("State")> _
    Public Property StateID As Int32
    ' Public Property State As String
 
    <Display(Name:="Zip:")> _
    <UIHint("Zip")> _
    Public Property ZipID As Int32
    ' Public Property Zip As String
 
    <Display(Name:="County:")>
    Public Property CountyID As Int32
    ' Public Property County As String
 
    <Display(Name:="Territory:")> _
    <UIHint("Territory")> _
    Public Property TerritoryID As Int32
    ' Public Property Territory As String
 
    Public Property FullAddress As String
End Class

Here's my View:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
     
    <% Using Html.BeginForm("Page1", "Application", FormMethod.Post)%>
        <%: Html.ValidationSummary()%>
            <table id="InsuredInformation">
                <tr>
                    <td align="right"><%: Html.LabelFor(Function(m) m.CompanyName)%> </td>
                    <td colspan="5" align="left">
                        <%: Html.TextBoxFor(Function(m) m.CompanyName)%>
                    </td>
                </tr>
                <tr>
                    <td align="right"><%: Html.LabelFor(Function(m) m.Attention)%> </td>
                    <td colspan="5" align="left">
                        <%: Html.TextBoxFor(Function(m) m.Attention)%>   
                    </td>
                </tr>
                <tr>
                    <td align="right"><%: Html.LabelFor(Function(m) m.Email)%> </td>
                    <td align="left">
                        <%: Html.TextBoxFor(Function(m) m.Email)%>
                        <% Html.ValidateFor(Function(m) m.Email)%>
                        
                    </td>
                    <td align="right"><%: Html.LabelFor(Function(m) m.Phone)%> </td>
                    <td align="left">
                        <%: Html.TextBoxFor(Function(m) m.Phone)%>
                        <% Html.ValidateFor(Function(m) m.Phone)%>
                    </td>
                    <td align="right"><%: Html.LabelFor(Function(m) m.Fax)%> </td>
                    <td align="left">
                        <%: Html.TextBoxFor(Function(m) m.Fax)%>
                        <% Html.ValidateFor(Function(m) m.Fax)%></td>
                </tr>
                <tr>
                    <td align="right"><%: Html.LabelFor(Function(m) m.BusinessDescription)%> </td>
                    <td colspan="5" align="left">
                        <%: Html.TextBoxFor(Function(m) m.BusinessDescription)%>
                    </td>
                </tr>
            </table>
            <h5>Location Information</h5>
            <%: Html.Telerik().Grid(Of JensvoldRater.LocationInformation).Name("Grid") _
                .DataKeys(Function(key) key.Add(Function(c) c.LocationID)) _
                .ToolBar(Function(toolCommand) toolCommand.Insert.ButtonType(GridButtonType.Text).Text("Add New Location")) _
                .DataBinding(Function(data) data.Ajax().Select("GetLocations", "Application").Insert("InsertLocation", "Application").Update("UpdateLocation", "Application").Delete("DeleteLocation", "Application")) _
                .Columns(Sub(columns)
                             columns.Bound(Function(item) item.TransactionID).Hidden(True)
                             columns.Bound(Function(item) item.LocationID).Hidden(True)
                             columns.Bound(Function(item) item.LocationNumber).Title("Loc #").ReadOnly(True)
                             columns.Bound(Function(item) item.Address1).Title("Address")
                             columns.Bound(Function(item) item.Address2).Title("Suite")
                             columns.Bound(Function(item) item.StateID).Title("State")
                             columns.Bound(Function(item) item.CityID).Title("City")
                             columns.Bound(Function(item) item.ZipID).Title("Zip")
                             columns.Bound(Function(item) item.TerritoryID).Title("Territory")
                             columns.Command(Sub(commands)
                                                 commands.Edit().ButtonType(GridButtonType.Image)
                                                 commands.Delete().ButtonType(GridButtonType.Image)
                                             End Sub)
                         End Sub) _
                .Editable(Function(editing) editing.InsertRowPosition(GridInsertRowPosition.Top).Mode(GridEditMode.InLine)) _
                .Pageable().Sortable().Scrollable()
      
    %>
<%: Html.Telerik().ScriptRegistrar()%>
<% End Using%>
        
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    Application Page 1
     
    <script type="text/javascript">
 
        $(document).ready(function () { 'various change functions based on the HTML.TextBoxFors above
        });
</script>
 
</asp:Content>

State, City, Zip, and Territory are controlled by EditorTemplates. 
State:

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %>
<%: Html.Telerik().DropDownList().Name("LocationState") _
            .BindTo(New SelectList(ViewBag.States, "StateID", "Name")).Placeholder("Select...") _
            .CascadeTo("LocationCity")%>

City:

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %>
<%: Html.Telerik().DropDownList().Name("LocationCity") _
            .DataBinding(Function(binding) binding.Ajax().Select("GetCityList", "Application")) _
            .Placeholder("Select...") _
            .CascadeTo("LocationZip")%>
          

Zip:

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %>
<%: Html.Telerik().DropDownList().Name("LocationZip").DataBinding(Function(binding) binding.Ajax().Select("GetZipList", "Application"))%>

Territory:

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %>
<%: Html.Telerik().DropDownList().Name("LocationTerritory").BindTo(New SelectList(ViewBag.TerritoryList, "TerritoryID", "Name")).Placeholder("Select...")%>

In my Site.Master, I reference the following:

  1. Stylesheets
    1. telerik.common.css
    2. telerik.web20.min.css
    3. telerik.rtl.css
  2. Javascripts (in this order)
    1. MicrosoftAjax.js
    2. MicrosoftMvcAjax.js
    3. jquery-1.7.1.min.js
    4. jquery.validate.min.js
    5. jquery.validate.unobtrusive.min.js
    6. jquery.unobtrusive-ajax.min.js

I have searched for 2 days on a resolution to my problem.  If I do Html.Telerik().ScriptRegistrar().jQuery(False), none of my ajax javascript calls on the page work as well as my cascading dropdowns in my grid stop working.  The commented out ScriptRegistrar in my view yields the same results as the statement above it.  I did try setting jQueryValidation(False), but it started throwing errors in telerik.grid.editing.min.js.

Any help is much appreciated!  I really want to use this grid, but deadlines are quickly approaching!

Tags
Grid
Asked by
Kathryn
Top achievements
Rank 1
Share this question
or