Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.

Search This Blog

Wednesday, 3 October 2012

DevExpress Unable to get value of the property 'usercontrol_dxcontrol_event' : object is null or undefined

I am getting "Microsoft JScript runtime error" when running web application that uses DevExpress controls. I have got a user control hierarchy as follows:-
Default.aspx
 |
  -> Site.Master
          |
           -> LoadInvoiceTab
                  |
                   -> LoadInvoiceTabHeader
LoadInvoiceTabHeader has got some javascript code to handle client side events for DevExpress controls. script has been added toward end of the user control definition.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoadInvoiceTabHeader.ascx.cs" Inherits="LoadInvoiceTabHeader" %>
 
Invoice No :
Customer name :
Delivery Address :
After running the website I was getting following error message:-
Microsoft JScript runtime error: Unable to get value of the property 'LoadInvoiceTabHeader_btnSave_Click': object is null or undefined
The reason for the script error is because devexpress controls try to evaluate SaveInvoice & CancelInvoice while rendering the page, but by this time the script written for clientside events were not assigned and hence generates an error. In order to render the script in advance all you need to do is just assign id for script tab with prefix with "dxss_". So script will now become
 
That's it this should solve the issue.

One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. ~Elbert Hubbard, The Roycroft Dictionary and Book of Epigrams, 1923

1 comments:

Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers