Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to embed a web site url using Object tag. for this I need to use runat = 'server'.
It is throwing error to have a classid. How do I get the classid for a website url.

Is there any way that I can embed webside other than object. I tried with 'iframes' but the site inside iframes is always showing the homepage no matter what link I click in that page.

your help or ideas are welcome
Posted
Comments
fjdiewornncalwe 17-Jan-13 17:01pm    
Could you show us the code for the object tag in question? From your question the way it stands it is very difficult to make out what you really need.
mechary 17-Jan-13 18:07pm    
Marcus thanks for your reply, here is my code

<object id="myObj" type="text/html" data="http://www.xyz.com" style="height:800px;width:800px;" />

Now I need to change the value for DATA element at server side in c#.net. For this I'm trying to put runat="server" and getting error to have ProgId or ClassId. Not sure what would be the values for that. Any help/suggestion is appreciated. I dont want to use IFRAME for this.

1 solution

Instead of setting object as a server side variable you can try as follows.

HTML
<object id="myObj" type="text/html" data="<%=url %>" style="height:800px;width:800px;" />

In here url is a server side variable.

some times you want to set the param fields also
HTML
<object id="myObj" type="text/html" data="<%=url %>" style="height:800px;width:800px;" 
                        width="900px" height="60">
                        <param name="movie" value="<%=url %>" />                        
                    </object>


for the iFrame also you can use the same way to set the src.

also, here are some alternative ways
http://forums.asp.net/t/1445587.aspx/1[^]
http://stackoverflow.com/questions/10907607/what-is-the-best-way-of-setting-the-src-of-an-iframe-from-a-codebehind-file-in-a[^]
 
Share this answer
 
v2
Comments
mechary 17-Jan-13 22:04pm    
Thanks Tharaka, but when I'm using iframes, I'm not able to navigate
within iframes. Whatever the link I'm clicking in the webpage in URL,
it is always redirecting to home page. with OBJECT tag it is working
perfectly, so need to know how to use runat tag to access myObject
from codebehind? any idea? Thank you
Tharaka MTR 17-Jan-13 22:16pm    
just for the verification, instead of using runat tag, can't you use set the data variable from the server side as in my example?
mechary 17-Jan-13 22:20pm    
no actually I need to capture the url whatever the user navigating within the OBJECT.

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