| Author |
Message |
bhprogrammer8
Guest
|
Posted:
Fri Oct 21, 2005 4:51 pm Post subject:
Header.ascx and Dynamic Images |
|
|
I am new to CMS. I have been assigned to a half finished project, and have
not been involved from the beginning. I would like to change the Header.ascx
file which includes a LOGO image in the upperleft corner, to dynamically grab
the correct image based on which CHANNEL the visitor is browsing. I am
digging through 3 different MCMS books, and online tech docs and forums, but
cannot figure out this seemingly easy task. The site is done in C#, i am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO" and a
value "channelname.jpg". I am sure there is a method of Getting the Channel
Name and displaying the image based on the property for that channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance. |
|
| Back to top |
|
 |
Björn Bur
Guest
|
Posted:
Mon Oct 24, 2005 8:51 am Post subject:
Re: Header.ascx and Dynamic Images |
|
|
hello...
you can access the channel object and it's custom properties by using the
cms api as followed...
CmsHttpContext.Current.Channel.CustomProperties["CustomPropertyName"].Value
greets
björn
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
| Quote: | I am new to CMS. I have been assigned to a half finished project, and have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to dynamically
grab
the correct image based on which CHANNEL the visitor is browsing. I am
digging through 3 different MCMS books, and online tech docs and forums,
but
cannot figure out this seemingly easy task. The site is done in C#, i am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO" and a
value "channelname.jpg". I am sure there is a method of Getting the
Channel
Name and displaying the image based on the property for that channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
Stefan [MSFT]
Guest
|
Posted:
Mon Oct 24, 2005 12:51 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
| Quote: | I am new to CMS. I have been assigned to a half finished project, and have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to dynamically
grab
the correct image based on which CHANNEL the visitor is browsing. I am
digging through 3 different MCMS books, and online tech docs and forums,
but
cannot figure out this seemingly easy task. The site is done in C#, i am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO" and a
value "channelname.jpg". I am sure there is a method of Getting the
Channel
Name and displaying the image based on the property for that channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
bhprogrammer8
Guest
|
Posted:
Mon Oct 24, 2005 4:51 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
| Quote: | Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project, and have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to dynamically
grab
the correct image based on which CHANNEL the visitor is browsing. I am
digging through 3 different MCMS books, and online tech docs and forums,
but
cannot figure out this seemingly easy task. The site is done in C#, i am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO" and a
value "channelname.jpg". I am sure there is a method of Getting the
Channel
Name and displaying the image based on the property for that channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
Stefan [MSFT]
Guest
|
Posted:
Mon Oct 24, 2005 4:51 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Hi,
If your custom property only contains the name of the image and not the
complete URL you need to add the path in front of it.
If the custom property holds the URL the code below will be correct.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:CF99E7B2-53D2-496D-B929-792E9D83F857@microsoft.com...
| Quote: | Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project, and
have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is browsing. I am
digging through 3 different MCMS books, and online tech docs and
forums,
but
cannot figure out this seemingly easy task. The site is done in C#, i
am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO"
and a
value "channelname.jpg". I am sure there is a method of Getting the
Channel
Name and displaying the image based on the property for that channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
bhprogrammer8
Guest
|
Posted:
Mon Oct 24, 2005 4:51 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Thank you Stefan for your help. I am still struggling with this simple job.
Here is my code
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.Imagelogo.ImageUrl = "http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
but when I browse, I just get an EMPTY Box where the image should be. Is
there something else CMS related I need to do besides the custom property
setting? A resource or something?
Right Clicking the image in browser gives me NOT AVAILBLE.
Please point me in the right direction.
B
I am not getting any errors but when i view the page in my browser, I get
"Stefan [MSFT]" wrote:
| Quote: | Hi,
If your custom property only contains the name of the image and not the
complete URL you need to add the path in front of it.
If the custom property holds the URL the code below will be correct.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:CF99E7B2-53D2-496D-B929-792E9D83F857@microsoft.com...
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project, and
have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is browsing. I am
digging through 3 different MCMS books, and online tech docs and
forums,
but
cannot figure out this seemingly easy task. The site is done in C#, i
am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO"
and a
value "channelname.jpg". I am sure there is a method of Getting the
Channel
Name and displaying the image based on the property for that channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
Stefan [MSFT]
Guest
|
Posted:
Mon Oct 24, 2005 8:51 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Hi,
what do you mean with "empty box"?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:296721A9-8B14-4623-92B6-6779F27B6EC2@microsoft.com...
| Quote: | Thank you Stefan for your help. I am still struggling with this simple
job.
Here is my code
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.Imagelogo.ImageUrl = "http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
but when I browse, I just get an EMPTY Box where the image should be. Is
there something else CMS related I need to do besides the custom property
setting? A resource or something?
Right Clicking the image in browser gives me NOT AVAILBLE.
Please point me in the right direction.
B
I am not getting any errors but when i view the page in my browser, I get
"Stefan [MSFT]" wrote:
Hi,
If your custom property only contains the name of the image and not the
complete URL you need to add the path in front of it.
If the custom property holds the URL the code below will be correct.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:CF99E7B2-53D2-496D-B929-792E9D83F857@microsoft.com...
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project,
and
have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is browsing. I
am
digging through 3 different MCMS books, and online tech docs and
forums,
but
cannot figure out this seemingly easy task. The site is done in C#,
i
am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO"
and a
value "channelname.jpg". I am sure there is a method of Getting the
Channel
Name and displaying the image based on the property for that
channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
Stefan [MSFT]
Guest
|
Posted:
Tue Oct 25, 2005 12:50 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Hi Beth,
please use view source in IE for to get the rendered html and then verify
the URL for the image in the html code.
Is it as expected?
If yes, enter this URL in IE. Does it show the image now?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:63DCECC0-8098-493A-914F-5988B884E7C4@microsoft.com...
| Quote: | Stefan,
My apologies for being so vague. I am referring to a place on the page
where an image is supposed to be. Normally if you refer to an image that
doesn't exist, a web page will show a Red "x" box and you can still see
the
image's path if you look at the properties of it. In my case, I just see
a
small "blank-transparent-blank-box" area where the image SHOULD show up.
And
the properties just say NOT AVAILABLE, so I know it isn't getting the
correct
path. The image exists in the path I have programmed, and the Custom
Property exists for each channel as I have explained before.
I am wondering if I need to be BINDING the image DATA somehow. If so,
what
is the correct CMS statement to bind to properties data?
Thanks,
Beth
"Stefan [MSFT]" wrote:
Hi,
what do you mean with "empty box"?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:296721A9-8B14-4623-92B6-6779F27B6EC2@microsoft.com...
Thank you Stefan for your help. I am still struggling with this simple
job.
Here is my code
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.Imagelogo.ImageUrl = "http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
but when I browse, I just get an EMPTY Box where the image should be.
Is
there something else CMS related I need to do besides the custom
property
setting? A resource or something?
Right Clicking the image in browser gives me NOT AVAILBLE.
Please point me in the right direction.
B
I am not getting any errors but when i view the page in my browser, I
get
"Stefan [MSFT]" wrote:
Hi,
If your custom property only contains the name of the image and not
the
complete URL you need to add the path in front of it.
If the custom property holds the URL the code below will be correct.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:CF99E7B2-53D2-496D-B929-792E9D83F857@microsoft.com...
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project,
and
have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is browsing.
I
am
digging through 3 different MCMS books, and online tech docs and
forums,
but
cannot figure out this seemingly easy task. The site is done in
C#,
i
am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name
"LOGO"
and a
value "channelname.jpg". I am sure there is a method of Getting
the
Channel
Name and displaying the image based on the property for that
channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
bhprogrammer8
Guest
|
Posted:
Tue Oct 25, 2005 12:50 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Stefan,
My apologies for being so vague. I am referring to a place on the page
where an image is supposed to be. Normally if you refer to an image that
doesn't exist, a web page will show a Red "x" box and you can still see the
image's path if you look at the properties of it. In my case, I just see a
small "blank-transparent-blank-box" area where the image SHOULD show up. And
the properties just say NOT AVAILABLE, so I know it isn't getting the correct
path. The image exists in the path I have programmed, and the Custom
Property exists for each channel as I have explained before.
I am wondering if I need to be BINDING the image DATA somehow. If so, what
is the correct CMS statement to bind to properties data?
Thanks,
Beth
"Stefan [MSFT]" wrote:
| Quote: | Hi,
what do you mean with "empty box"?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:296721A9-8B14-4623-92B6-6779F27B6EC2@microsoft.com...
Thank you Stefan for your help. I am still struggling with this simple
job.
Here is my code
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.Imagelogo.ImageUrl = "http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
but when I browse, I just get an EMPTY Box where the image should be. Is
there something else CMS related I need to do besides the custom property
setting? A resource or something?
Right Clicking the image in browser gives me NOT AVAILBLE.
Please point me in the right direction.
B
I am not getting any errors but when i view the page in my browser, I get
"Stefan [MSFT]" wrote:
Hi,
If your custom property only contains the name of the image and not the
complete URL you need to add the path in front of it.
If the custom property holds the URL the code below will be correct.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:CF99E7B2-53D2-496D-B929-792E9D83F857@microsoft.com...
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project,
and
have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is browsing. I
am
digging through 3 different MCMS books, and online tech docs and
forums,
but
cannot figure out this seemingly easy task. The site is done in C#,
i
am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO"
and a
value "channelname.jpg". I am sure there is a method of Getting the
Channel
Name and displaying the image based on the property for that
channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
bhprogrammer8
Guest
|
Posted:
Wed Oct 26, 2005 4:51 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Stefan,
I have looked at the rendered html and found this piece where the image
should show up. <img id="Header21_ImageLogo" alt="" border="0" /> Header2
is the name of the control file, and ImageLogo is the name of the image
control on the page. Again, here is the code on the page...
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.ImageLogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["Logo"].Value;
"Stefan [MSFT]" wrote:
| Quote: | Hi Beth,
please use view source in IE for to get the rendered html and then verify
the URL for the image in the html code.
Is it as expected?
If yes, enter this URL in IE. Does it show the image now?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:63DCECC0-8098-493A-914F-5988B884E7C4@microsoft.com...
Stefan,
My apologies for being so vague. I am referring to a place on the page
where an image is supposed to be. Normally if you refer to an image that
doesn't exist, a web page will show a Red "x" box and you can still see
the
image's path if you look at the properties of it. In my case, I just see
a
small "blank-transparent-blank-box" area where the image SHOULD show up.
And
the properties just say NOT AVAILABLE, so I know it isn't getting the
correct
path. The image exists in the path I have programmed, and the Custom
Property exists for each channel as I have explained before.
I am wondering if I need to be BINDING the image DATA somehow. If so,
what
is the correct CMS statement to bind to properties data?
Thanks,
Beth
"Stefan [MSFT]" wrote:
Hi,
what do you mean with "empty box"?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:296721A9-8B14-4623-92B6-6779F27B6EC2@microsoft.com...
Thank you Stefan for your help. I am still struggling with this simple
job.
Here is my code
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.Imagelogo.ImageUrl = "http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
but when I browse, I just get an EMPTY Box where the image should be.
Is
there something else CMS related I need to do besides the custom
property
setting? A resource or something?
Right Clicking the image in browser gives me NOT AVAILBLE.
Please point me in the right direction.
B
I am not getting any errors but when i view the page in my browser, I
get
"Stefan [MSFT]" wrote:
Hi,
If your custom property only contains the name of the image and not
the
complete URL you need to add the path in front of it.
If the custom property holds the URL the code below will be correct.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:CF99E7B2-53D2-496D-B929-792E9D83F857@microsoft.com...
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project,
and
have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is browsing.
I
am
digging through 3 different MCMS books, and online tech docs and
forums,
but
cannot figure out this seemingly easy task. The site is done in
C#,
i
am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name
"LOGO"
and a
value "channelname.jpg". I am sure there is a method of Getting
the
Channel
Name and displaying the image based on the property for that
channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
bhprogrammer8
Guest
|
Posted:
Wed Oct 26, 2005 4:51 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Stefan,
Im sorry...the code below is incorrect, i do have the full path in the
script. >
private void Page_Load(object sender, System.EventArgs e)
| Quote: | {
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.ImageLogo.ImageUrl =
"http://localhost:2363/mahoningweb/images/" + CmsHttpContext.Current.Channel.CustomProperties["Logo"].Value;
|
"bhprogrammer8" wrote:
| Quote: | Stefan,
I have looked at the rendered html and found this piece where the image
should show up. <img id="Header21_ImageLogo" alt="" border="0" /> Header2
is the name of the control file, and ImageLogo is the name of the image
control on the page. Again, here is the code on the page...
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.ImageLogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["Logo"].Value;
"Stefan [MSFT]" wrote:
Hi Beth,
please use view source in IE for to get the rendered html and then verify
the URL for the image in the html code.
Is it as expected?
If yes, enter this URL in IE. Does it show the image now?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:63DCECC0-8098-493A-914F-5988B884E7C4@microsoft.com...
Stefan,
My apologies for being so vague. I am referring to a place on the page
where an image is supposed to be. Normally if you refer to an image that
doesn't exist, a web page will show a Red "x" box and you can still see
the
image's path if you look at the properties of it. In my case, I just see
a
small "blank-transparent-blank-box" area where the image SHOULD show up.
And
the properties just say NOT AVAILABLE, so I know it isn't getting the
correct
path. The image exists in the path I have programmed, and the Custom
Property exists for each channel as I have explained before.
I am wondering if I need to be BINDING the image DATA somehow. If so,
what
is the correct CMS statement to bind to properties data?
Thanks,
Beth
"Stefan [MSFT]" wrote:
Hi,
what do you mean with "empty box"?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:296721A9-8B14-4623-92B6-6779F27B6EC2@microsoft.com...
Thank you Stefan for your help. I am still struggling with this simple
job.
Here is my code
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.Imagelogo.ImageUrl = "http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
but when I browse, I just get an EMPTY Box where the image should be.
Is
there something else CMS related I need to do besides the custom
property
setting? A resource or something?
Right Clicking the image in browser gives me NOT AVAILBLE.
Please point me in the right direction.
B
I am not getting any errors but when i view the page in my browser, I
get
"Stefan [MSFT]" wrote:
Hi,
If your custom property only contains the name of the image and not
the
complete URL you need to add the path in front of it.
If the custom property holds the URL the code below will be correct.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:CF99E7B2-53D2-496D-B929-792E9D83F857@microsoft.com...
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project,
and
have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is browsing.
I
am
digging through 3 different MCMS books, and online tech docs and
forums,
but
cannot figure out this seemingly easy task. The site is done in
C#,
i
am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name
"LOGO"
and a
value "channelname.jpg". I am sure there is a method of Getting
the
Channel
Name and displaying the image based on the property for that
channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
bhprogrammer8
Guest
|
Posted:
Wed Oct 26, 2005 8:51 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Stefan,
you can't believe what the problem is. After running through the page in
debug I found that this code was missing in the page. Don't ask me how it
got removed, but I put it back in, and the image changes now depending on
channel. Thank you so much for your time, and I apologize for wasting any of
it. I learn so much from this forum...it is always my first stop!
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
Best to you,
Beth
"Stefan [MSFT]" wrote:
| Quote: | Hi,
no idea.
you should post this to an ASP.NET related newsgroup as this is not a MCMS
related problem.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:5D7B60E9-AF3B-45AD-90D7-C4E7F5593DCA@microsoft.com...
Stefan,
Im sorry...the code below is incorrect, i do have the full path in the
script.
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.ImageLogo.ImageUrl =
"http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["Logo"].Value;
"bhprogrammer8" wrote:
Stefan,
I have looked at the rendered html and found this piece where the image
should show up. <img id="Header21_ImageLogo" alt="" border="0" /
Header2
is the name of the control file, and ImageLogo is the name of the image
control on the page. Again, here is the code on the page...
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.ImageLogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["Logo"].Value;
"Stefan [MSFT]" wrote:
Hi Beth,
please use view source in IE for to get the rendered html and then
verify
the URL for the image in the html code.
Is it as expected?
If yes, enter this URL in IE. Does it show the image now?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:63DCECC0-8098-493A-914F-5988B884E7C4@microsoft.com...
Stefan,
My apologies for being so vague. I am referring to a place on the
page
where an image is supposed to be. Normally if you refer to an image
that
doesn't exist, a web page will show a Red "x" box and you can still
see
the
image's path if you look at the properties of it. In my case, I just
see
a
small "blank-transparent-blank-box" area where the image SHOULD show
up.
And
the properties just say NOT AVAILABLE, so I know it isn't getting the
correct
path. The image exists in the path I have programmed, and the Custom
Property exists for each channel as I have explained before.
I am wondering if I need to be BINDING the image DATA somehow. If
so,
what
is the correct CMS statement to bind to properties data?
Thanks,
Beth
"Stefan [MSFT]" wrote:
Hi,
what do you mean with "empty box"?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:296721A9-8B14-4623-92B6-6779F27B6EC2@microsoft.com...
Thank you Stefan for your help. I am still struggling with this
simple
job.
Here is my code
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels =
CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.Imagelogo.ImageUrl =
"http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
but when I browse, I just get an EMPTY Box where the image should
be.
Is
there something else CMS related I need to do besides the custom
property
setting? A resource or something?
Right Clicking the image in browser gives me NOT AVAILBLE.
Please point me in the right direction.
B
I am not getting any errors but when i view the page in my
browser, I
get
"Stefan [MSFT]" wrote:
Hi,
If your custom property only contains the name of the image and
not
the
complete URL you need to add the path in front of it.
If the custom property holds the URL the code below will be
correct.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers
no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote
in
message
news:CF99E7B2-53D2-496D-B929-792E9D83F857@microsoft.com...
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will
have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and
confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com
wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished
project,
and
have
not been involved from the beginning. I would like to
change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is
browsing.
I
am
digging through 3 different MCMS books, and online tech docs
and
forums,
but
cannot figure out this seemingly easy task. The site is
done in
C#,
i
am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a
name
"LOGO"
and a
value "channelname.jpg". I am sure there is a method of
Getting
the
Channel
Name and displaying the image based on the property for that
channel.
Can someone please point me in the right direction using
CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
Stefan [MSFT]
Guest
|
Posted:
Wed Oct 26, 2005 8:51 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Hi,
no idea.
you should post this to an ASP.NET related newsgroup as this is not a MCMS
related problem.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:5D7B60E9-AF3B-45AD-90D7-C4E7F5593DCA@microsoft.com...
| Quote: | Stefan,
Im sorry...the code below is incorrect, i do have the full path in the
script.
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.ImageLogo.ImageUrl =
"http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["Logo"].Value;
"bhprogrammer8" wrote:
Stefan,
I have looked at the rendered html and found this piece where the image
should show up. <img id="Header21_ImageLogo" alt="" border="0" /
Header2
is the name of the control file, and ImageLogo is the name of the image
control on the page. Again, here is the code on the page...
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels = CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.ImageLogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["Logo"].Value;
"Stefan [MSFT]" wrote:
Hi Beth,
please use view source in IE for to get the rendered html and then
verify
the URL for the image in the html code.
Is it as expected?
If yes, enter this URL in IE. Does it show the image now?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:63DCECC0-8098-493A-914F-5988B884E7C4@microsoft.com...
Stefan,
My apologies for being so vague. I am referring to a place on the
page
where an image is supposed to be. Normally if you refer to an image
that
doesn't exist, a web page will show a Red "x" box and you can still
see
the
image's path if you look at the properties of it. In my case, I just
see
a
small "blank-transparent-blank-box" area where the image SHOULD show
up.
And
the properties just say NOT AVAILABLE, so I know it isn't getting the
correct
path. The image exists in the path I have programmed, and the Custom
Property exists for each channel as I have explained before.
I am wondering if I need to be BINDING the image DATA somehow. If
so,
what
is the correct CMS statement to bind to properties data?
Thanks,
Beth
"Stefan [MSFT]" wrote:
Hi,
what do you mean with "empty box"?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:296721A9-8B14-4623-92B6-6779F27B6EC2@microsoft.com...
Thank you Stefan for your help. I am still struggling with this
simple
job.
Here is my code
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
CmsHttpContext CMSContext = CmsHttpContext.Current;
ChannelCollection colRootChannels =
CMSContext.RootChannel.Channels;
this.StartChannel = "MahoningWeb";
FindStartChannel(colRootChannels);
this.Imagelogo.ImageUrl =
"http://localhost:2363/mahoningweb/images/" +
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
but when I browse, I just get an EMPTY Box where the image should
be.
Is
there something else CMS related I need to do besides the custom
property
setting? A resource or something?
Right Clicking the image in browser gives me NOT AVAILBLE.
Please point me in the right direction.
B
I am not getting any errors but when i view the page in my
browser, I
get
"Stefan [MSFT]" wrote:
Hi,
If your custom property only contains the name of the image and
not
the
complete URL you need to add the path in front of it.
If the custom property holds the URL the code below will be
correct.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers
no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote
in
message
news:CF99E7B2-53D2-496D-B929-792E9D83F857@microsoft.com...
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will
have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and
confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com
wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished
project,
and
have
not been involved from the beginning. I would like to
change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is
browsing.
I
am
digging through 3 different MCMS books, and online tech docs
and
forums,
but
cannot figure out this seemingly easy task. The site is
done in
C#,
i
am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a
name
"LOGO"
and a
value "channelname.jpg". I am sure there is a method of
Getting
the
Channel
Name and displaying the image based on the property for that
channel.
Can someone please point me in the right direction using
CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
bhprogrammer8
Guest
|
Posted:
Fri Nov 11, 2005 9:50 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Stefan,
This worked great to get an image that exists in a directory. but how do I
make it get a resource item? I can get my image
(http://localhost:2363/NR/rdonlyres/179193A4-7211-4295-9BA9-E056CB98E46C/0/1LantermansBridgeInAutumn.jpg) so I know it's there.
I am not sure of the correct method, or syntax here. have tried a couple
things. Something is wrong obviously, but not sure how to fix. Can you
point me in the right direction?
ResourceGallery gallery = CmsHttpContext.Current.Searches.GetByPath
("/Resources/MahoningWeb") as ResourceGallery;
ResourceCollection myCollection = gallery.Resources;
foreach (Resource rs in myCollection)
{
this.ImgHome1.ImageUrl =
CmsHttpContext.Current.Searches.GetByPath("/Resources/MahoningWeb") + rs.Name;
}
Thanks again.
Beth
"bhprogrammer8" wrote:
| Quote: | Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project, and have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to dynamically
grab
the correct image based on which CHANNEL the visitor is browsing. I am
digging through 3 different MCMS books, and online tech docs and forums,
but
cannot figure out this seemingly easy task. The site is done in C#, i am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO" and a
value "channelname.jpg". I am sure there is a method of Getting the
Channel
Name and displaying the image based on the property for that channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
Stefan [MSFT]
Guest
|
Posted:
Sun Nov 13, 2005 9:50 pm Post subject:
Re: Header.ascx and Dynamic Images |
|
|
Hi Beth,
actually the code below is strange as you are assigning multiple URLs to
only one image URL.
That does not make sense.
You would need multiple Image objects.
Any way to just retrieve the Url use the following:
ResourceGallery gallery = CmsHttpContext.Current.Searches.GetByPath
("/Resources/MahoningWeb") as ResourceGallery;
ResourceCollection myCollection = gallery.Resources;
foreach (Resource rs in myCollection)
{
string url = rs.Url;
}
Cheers,
Stefan
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> schrieb im
Newsbeitrag news:A267996B-B6FB-4A67-A601-2B6F067B6DD4@microsoft.com...
| Quote: | Stefan,
This worked great to get an image that exists in a directory. but how do I
make it get a resource item? I can get my image
(http://localhost:2363/NR/rdonlyres/179193A4-7211-4295-9BA9-E056CB98E46C/0/1LantermansBridgeInAutumn.jpg)
so I know it's there.
I am not sure of the correct method, or syntax here. have tried a couple
things. Something is wrong obviously, but not sure how to fix. Can you
point me in the right direction?
ResourceGallery gallery = CmsHttpContext.Current.Searches.GetByPath
("/Resources/MahoningWeb") as ResourceGallery;
ResourceCollection myCollection = gallery.Resources;
foreach (Resource rs in myCollection)
{
this.ImgHome1.ImageUrl =
CmsHttpContext.Current.Searches.GetByPath("/Resources/MahoningWeb") +
rs.Name;
}
Thanks again.
Beth
"bhprogrammer8" wrote:
Thank you for clearing that up for me. Just to be sure:
If my ImageControl is named ImageLogo then at Page Load, I will have
this.Imagelogo.ImageUrl =
CmsHttpContext.Current.Channel.CustomProperties["logo"].Value;
Is this correct?
Thanks so much.
B
"Stefan [MSFT]" wrote:
Hi,
something like this:
string property =
CmsHttpContext.Current.Channel.CustomProperties["LOGO"].Value;
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no
rights
New to MCMS?
Check out this book: Building Websites Using MCMS:
http://tinyurl.com/6zj44
----------------------
"bhprogrammer8" <bhprogrammer8@discussions.microsoft.com> wrote in
message
news:58BDC5BB-E52B-48E5-ACC8-702469156024@microsoft.com...
I am new to CMS. I have been assigned to a half finished project, and
have
not been involved from the beginning. I would like to change the
Header.ascx
file which includes a LOGO image in the upperleft corner, to
dynamically
grab
the correct image based on which CHANNEL the visitor is browsing. I
am
digging through 3 different MCMS books, and online tech docs and
forums,
but
cannot figure out this seemingly easy task. The site is done in C#,
i am
used to VB, but making my way through it.
I have assigned custom properties to each channel with a name "LOGO"
and a
value "channelname.jpg". I am sure there is a method of Getting the
Channel
Name and displaying the image based on the property for that channel.
Can someone please point me in the right direction using CMS?
Seems so easy, but this product has so many options.
Thanks in advance.
|
|
|
| Back to top |
|
 |
|
|
|
|