Every time i am about to post a thread i get an answer while typing the message, maybe i explain it to myself better when i write it , OK so if you have seen this post it means i have not find an answer :)

I have a Silverlight app that passes a query string to an asp.net page that has an iframe that is hosting a third-party gateway page as depicted below

<form id="Form1" runat="server"  method="post" >
        <input type="hidden" name="p1" value='<%=(MerchantID) %>' />
        <input type="hidden" name="p2" value='<%=(GetNextTransID) %>' />
        <input type="hidden" name="p3" value='Purchase credits' />
        <input type="hidden" name="p4" value='<%=(Amount) %>' />
        <input type="hidden" name="m_1" value='<%=(Userid) %>' />
        <input type="hidden" name="m_2" value='<%=(Schoolid) %>' />
    <asp:Panel ID="Panel1"  runat="server">
        <table class="style1">
                <td class="style2">
                <td style="text-align: center">
    <div id="layer1" 
        style="position: absolute; width: 759px; height: 357px; z-index: 1; left: 88px; top: 233px">
        <iframe id="iframecredit" name="I1"    src="https://www.vcs.co.za/vvonline/ccform.asp"
            style="width: 744px; height: 333px; margin-top: 16px; margin-bottom: 0px;">

		Your browser does not support inline frames or is currently configured not to display inline frames.
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        <img alt="Ecash" height="609" src="images/BG.jpg" width="924" />


This payment gateway page accepts the parameters as you can see them there, so i have Properties that has values "After the Page load" so i cant get the values of the Query string before the page load. now the iframe will load with empty values, now i want to initialize the values before the iframe gets displayed

so my Page load will look like this

protected void Page_Load(object sender, EventArgs e)

                    m_SchoolId = Request.QueryString["SchoolID"];

                     m_MerchantId =  Request.QueryString["MerchantID"];
                     MerchantID =m_MerchantId;

                     Guid g;
                     g = Guid.NewGuid();
                     GetNextTransID = g.ToString();

                     m_Userid = Request.QueryString["UserID"];
                     Userid = m_Userid;

                     Schoolid = m_SchoolId;

                     m_Amount = Request.QueryString["Amount"];
                     Amount = m_Amount;  

I can step through this and i can get the values that i expect , but the problem is that the iframe URL get rendered first and obviously the values of the page load wouldn't have have values by that that time, how do i bypass this. any idea?



If you want to bypass the loading of IFRAME in page load and re-load the url (src property of IFRAME) later, then set src property to empty string("") in the HTML markup (.aspx page). You can set the url in your .cs code as follows.

protected void Button1_Click(object sender, EventArgs e)
        iframecredit.Attributes.Add("src", "https://www.vcs.co.za/vvonline/ccform.asp");


I have done the following

i have set the SCR to an empty string

<iframe  name="I1" src=""   
            style="width: 744px; height: 305px; margin-top: 16px; margin-bottom: 0px;">
		Your browser does not support inline frames or is currently configured not to display inline frames.

and on body load i have called a javascript

<body  onload="loadIframe();" >

and my javascript looks like this

<script type="text/javascript">
        function loadIframe() {
            document.getElementById("I1").src = "https: //www.vcs.co.za/vvonline/ccform.asp";
            return false;

but it does not show the URL in the Iframe


Since you are trying to set the url "https: //www.vcs.co.za/vvonline/ccform.asp" which is not in the same domain, The iframe may not be refreshed due to browser security reasons. If you set the url from the current domain, it will work. Otherwise you need to set the url from code behind(.cs) as it executed from a full postback.

sorry i saw that space in the other URL , i am trying to use the same url , i have change it , but nothing is happening


Removing the space in the URL works for me in IE7 but not in Firefox 4.0.

You are using the name of the IFRAME in the getElementById() function. You need to use the ID of the IFRAME instead of name. Hence changing the following statement works for me in both IE7 and Firefox4.0.

function loadIframe() {
document.getElementById("iframecredit").src = "https://www.vcs.co.za/vvonline/ccform.asp";
return false;

Here 'iframecredit' is given as ID of the IFRAME in your first post.