Include Files Dynamically

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Quentin

    #1

    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.Cur rent.Server.Exe cute("mapage.as px") 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).InnerH tml = Server.Execute( "MaPage.asp x") but it
    doesn't work... Could anybody help me ?

    Merci d'avance :)

    Ps : Scuse my english i'm french.


  • Quentin

    #2
    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@pagespe rso.org> a écrit dans le message de news:
    uJRR2ERVDHA.215 6@TK2MSFTNGP11. phx.gbl...[color=blue]
    > 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[/color]
    its[color=blue]
    > cells... I've already searched, and found
    > HttpContext.Cur rent.Server.Exe cute("mapage.as px") 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).InnerH tml = Server.Execute( "MaPage.asp x") but it
    > doesn't work... Could anybody help me ?
    >
    > Merci d'avance :)
    >
    > Ps : Scuse my english i'm french.
    >
    >[/color]


    Comment

    • Quentin

      #3
      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.wolfgar dt@donotspamme-i-ventions.de> a écrit dans
      le message de news: OUv$tLRVDHA.254 4@tk2msftngp13. phx.gbl...[color=blue]
      > Hi,
      >
      > what do you mean with: include a file
      >
      > Do you want to include it like an javascript file: <script
      > language="javas cript" src="blah"> ???
      > If so try this in your CustomControl:
      > protected override void OnInit(EventArg s e)
      > {
      > // Add JS to WebForm
      > string strScriptSrc = Context.Request .ApplicationPat h + "/myscript.js";
      > string strScriptBlock = "<script type=\"text/javascript\" src='" +
      > strScriptSrc + "'></script>";
      > Page.RegisterCl ientScriptBlock ("myOwnScrip t", strScriptBlock) ;
      > }
      >
      > Or do you want to display a page in a page? Therefore look for <iframe>
      > elements.
      >[/color]
      http://msdn.microsoft.com/library/de...thor/dhtml/ref[color=blue]
      > erence/objects/IFRAME.asp
      >[/color]
      http://msdn.microsoft.com/downloads/...sp?url=/downlo[color=blue]
      > ads/samples/internet/author/databinding/data_iframe/default.asp
      >
      > Hope this helps
      > Bjoern Wolfgardt
      >
      >
      >
      > "Quentin" <Snyfer@pagespe rso.org> schrieb im Newsbeitrag
      > news:uJRR2ERVDH A.2156@TK2MSFTN GP11.phx.gbl...[color=green]
      > > 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[/color]
      > its[color=green]
      > > cells... I've already searched, and found
      > > HttpContext.Cur rent.Server.Exe cute("mapage.as px") but it executes the[/color][/color]
      page[color=blue][color=green]
      > > where i call it, and not in the cell... i also tried something like that[/color][/color]
      :[color=blue][color=green]
      > > MyTable.Rows(0) .Cell(0).InnerH tml = Server.Execute( "MaPage.asp x") but it
      > > doesn't work... Could anybody help me ?
      > >
      > > Merci d'avance :)
      > >
      > > Ps : Scuse my english i'm french.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Bjoern Wolfgardt

        #4
        Re: Include Files Dynamically

        Ahhh,

        So you want to add it in the code behind.
        So you can use the HtmlGenericCont rol . Its some kind of dummy control.
        http://msdn.microsoft.com/library/de...us/cpgenref/ht
        ml/cpconhtmlgeneri ccontrol.asp
        http://msdn.microsoft.com/library/de...us/cpref/html/
        frlrfSystemWebU IHtmlControlsHt mlGenericContro lClassTopic.asp

        My Example:
        System.Web.UI.H tmlControls.Htm lGenericControl iframe = new
        HtmlGenericCont rol("iframe");
        iframe.Attribut es.Add("src", "./yourpage.aspx") ;
        iframe.Attribut es.Add("width", "240px");
        iframe.Attribut es.Add("height" , "200px");
        iframe.Attribut es.Add("framebo rder", "0");
        this.FindContro l("Form1").Cont rols.Add(iframe );

        Hope this helps
        Bjoern Wolfgardt


        "Quentin" <Snyfer@pagespe rso.org> schrieb im Newsbeitrag
        news:#uLWeXRVDH A.532@TK2MSFTNG P10.phx.gbl...[color=blue]
        > I would have liked to display a page in an other page... I know the[/color]
        <iframe>[color=blue]
        > but it's in html... If you know the object.NET to make an iframe it would[/color]
        be[color=blue]
        > great :) Cuz you're right it could a solution for my problem, make an[/color]
        iframe[color=blue]
        > in my cell, and just change dynamically the src property...
        >
        > Thanks for your quick response :)
        >
        >
        > "Bjoern Wolfgardt" <bjoern.wolfgar dt@donotspamme-i-ventions.de> a écrit[/color]
        dans[color=blue]
        > le message de news: OUv$tLRVDHA.254 4@tk2msftngp13. phx.gbl...[color=green]
        > > Hi,
        > >
        > > what do you mean with: include a file
        > >
        > > Do you want to include it like an javascript file: <script
        > > language="javas cript" src="blah"> ???
        > > If so try this in your CustomControl:
        > > protected override void OnInit(EventArg s e)
        > > {
        > > // Add JS to WebForm
        > > string strScriptSrc = Context.Request .ApplicationPat h + "/myscript.js";
        > > string strScriptBlock = "<script type=\"text/javascript\" src='" +
        > > strScriptSrc + "'></script>";
        > > Page.RegisterCl ientScriptBlock ("myOwnScrip t", strScriptBlock) ;
        > > }
        > >
        > > Or do you want to display a page in a page? Therefore look for <iframe>
        > > elements.
        > >[/color]
        >[/color]
        http://msdn.microsoft.com/library/de...thor/dhtml/ref[color=blue][color=green]
        > > erence/objects/IFRAME.asp
        > >[/color]
        >[/color]
        http://msdn.microsoft.com/downloads/...sp?url=/downlo[color=blue][color=green]
        > > ads/samples/internet/author/databinding/data_iframe/default.asp
        > >
        > > Hope this helps
        > > Bjoern Wolfgardt
        > >
        > >
        > >
        > > "Quentin" <Snyfer@pagespe rso.org> schrieb im Newsbeitrag
        > > news:uJRR2ERVDH A.2156@TK2MSFTN GP11.phx.gbl...[color=darkred]
        > > > Hey there !
        > > >
        > > > I made my own WebControl, that inherits from WebControls, and i added[/color][/color][/color]
        an[color=blue][color=green][color=darkred]
        > > > HtmlTable to it. I would like to include a file, dynamically, to one[/color][/color][/color]
        of[color=blue][color=green]
        > > its[color=darkred]
        > > > cells... I've already searched, and found
        > > > HttpContext.Cur rent.Server.Exe cute("mapage.as px") but it executes the[/color][/color]
        > page[color=green][color=darkred]
        > > > where i call it, and not in the cell... i also tried something like[/color][/color][/color]
        that[color=blue]
        > :[color=green][color=darkred]
        > > > MyTable.Rows(0) .Cell(0).InnerH tml = Server.Execute( "MaPage.asp x") but[/color][/color][/color]
        it[color=blue][color=green][color=darkred]
        > > > doesn't work... Could anybody help me ?
        > > >
        > > > Merci d'avance :)
        > > >
        > > > Ps : Scuse my english i'm french.
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...