如何将参数传递给iframe [英] How to pass parameters to iframe

查看:289
本文介绍了如何将参数传递给iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我有aspx页面(使用母版页面),里面有两个iFrame

1.它包含下拉列表来过滤数据

2.它保存要显示的数据



我的问题是,在第一个iFrame中通过javascript我根据下拉列表设置第二个iFrame src值已选中。第二个iFrame src URL包含查询字符串中的参数



eq。 wf_PrjEstDetails.aspx?id = 0



但是当我尝试使用<在wf_PrjEstDetails.aspx页面中的查询字符串中访问参数时code> Request.QueryString [id] ,它给我空值。



你能告诉我我是怎么回事可以传递和访问查询字符串中的参数吗?



这是我的JavaScript方法:

Hi friends,
I have aspx page(uses master page), which has two iFrame
1. it contains dropdown list to filter the data
2. it holds the data to be displayed

My problem is, in 1st iFrame through javascript I''m setting 2nd iFrame src depending upon the dropdown value selected. 2nd iFrame src URL contains parameter in the query string

eq. wf_PrjEstDetails.aspx?id=0"

but when I try to access the parameter in the querystring in the wf_PrjEstDetails.aspx page using Request.QueryString["id"], it gives me null value.

Can you please tell me how i can pass and access the parameter in the querystring ?

This is my JavaScript Method:

function openWinSPV(strPath, object,objname)
{
   var selectedText = window.parent.frames(0).window.document.getElementById('ddlAccount').selectedIndex;
   var drpacc = window.parent.frames(0).window.document.getElementById('ddlAccount').options[selectedText].text;
   if(drpacc.indexOf("Select")!=-1)
   {
      alert('Please select an account!!!');
      return false;
   }

   selectedText = window.parent.frames(0).window.document.getElementById('ddlContract').selectedIndex;
   var drpcontract = window.parent.frames(0).window.document.getElementById('ddlContract').options[selectedText].text;
   if(drpcontract=="" ||drpcontract.indexOf("Select")!=-1)
   {
      alert('Please select the Contract!!!');
      return false;
   }
   selectedText = window.parent.frames(0).window.document.getElementById('ddlAccount').selectedIndex;
   //var arg= window.parent.frames(0).window.document.getElementById('ddlAccount').value;
   var arg= window.parent.frames(0).window.document.getElementById('ddlAccount').value;
   //alert(arg);
   strPath+="&id1="+ arg;
   arg= window.parent.frames(0).window.document.getElementById('ddlContract').value;
   //alert(arg);
   strPath+="&id2="+ arg;
   //if(window.parent.frames(0).window.document.getElementById('hdGrpCtr').value>0)
   
   if(window.parent.frames(0).window.document.getElementById('lblGrName')!= null)
   {  arg= window.parent.frames(0).window.document.getElementById('ddlGroup').value;
      //alert(arg);
      strPath+="&id3="+ arg;
   }
   else
   {       
      strPath+="&id3=0";
      arg=window.parent.frames(0).window.document.getElementById('ddlEstimate').value;
      strPath+="&id4="+ arg;
      strPath = strPath + "&random='" + Math.random() + "'"; //Added for call ID - 94483 to avoid caching of pages
      alert(strPath);
      window.parent.frames(2).document.location.href = strPath;
      //var newWindow=window.open(strPath,object);
      //newWindow.focus();
    }



我在wf_PrjEstDetails.aspx页面写了jquery方法


I have written jquery method in wf_PrjEstDetails.aspx page

$(document).ready(function () {
                var qs = window.location.toString(); //.split("?")[1];
                //qs = qs.replace("id=", "");
                alert(qs);
                //                return qs;
            });



它给出了一些加密参数的URL,这个原因在后面的代码中是不是能在QueryString中找到id?



有什么想法吗? ?



提前致谢


It gives some URL with encrypted parameters, is this reason in code behind it is not able to find id in QueryString??

Any idea??

Thanks in advance

推荐答案

document ).ready( function (){
var qs = window location .toString(); // .split(?)[1];
// qs = qs.replace(id =,);
alert(qs);
// return qs;
});
(document).ready(function () { var qs = window.location.toString(); //.split("?")[1]; //qs = qs.replace("id=", ""); alert(qs); // return qs; });



它给出了一些加密参数的URL,这个原因在它背后的代码中是不是能在QueryString中找到id ??



任何想法??



提前致谢


It gives some URL with encrypted parameters, is this reason in code behind it is not able to find id in QueryString??

Any idea??

Thanks in advance


<% Int64 ss =Convert.ToInt64( Request.QueryString["id"].ToString());%>
                       <% string bb = ss.ToString().Insert(0, "testing.aspx?id="); %>

                           <iframe  src="<%=bb %>"   style="height: 100%; width: 100%; border: 0px;">
                           </iframe>

这篇关于如何将参数传递给iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆