Results 1 to 2 of 2

Thread: AjaxContent in ASP

  1. #1
    Join Date
    Jun 2013
    Thanked 0 Times in 0 Posts

    Post AjaxContent in ASP

    1) Script Title: Dynamic Ajax Content

    2) Script URL (on DD):

    3) Describe problem:
    I've been using the dynamic ajax content in my aspx project and its work well in simple pages with the use of buttons in asp by using this code in .cs
    protected void Button1_Click(object sender, EventArgs e)
            Page.RegisterClientScriptBlock("ajax", "<script type='text/javascript'>ajaxpage('New.aspx', 'content')</script>");  
    but now when I add sqlcommands to that button to add data in the database I always got an error.
    and here's the error
    Server Error in '/WebSite' Application.
    The state information is invalid for this page and might be corrupted.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted.

    i want to execute the sqlcommand and an laod the result in same div content.

    please help me. Thanks in advance!

  2. #2
    Join Date
    Mar 2005
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries


    The ajaxpage function performs a GET request with no headers. Aside from any syntax errors you may or may not have in the code - you haven't shown the exact code that gives that error, you might need to be sending a POST or other type of request which requires a header.

    I'm not real familiar with asp, I use PHP and am not expert at it either. But what I would do is make up a separate asp page that, if viewed in the browser, would show the content that you want to have appear in the target div and/or do anything else server side you want done. Use ajaxpage to fetch that page. That separate page cannot have any client side javascript on it though.

    Like in PHP, I would put:

    PHP Code:
    <?php echo 'Hello World'?>
    or whatever, even much more complex PHP code like to write to/read from a file or database, on a separate page, say call it - hello.php, then use ajaxpage to fetch that:

    ajaxpage('hello.php', 'content');
    Last edited by jscheuer1; 06-16-2013 at 08:36 AM. Reason: detail
    - John

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Ajaxcontent
    By pragan in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 11-05-2008, 12:21 AM
  2. AjaxContent and AjaxTabsContent issue when put together
    By vikovesh in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 09-06-2007, 01:38 PM
  3. ajaxcontent form problem
    By Gil coder in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 06-01-2007, 10:29 AM
  4. ajaxcontent: security limitations override possible?
    By Grobbo in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 03-20-2006, 08:40 PM
  5. ajaxcontent caching
    By itKiwi in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 03-18-2006, 05:49 PM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts