Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I have a view, inside view i am calling an aspx page to load report viewer. I wanted to pass the parameter of the url to the aspx page which is inside the iframe.

The browser url is localhost/Contract/ContractReport/12233

I want 12233 to be passed to the iframe source as ../../ContractReport.aspx?12233

Please give me suggestions
Posted

Simple call your page like this
HTML
<iframe src="/ContractReport.aspx?12233"></iframe>

------------- Updated Answer below

Set your URL in controller like this
C#
public ActionResult Index()
{
     ViewBag.myURL = "/abc.aspx?" + querystring; // set your dynamic URL here
     return View();
}

Then in your View,
HTML
<iframe id="iframe" src="@Url.Content(ViewBag.myURL)" style="width: 700; height: 700px;"></iframe>
 
Share this answer
 
v2
Comments
Ahamed Azeem 7-Feb-13 14:06pm    
Bro, it will not be same always.. I want it to take dynamically
[no name] 7-Feb-13 14:12pm    
You didn't mention it in your question. Then why don't you use viewbag?
Ahamed Azeem 7-Feb-13 14:17pm    
Yes I forgot to put for ex.

This is get so how can i use viewbag to pass from the controller
Ahamed Azeem 7-Feb-13 14:17pm    
and the link to this page is in another view
Ahamed Azeem 7-Feb-13 14:28pm    
I solved this myself @ViewContext.RouteData.Values["id"]
@ViewContext.RouteData.Values["id"]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900