is set, then the HTML code for the web control looks something like:
<mns:image id=MyImg runat=server ImageURL="images/somepath.jpg"></mns:image
Given i have some server variable Session("AppRoot") which declares the full
path to the root of the application, for example
Session("AppRoot") = "http://www.someserver.com/myapp/"
Now is there any way i can put the AppRoot variable directly into the HTML
control for the mns:image control, rather than having to put code in the .vb
file to do something like
MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
Could i somehow do SOMEthing like:
<mns:image id=MyImg runat=server
ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
</mns:imageThere are a number of things I don't understand.
1-
If this is your own server control, or you have access to the source, why
not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
class before the render? This way you don't have to worry about doing it
either at the page level or the codebehind. If you don't write your own
that inherits from this one.
2-
Does the AppRoot actually belong to the sesssion? it's specific to each
user?
3-
You can simply use ~ to denote the application root, ala:
ImageUrl="~/images/somepath.jpg"
4-
The answer to your question is no..but the solution in #1 will solve her
right up.
Karl
"A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> Given i have some control which has an "ImageURL" property. If this
property
> is set, then the HTML code for the web control looks something like:
> <mns:image id=MyImg runat=server
ImageURL="images/somepath.jpg"></mns:image>
> Given i have some server variable Session("AppRoot") which declares the
full
> path to the root of the application, for example
> Session("AppRoot") = "http://www.someserver.com/myapp/"
> Now is there any way i can put the AppRoot variable directly into the HTML
> control for the mns:image control, rather than having to put code in the
..vb
> file to do something like
> MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
> Could i somehow do SOMEthing like:
> <mns:image id=MyImg runat=server
> ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> </mns:image>
Well, i cannot code it into the code for the control, because the control is
made in a separate library meant ot be generic to NO app in specific.
I cannot use a Root path ("/" or "~") because the app does not root at the
root of the site.
The site's root is www.myserver.com/myapp, not www.myserver.com
Otherwise then i guess im just stuck having to alter the urls in the .vb
file then. Thats a little annoying. Itd be nice if you could somehow use
something like the databinding stuff to put out a server variable into
ASP.NET html code.
"Karl" <none> wrote in message news:e$mfDPTiEHA.1644@.tk2msftngp13.phx.gbl...
> There are a number of things I don't understand.
> 1-
> If this is your own server control, or you have access to the source, why
> not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
> class before the render? This way you don't have to worry about doing it
> either at the page level or the codebehind. If you don't write your own
> that inherits from this one.
> 2-
> Does the AppRoot actually belong to the sesssion? it's specific to each
> user?
> 3-
> You can simply use ~ to denote the application root, ala:
> ImageUrl="~/images/somepath.jpg"
> 4-
> The answer to your question is no..but the solution in #1 will solve her
> right up.
> Karl
> "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> > Given i have some control which has an "ImageURL" property. If this
> property
> > is set, then the HTML code for the web control looks something like:
> > <mns:image id=MyImg runat=server
> ImageURL="images/somepath.jpg"></mns:image>
> > Given i have some server variable Session("AppRoot") which declares the
> full
> > path to the root of the application, for example
> > Session("AppRoot") = "http://www.someserver.com/myapp/"
> > Now is there any way i can put the AppRoot variable directly into the
HTML
> > control for the mns:image control, rather than having to put code in the
> .vb
> > file to do something like
> > MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
> > Could i somehow do SOMEthing like:
> > <mns:image id=MyImg runat=server
> > ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> > </mns:image>
~ uses the virtual app..so it should be ~ should be equal to /myapp
and you could still make the code generic to no specific app (as it is now
actually, it's specific to apps at the root level so it isn't very
generic)...but ~ should do the trick.
Karl
"A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:eqKHwWTiEHA.3536@.TK2MSFTNGP12.phx.gbl...
> Well, i cannot code it into the code for the control, because the control
is
> made in a separate library meant ot be generic to NO app in specific.
> I cannot use a Root path ("/" or "~") because the app does not root at the
> root of the site.
> The site's root is www.myserver.com/myapp, not www.myserver.com
> Otherwise then i guess im just stuck having to alter the urls in the .vb
> file then. Thats a little annoying. Itd be nice if you could somehow use
> something like the databinding stuff to put out a server variable into
> ASP.NET html code.
> "Karl" <none> wrote in message
news:e$mfDPTiEHA.1644@.tk2msftngp13.phx.gbl...
> > There are a number of things I don't understand.
> > 1-
> > If this is your own server control, or you have access to the source,
why
> > not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
> > class before the render? This way you don't have to worry about doing it
> > either at the page level or the codebehind. If you don't write your
own
> > that inherits from this one.
> > 2-
> > Does the AppRoot actually belong to the sesssion? it's specific to each
> > user?
> > 3-
> > You can simply use ~ to denote the application root, ala:
> > ImageUrl="~/images/somepath.jpg"
> > 4-
> > The answer to your question is no..but the solution in #1 will solve her
> > right up.
> > Karl
> > "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> > news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> > > Given i have some control which has an "ImageURL" property. If this
> > property
> > > is set, then the HTML code for the web control looks something like:
> > > > <mns:image id=MyImg runat=server
> > ImageURL="images/somepath.jpg"></mns:image>
> > > > Given i have some server variable Session("AppRoot") which declares
the
> > full
> > > path to the root of the application, for example
> > > Session("AppRoot") = "http://www.someserver.com/myapp/"
> > > > Now is there any way i can put the AppRoot variable directly into the
> HTML
> > > control for the mns:image control, rather than having to put code in
the
> > .vb
> > > file to do something like
> > > MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
> > > > Could i somehow do SOMEthing like:
> > > > <mns:image id=MyImg runat=server
> > > ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> > > </mns:image>
> >
Hmm, .. well, i tried using the ~ instead and taking out my code in .vb to
prepend the approot to the path, but it does not work with the ~.
Thanks though for the idea.
"Karl" <none> wrote in message news:OKTWrbTiEHA.1384@.TK2MSFTNGP10.phx.gbl...
> ~ uses the virtual app..so it should be ~ should be equal to /myapp
> and you could still make the code generic to no specific app (as it is now
> actually, it's specific to apps at the root level so it isn't very
> generic)...but ~ should do the trick.
> Karl
> "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:eqKHwWTiEHA.3536@.TK2MSFTNGP12.phx.gbl...
> > Well, i cannot code it into the code for the control, because the
control
> is
> > made in a separate library meant ot be generic to NO app in specific.
> > I cannot use a Root path ("/" or "~") because the app does not root at
the
> > root of the site.
> > The site's root is www.myserver.com/myapp, not www.myserver.com
> > Otherwise then i guess im just stuck having to alter the urls in the .vb
> > file then. Thats a little annoying. Itd be nice if you could somehow use
> > something like the databinding stuff to put out a server variable into
> > ASP.NET html code.
> > "Karl" <none> wrote in message
> news:e$mfDPTiEHA.1644@.tk2msftngp13.phx.gbl...
> > > There are a number of things I don't understand.
> > > > 1-
> > > If this is your own server control, or you have access to the source,
> why
> > > not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in
the
> > > class before the render? This way you don't have to worry about doing
it
> > > either at the page level or the codebehind. If you don't write your
> own
> > > that inherits from this one.
> > > > 2-
> > > Does the AppRoot actually belong to the sesssion? it's specific to
each
> > > user?
> > > > 3-
> > > You can simply use ~ to denote the application root, ala:
> > > ImageUrl="~/images/somepath.jpg"
> > > > 4-
> > > The answer to your question is no..but the solution in #1 will solve
her
> > > right up.
> > > > Karl
> > > > "A Traveler" <hitchhikersguideto-news@.yahoo.com> wrote in message
> > > news:u8B8WfSiEHA.2952@.TK2MSFTNGP09.phx.gbl...
> > > > Given i have some control which has an "ImageURL" property. If this
> > > property
> > > > is set, then the HTML code for the web control looks something like:
> > > > > > <mns:image id=MyImg runat=server
> > > ImageURL="images/somepath.jpg"></mns:image>
> > > > > > Given i have some server variable Session("AppRoot") which declares
> the
> > > full
> > > > path to the root of the application, for example
> > > > Session("AppRoot") = "http://www.someserver.com/myapp/"
> > > > > > Now is there any way i can put the AppRoot variable directly into
the
> > HTML
> > > > control for the mns:image control, rather than having to put code in
> the
> > > .vb
> > > > file to do something like
> > > > MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
> > > > > > Could i somehow do SOMEthing like:
> > > > > > <mns:image id=MyImg runat=server
> > > > ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> > > > </mns:image>
> > > > > >
0 comments:
Post a Comment