469,898 Members | 1,563 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Include Files Dynamically

Hey there !

I made my own WebControl, that inherits from WebControls, and i added an
HtmlTable to it. I would like to include a file, dynamically, to one of its
cells... I've already searched, and found
HttpContext.Current.Server.Execute("mapage.aspx") but it executes the page
where i call it, and not in the cell... i also tried something like that :
MyTable.Rows(0).Cell(0).InnerHtml = Server.Execute("MaPage.aspx") but it
doesn't work... Could anybody help me ?

Merci d'avance :)

Ps : Scuse my english i'm french.
Nov 17 '05 #1
3 5586
I've also red the sound advices from Kevin Spencer... But how can i treat a
page as an object as to add it in my cell ?

thanks again...

"Quentin" <Sn****@pagesperso.org> a écrit dans le message de news:
uJ**************@TK2MSFTNGP11.phx.gbl...
Hey there !

I made my own WebControl, that inherits from WebControls, and i added an
HtmlTable to it. I would like to include a file, dynamically, to one of its cells... I've already searched, and found
HttpContext.Current.Server.Execute("mapage.aspx") but it executes the page
where i call it, and not in the cell... i also tried something like that :
MyTable.Rows(0).Cell(0).InnerHtml = Server.Execute("MaPage.aspx") but it
doesn't work... Could anybody help me ?

Merci d'avance :)

Ps : Scuse my english i'm french.

Nov 17 '05 #2
I would have liked to display a page in an other page... I know the <iframe>
but it's in html... If you know the object.NET to make an iframe it would be
great :) Cuz you're right it could a solution for my problem, make an iframe
in my cell, and just change dynamically the src property...

Thanks for your quick response :)
"Bjoern Wolfgardt" <bj**************@donotspamme-i-ventions.de> a écrit dans
le message de news: OU**************@tk2msftngp13.phx.gbl...
Hi,

what do you mean with: include a file

Do you want to include it like an javascript file: <script
language="javascript" src="blah"> ???
If so try this in your CustomControl:
protected override void OnInit(EventArgs e)
{
// Add JS to WebForm
string strScriptSrc = Context.Request.ApplicationPath + "/myscript.js";
string strScriptBlock = "<script type=\"text/javascript\" src='" +
strScriptSrc + "'></script>";
Page.RegisterClientScriptBlock("myOwnScript", strScriptBlock);
}

Or do you want to display a page in a page? Therefore look for <iframe>
elements.
http://msdn.microsoft.com/library/de...thor/dhtml/ref erence/objects/IFRAME.asp
http://msdn.microsoft.com/downloads/...sp?url=/downlo ads/samples/internet/author/databinding/data_iframe/default.asp

Hope this helps
Bjoern Wolfgardt

"Quentin" <Sn****@pagesperso.org> schrieb im Newsbeitrag
news:uJ**************@TK2MSFTNGP11.phx.gbl...
Hey there !

I made my own WebControl, that inherits from WebControls, and i added an
HtmlTable to it. I would like to include a file, dynamically, to one of

its
cells... I've already searched, and found
HttpContext.Current.Server.Execute("mapage.aspx") but it executes the page where i call it, and not in the cell... i also tried something like that : MyTable.Rows(0).Cell(0).InnerHtml = Server.Execute("MaPage.aspx") but it
doesn't work... Could anybody help me ?

Merci d'avance :)

Ps : Scuse my english i'm french.


Nov 17 '05 #3
Ahhh,

So you want to add it in the code behind.
So you can use the HtmlGenericControl . Its some kind of dummy control.
http://msdn.microsoft.com/library/de...us/cpgenref/ht
ml/cpconhtmlgenericcontrol.asp
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemWebUIHtmlControlsHtmlGenericControlClas sTopic.asp

My Example:
System.Web.UI.HtmlControls.HtmlGenericControl iframe = new
HtmlGenericControl("iframe");
iframe.Attributes.Add("src", "./yourpage.aspx");
iframe.Attributes.Add("width", "240px");
iframe.Attributes.Add("height", "200px");
iframe.Attributes.Add("frameborder", "0");
this.FindControl("Form1").Controls.Add(iframe);

Hope this helps
Bjoern Wolfgardt
"Quentin" <Sn****@pagesperso.org> schrieb im Newsbeitrag
news:#u*************@TK2MSFTNGP10.phx.gbl...
I would have liked to display a page in an other page... I know the <iframe> but it's in html... If you know the object.NET to make an iframe it would be great :) Cuz you're right it could a solution for my problem, make an iframe in my cell, and just change dynamically the src property...

Thanks for your quick response :)
"Bjoern Wolfgardt" <bj**************@donotspamme-i-ventions.de> a écrit dans le message de news: OU**************@tk2msftngp13.phx.gbl...
Hi,

what do you mean with: include a file

Do you want to include it like an javascript file: <script
language="javascript" src="blah"> ???
If so try this in your CustomControl:
protected override void OnInit(EventArgs e)
{
// Add JS to WebForm
string strScriptSrc = Context.Request.ApplicationPath + "/myscript.js";
string strScriptBlock = "<script type=\"text/javascript\" src='" +
strScriptSrc + "'></script>";
Page.RegisterClientScriptBlock("myOwnScript", strScriptBlock);
}

Or do you want to display a page in a page? Therefore look for <iframe>
elements.

http://msdn.microsoft.com/library/de...thor/dhtml/ref
erence/objects/IFRAME.asp

http://msdn.microsoft.com/downloads/...sp?url=/downlo
ads/samples/internet/author/databinding/data_iframe/default.asp

Hope this helps
Bjoern Wolfgardt

"Quentin" <Sn****@pagesperso.org> schrieb im Newsbeitrag
news:uJ**************@TK2MSFTNGP11.phx.gbl...
Hey there !

I made my own WebControl, that inherits from WebControls, and i added an HtmlTable to it. I would like to include a file, dynamically, to one of
its
cells... I've already searched, and found
HttpContext.Current.Server.Execute("mapage.aspx") but it executes the page where i call it, and not in the cell... i also tried something like
that : MyTable.Rows(0).Cell(0).InnerHtml = Server.Execute("MaPage.aspx") but

it doesn't work... Could anybody help me ?

Merci d'avance :)

Ps : Scuse my english i'm french.



Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Carolyn Speakman | last post: by
7 posts views Thread by Andre | last post: by
6 posts views Thread by tshad | last post: by
14 posts views Thread by Jon Rea | last post: by
23 posts views Thread by Big Bill | last post: by
2 posts views Thread by Jofio | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.