473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 5713
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Carolyn Speakman | last post by:
is it in any way possible to include a file specified by a variable name? Thanks, Carolyn
7
by: Andre | last post by:
I want to condition what include files are included in an web page (.aspx). Something like: if (condition1) { <!-- #Include File='file1.htm' --> } else if (condition2) { <!-- #Include...
6
by: tshad | last post by:
In my User control, I tried to do this: *************************************************************************** <Script runat="server"> Public ClientName As String = "<!-- #include file =...
1
by: Dave | last post by:
I have two environments: DEV and PROD. In DEV I have two independent webs. In PROD one of the webs is the root and the other is a subweb of the root. Each enviornment has a different file system...
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
3
by: Larry | last post by:
Hi, I need a method to dynamically include a server side include in my asp.net page. The problem is, the include file contains asp.net controls, and I can't find a way to get the controls to...
23
by: Big Bill | last post by:
http://www.promcars.co.uk/pages/bonnie.php I don't believe they should be there, can I take them out without stopping the includes from functioning? I'm the (hapless) optimiser on this one... I...
2
by: Jofio | last post by:
I have 3 files, namely: dArray.h dArray.cp TestdArray.cpp Problem is when I compile the 'main' program - TestdArray.cpp - , it (the compiller) produces the following error: 'Unable to open...
3
by: Yi Chen | last post by:
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.