Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Access controls in Web User Control from web form

Reply
Thread Tools

Access controls in Web User Control from web form

 
 
Joachim Feldt
Guest
Posts: n/a
 
      11-01-2004
Hi,

I am a newbie, so some help here would be very appreciated!

I have a aspx-page with four links at the top of the page. These links
are the application navigation and they are stored in a separate Web
User Control(ctrlTop.ascx).
These four links are added as asp:Hyperlink, with an ImageUrl set as
well. So the links are displayed as images.

When browsing my application I want to show the user in what section
he/she is by highlighting that image(hyperlink) in the navigation on
the top(my Web User Control).
To do this I want to change the ImageUrl on that hyperlink to another
image.

So in other words, when loading an aspx page I want to change an
ImageUrl on a control in a Web User Control.

How do I do that?

And once again, I am a beginner, so if you have a code exampel please
show it here.

Thanks in advance!

/Jocke
 
Reply With Quote
 
 
 
 
Enrique Santa Cruz
Guest
Posts: n/a
 
      11-01-2004
protected System.Web.UI.WebControls.HyperLink HyperLink;

private void Header_Load(object sender, System.EventArgs e)

{

if(Page.IsPostBack != true)

{

HyperLink.ImageUrl = Application["ApplicationPath"]+"images/tm_triad.gif";

}

}

"Joachim Feldt" <(E-Mail Removed)> wrote in message news:(E-Mail Removed) m...
> Hi,
>
> I am a newbie, so some help here would be very appreciated!
>
> I have a aspx-page with four links at the top of the page. These links
> are the application navigation and they are stored in a separate Web
> User Control(ctrlTop.ascx).
> These four links are added as asp:Hyperlink, with an ImageUrl set as
> well. So the links are displayed as images.
>
> When browsing my application I want to show the user in what section
> he/she is by highlighting that image(hyperlink) in the navigation on
> the top(my Web User Control).
> To do this I want to change the ImageUrl on that hyperlink to another
> image.
>
> So in other words, when loading an aspx page I want to change an
> ImageUrl on a control in a Web User Control.
>
> How do I do that?
>
> And once again, I am a beginner, so if you have a code exampel please
> show it here.
>
> Thanks in advance!
>
> /Jocke

 
Reply With Quote
 
 
 
 
Matt Berther
Guest
Posts: n/a
 
      11-01-2004
Hello Enrique,

Why would you store this in an Application level variable? This supposes
that you want the triad.gif to show on the same link for every user in the
entire application.

Perhaps a better spot would be Session, as it is user-specific...

--
Matt Berther
http://www.mattberther.com

> protected System.Web.UI.WebControls.HyperLink HyperLink;
>
> private void Header Load(object sender, System.EventArgs e)
>
> {
>
> if(Page.IsPostBack != true)
>
> {
>
> HyperLink.ImageUrl =
> Application["ApplicationPath"]+"images/tm triad.gif";
> }
>
> }
>
> "Joachim Feldt" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) m...
>
>> Hi,
>>
>> I am a newbie, so some help here would be very appreciated!
>>
>> I have a aspx-page with four links at the top of the page. These
>> links
>> are the application navigation and they are stored in a separate Web
>> User Control(ctrlTop.ascx).
>> These four links are added as asp:Hyperlink, with an ImageUrl set as
>> well. So the links are displayed as images.
>> When browsing my application I want to show the user in what section
>> he/she is by highlighting that image(hyperlink) in the navigation on
>> the top(my Web User Control).
>> To do this I want to change the ImageUrl on that hyperlink to another
>> image.
>> So in other words, when loading an aspx page I want to change an
>> ImageUrl on a control in a Web User Control.
>>
>> How do I do that?
>>
>> And once again, I am a beginner, so if you have a code exampel please
>> show it here.
>>
>> Thanks in advance!
>>
>> /Jocke
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controls.Add() for a Web User Control doesn't instansiate its child controls Ofer Zelig ASP .Net 15 03-28-2007 01:15 PM
Change web controls in one user control from another user control =?Utf-8?B?REo=?= ASP .Net 2 12-01-2005 08:26 AM
Web Controls/User Controls - Access Modifier Mr Newbie ASP .Net 3 10-31-2005 04:01 PM
using javascript in User controls to access server controls of the user control Faizan Ahmed ASP .Net Building Controls 1 01-04-2005 04:09 PM
using javascript in User controls to access server controls of the user control Faizan Ahmed ASP .Net Web Controls 1 01-04-2005 04:09 PM



Advertisments