Javacript __doPostBack can not find

I have an web appliction using ASP C#.  In my aspx file  I have a javascript which looks like this

<script language="javascript">
            
            function rowchanged()
            {
             alert("I am here rowchanged javascript");
             __doPostBack('RowChanged','');
            }
            
</script>

In my aspx.cs file I have a function RowChanged

When I run the application, I always always get an error saying  __doPostBact object doesn't exist.

When I include a  script like the following
<script language="javascript">
            <!--
             function __doPostBack(eventTarget, eventArgument)
             {     
                      var theform = document.Form1;
                          theform.__EVENTTARGET.value = eventTarget;
                          theform.__EVENTARGUMENT.value = eventArgument;
                          theform.submit();
           }
          -->
      </script>
            

it gets to the function, but has trouble with theform object.

I thought the _doPostBack function is an included function.  I know I never had to include with other apps.   I don't know what to do.  I have spent days on this.  Please HElp Please.
kathywargoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrichmonCommented:
The doPostback function should be created automatically by .NET - you should not be including one.

Are you using .NET 1.1?  If so did you remove the bottom portion of the code behind file that is autogenerated?
0
kathywargoAuthor Commented:
I am sorry.  I am using .Net 1.1 but I am not sure of what you mean about the bottom portion of the code.  Could you explain a bit more
0
smaccariCommented:
Maybe you should just make sure you actually have a form Form1 in your aspx page.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

mrichmonCommented:
There will be a section (or should be) at the bottom of the code behind page that looks like this:

#region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                  //
                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                  //
                  InitializeComponent();
                  base.OnInit(e);
            }
            
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {    
                  this.Load += new System.EventHandler(this.Page_Load);
            }
            #endregion


If it is missing then often the page does not function with certina things like the __dopostback
0
kathywargoAuthor Commented:
Okay.

Ichecked both of these ideas.  The code is okay .  I have the OnInit and its associated functions.

When I use the debugger it does say object cannot be found and it show Jscript functions.  Is there something in the project properties.  Could some one provide a small example in c# that I could build from  
0
mrichmonCommented:
A small example of a generic web page?  Of something else?

Web form:

aspx page:
------------------------
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="LS.Web.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 

<html>
  <head>
    <title>WebForm1</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
  </head>
  <body MS_POSITIONING="GridLayout">
      
    <form id="Form1" method="post" runat="server">

     </form>
      
  </body>
</html>

aspx.cs page
-----------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace MyWeb
{
      /// <summary>
      /// Summary description for WebForm1.
      /// </summary>
      public class WebForm1 : System.Web.UI.Page
      {
            private void Page_Load(object sender, System.EventArgs e)
            {
                  // Put user code to initialize the page here
            }

            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                  //
                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                  //
                  InitializeComponent();
                  base.OnInit(e);
            }
            
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {    
                  this.Load += new System.EventHandler(this.Page_Load);
            }
            #endregion
      }
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.