Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8155575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:42:32+00:00 2026-06-06T16:42:32+00:00

I am using iframe to open new .aspx page from parent page. child page

  • 0

I am using iframe to open new .aspx page from parent page. child page is using ajaxcontroltoolkit(ajax CalendarExtender). Now on form submit, I want to close iframe and return to parent page. For that I am using following code.

ClientScript.RegisterStartupScript(this.GetType(), "scriptid", window.parent.location.href='ViewVendors.aspx'", true);

This works file if I remove ajax control from child page but does not work with ajax control.
I want to use calenderExtender and iframe both. How can I use it and what is the problem for such so called abnormal behavior.

This is the code for my submit button event handler.

protected void btnUpdate_Click(object sender, EventArgs e)
{
    try
    {
        objVendor.VendorID = Convert.ToInt64(Request.QueryString["Id"]);
        objVendor.Name = txtName.Text;
        objVendor.BillingAddress = txtBillingAddress.Text;
        objVendor.ShippingAddress = txtShippingAddress.Text;
        objVendor.ContactPersonName = txtContactPerson.Text;
        objVendor.ContactNumber = txtContactNumber.Text;
        objVendor.EmailID = txtEmailID.Text;
        objVendor.VendorSinceDate = Convert.ToDateTime(txtVendorDate.Text);
        objVendor.IsActive = Convert.ToBoolean(rdblStatus.SelectedValue);
        objVendor.Logo = FileUpload();
        int intResult = objVendor.UpdateVendor();
        if (intResult > 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "window.parent.location.href='ViewVendors.aspx'", "scriptid", true);
            //ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='ViewVendors.aspx'", true);
        }
    }
    catch (Exception ex)
    {
        lblMessage.Text = ex.Message;
        lblMessage.CssClass = "ERROR";
    }
}

//Edit
Now my code works fine as long as I am not adding calender extender to the child page.
When I add calender extender in child page it shows error “The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>)”. If I remove calender extender, again it works well. By doing some googling, I found that <% %> in Javascript tag is creating problem. How can I solve it and why calender control is creating problem in such cases?

Here is the code for my script.

<script type="text/javascript">
    function uploadStarted() {
        $get("imgDisplay").style.display = "none";
    }
    function uploadComplete(sender, args) {
        var imgDisplay = $get("imgDisplay");
        //  var imgPhoto = $get("#imgPhoto");
        var imgPhoto = document.getElementById('<%=imgPhoto.ClientID %>');
        imgDisplay.src = "images/loader.gif";
        imgPhoto.style.display = "none";
        imgDisplay.style.cssText = "";
        var img = new Image();
        img.onload = function () {
            imgDisplay.style.cssText = "height:100px;width:100px";
            imgDisplay.src = img.src;
        };
        img.src = "<%=ResolveUrl(UploadFolderPath) %>" + args.get_fileName();

    }
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:42:34+00:00Added an answer on June 6, 2026 at 4:42 pm

    You need to register your JavaScript using the ScriptManager instance on your page – which you should already have if you’re using AJAX. It has its own RegisterStartupScript method that you can use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a ModalPopupextender Ajax Control to open aspx page in a modal
How to exit from iframe? I have a pages called Master.aspx , Parent.aspx (inside
I'm making an ajax request from an iframe that is injected onto every page
I am using Thickbox 3.1 for a login form, using the iframe version. I
I am using a hidden iframe to print page contents generated by php, this
I'm new at jquery, but I need to open some contents in an Iframe
I'm using Fancybox ( http://fancybox.net ) to pop open an iFrame. In order to
I have a website that consists of one parent page. Using the lightbox-style jQuery
I have an iframe that holds a page. Now on that page, I have
I'm using colorbox to open an iframe, inside which i'm calling jscrollpane to allow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.