Include Files Dynamically

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default 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.


    Quentin Guest

  2. Similar Questions and Discussions

    1. how do I hide database connection files using PHP include files?
      I have the following at the beginning of the PHP page: <?php require_once('Connections/conn.php'); ?> I want to hide the connection file,...
    2. Include Files Dynamically Based On User Selection !
      http://www.aspfaq.com/2042 "Lovely Angel For You" <lovely_angel_for_you@yahoo.com> wrote in message...
    3. Include files in .NET
      Hi, Does anyone know the syntax to include a .js file in an ASPX page. Colm
    4. DM MX and Include files
      We recently converted from MS Interdev to DW MX and I have copied the files for our existing site into a local site in DW. Most of our pages have SSI...
    5. include files
      Hi all, I used to use the include statement in classic asp to centralise my database connection, is there a better way in asp.net, whats the...
  3. #2

    Default Re: Include Files Dynamically

    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" <Snyfer@pagesperso.org> a écrit dans le message de news:
    [email]uJRR2ERVDHA.2156@TK2MSFTNGP11.phx.gbl[/email]...
    > 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.
    >
    >

    Quentin Guest

  4. #3

    Default Re: Include Files Dynamically

    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" <bjoern.wolfgardt@donotspamme-i-ventions.de> a écrit dans
    le message de news: OUv$tLRVDHA.2544@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.
    >
    [url]http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/ref[/url]
    > erence/objects/IFRAME.asp
    >
    [url]http://msdn.microsoft.com/downloads/samples/internet/default.asp?url=/downlo[/url]
    > ads/samples/internet/author/databinding/data_iframe/default.asp
    >
    > Hope this helps
    > Bjoern Wolfgardt
    >
    >
    >
    > "Quentin" <Snyfer@pagesperso.org> schrieb im Newsbeitrag
    > news:uJRR2ERVDHA.2156@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.
    > >
    > >
    >
    >

    Quentin Guest

  5. #4

    Default Re: Include Files Dynamically

    Ahhh,

    So you want to add it in the code behind.
    So you can use the HtmlGenericControl . Its some kind of dummy control.
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/ht[/url]
    ml/cpconhtmlgenericcontrol.asp
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/[/url]
    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" <Snyfer@pagesperso.org> schrieb im Newsbeitrag
    news:#uLWeXRVDHA.532@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" <bjoern.wolfgardt@donotspamme-i-ventions.de> a écrit
    dans
    > le message de news: OUv$tLRVDHA.2544@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.
    > >
    >
    [url]http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/ref[/url]
    > > erence/objects/IFRAME.asp
    > >
    >
    [url]http://msdn.microsoft.com/downloads/samples/internet/default.asp?url=/downlo[/url]
    > > ads/samples/internet/author/databinding/data_iframe/default.asp
    > >
    > > Hope this helps
    > > Bjoern Wolfgardt
    > >
    > >
    > >
    > > "Quentin" <Snyfer@pagesperso.org> schrieb im Newsbeitrag
    > > news:uJRR2ERVDHA.2156@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.
    > > >
    > > >
    > >
    > >
    >
    >

    Bjoern Wolfgardt Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139