473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

user control, css, and redirect

I have a navigation user control navig.ascx that redirects to respective
pages based on webcontrols.linkbutton clicks using response.redirect.

I would like to control the look and feel of those link buttons. Once I
click the button, I would like to make it bold using instructions like

linkbutton.font.bold=true

This works as long as its NOT followed by response.redirect

For example:

linkbutton.font.bold=true;
response.redirect("mypage.aspx");

if I take out the response line, this works, with response line in the code,
the instruction does get executed but some how link button does not get
bolded.
"mypage.aspx" does host navig.ascx user control as other navigated pages.

Please help.
Thanks
Trisha
Nov 19 '05 #1
5 2191
Trisha:
You are getting things confused.

You are setting the bold property of a control to true, then going to
another page. The control (linkbutton) doesn't survive through a
redirect...you create a new instance.....

If you want this boldedness value to survive postbacks and links you should
use the :visited attribute of CSS.
http://www.blooberry.com/indexdot/cs...assvisited.htm
<asp:linkbutton id="x" runat="server" CssClass="someClass" ... />

and your css should look like:

someClass:visited{
font-weight:bold;
}
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Trisha" <tr****@nospam.nospam> wrote in message
news:F8**********************************@microsof t.com...
I have a navigation user control navig.ascx that redirects to respective
pages based on webcontrols.linkbutton clicks using response.redirect.

I would like to control the look and feel of those link buttons. Once I
click the button, I would like to make it bold using instructions like

linkbutton.font.bold=true

This works as long as its NOT followed by response.redirect

For example:

linkbutton.font.bold=true;
response.redirect("mypage.aspx");

if I take out the response line, this works, with response line in the
code,
the instruction does get executed but some how link button does not get
bolded.
"mypage.aspx" does host navig.ascx user control as other navigated pages.

Please help.
Thanks
Trisha

Nov 19 '05 #2
Karl,

When I apply this CssClass="someClass" to all the linkbuttons on the ascx
page,
all the linkbuttons are bolded even though they are not clicked.

"Karl Seguin" wrote:
Trisha:
You are getting things confused.

You are setting the bold property of a control to true, then going to
another page. The control (linkbutton) doesn't survive through a
redirect...you create a new instance.....

If you want this boldedness value to survive postbacks and links you should
use the :visited attribute of CSS.
http://www.blooberry.com/indexdot/cs...assvisited.htm
<asp:linkbutton id="x" runat="server" CssClass="someClass" ... />

and your css should look like:

someClass:visited{
font-weight:bold;
}
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Trisha" <tr****@nospam.nospam> wrote in message
news:F8**********************************@microsof t.com...
I have a navigation user control navig.ascx that redirects to respective
pages based on webcontrols.linkbutton clicks using response.redirect.

I would like to control the look and feel of those link buttons. Once I
click the button, I would like to make it bold using instructions like

linkbutton.font.bold=true

This works as long as its NOT followed by response.redirect

For example:

linkbutton.font.bold=true;
response.redirect("mypage.aspx");

if I take out the response line, this works, with response line in the
code,
the instruction does get executed but some how link button does not get
bolded.
"mypage.aspx" does host navig.ascx user control as other navigated pages.

Please help.
Thanks
Trisha


Nov 19 '05 #3
That's because those links have been visited in the past, which is how the
:visited pseudo-css-class works.

It dawns on me that you want the link to be bolded for the new page the user
is on to indicate to the user that this is the page you are on. In other
words, you want it bolded once and only once.

To do so, you should make the navigation control self-aware of what page it
is on and which linkbutton to bold. You shouldn't do it on the eventhandler
of the linkbutton click, but rather on the page_load of the user control.

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Trisha" <tr****@nospam.nospam> wrote in message
news:7A**********************************@microsof t.com...
Karl,

When I apply this CssClass="someClass" to all the linkbuttons on the ascx
page,
all the linkbuttons are bolded even though they are not clicked.

"Karl Seguin" wrote:
Trisha:
You are getting things confused.

You are setting the bold property of a control to true, then going to
another page. The control (linkbutton) doesn't survive through a
redirect...you create a new instance.....

If you want this boldedness value to survive postbacks and links you
should
use the :visited attribute of CSS.
http://www.blooberry.com/indexdot/cs...assvisited.htm
<asp:linkbutton id="x" runat="server" CssClass="someClass" ... />

and your css should look like:

someClass:visited{
font-weight:bold;
}
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Trisha" <tr****@nospam.nospam> wrote in message
news:F8**********************************@microsof t.com...
>I have a navigation user control navig.ascx that redirects to respective
> pages based on webcontrols.linkbutton clicks using response.redirect.
>
> I would like to control the look and feel of those link buttons. Once I
> click the button, I would like to make it bold using instructions like
>
> linkbutton.font.bold=true
>
> This works as long as its NOT followed by response.redirect
>
> For example:
>
> linkbutton.font.bold=true;
> response.redirect("mypage.aspx");
>
> if I take out the response line, this works, with response line in the
> code,
> the instruction does get executed but some how link button does not get
> bolded.
> "mypage.aspx" does host navig.ascx user control as other navigated
> pages.
>
> Please help.
> Thanks
> Trisha


Nov 19 '05 #4
Karl,

Thanks for the answer. Please let me know if you know how to make the user
control aware what page its on. I will research it in the mean time.

Thanks

"Karl Seguin" wrote:
That's because those links have been visited in the past, which is how the
:visited pseudo-css-class works.

It dawns on me that you want the link to be bolded for the new page the user
is on to indicate to the user that this is the page you are on. In other
words, you want it bolded once and only once.

To do so, you should make the navigation control self-aware of what page it
is on and which linkbutton to bold. You shouldn't do it on the eventhandler
of the linkbutton click, but rather on the page_load of the user control.

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Trisha" <tr****@nospam.nospam> wrote in message
news:7A**********************************@microsof t.com...
Karl,

When I apply this CssClass="someClass" to all the linkbuttons on the ascx
page,
all the linkbuttons are bolded even though they are not clicked.

"Karl Seguin" wrote:
Trisha:
You are getting things confused.

You are setting the bold property of a control to true, then going to
another page. The control (linkbutton) doesn't survive through a
redirect...you create a new instance.....

If you want this boldedness value to survive postbacks and links you
should
use the :visited attribute of CSS.
http://www.blooberry.com/indexdot/cs...assvisited.htm
<asp:linkbutton id="x" runat="server" CssClass="someClass" ... />

and your css should look like:

someClass:visited{
font-weight:bold;
}
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Trisha" <tr****@nospam.nospam> wrote in message
news:F8**********************************@microsof t.com...
>I have a navigation user control navig.ascx that redirects to respective
> pages based on webcontrols.linkbutton clicks using response.redirect.
>
> I would like to control the look and feel of those link buttons. Once I
> click the button, I would like to make it bold using instructions like
>
> linkbutton.font.bold=true
>
> This works as long as its NOT followed by response.redirect
>
> For example:
>
> linkbutton.font.bold=true;
> response.redirect("mypage.aspx");
>
> if I take out the response line, this works, with response line in the
> code,
> the instruction does get executed but some how link button does not get
> bolded.
> "mypage.aspx" does host navig.ascx user control as other navigated
> pages.
>
> Please help.
> Thanks
> Trisha


Nov 19 '05 #5
Karl,

I used the following line of code to get to the parent.

Parent.Page.ToString();

thanks again for all your help. I am good to go.

"Trisha" wrote:
Karl,

Thanks for the answer. Please let me know if you know how to make the user
control aware what page its on. I will research it in the mean time.

Thanks

"Karl Seguin" wrote:
That's because those links have been visited in the past, which is how the
:visited pseudo-css-class works.

It dawns on me that you want the link to be bolded for the new page the user
is on to indicate to the user that this is the page you are on. In other
words, you want it bolded once and only once.

To do so, you should make the navigation control self-aware of what page it
is on and which linkbutton to bold. You shouldn't do it on the eventhandler
of the linkbutton click, but rather on the page_load of the user control.

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Trisha" <tr****@nospam.nospam> wrote in message
news:7A**********************************@microsof t.com...
Karl,

When I apply this CssClass="someClass" to all the linkbuttons on the ascx
page,
all the linkbuttons are bolded even though they are not clicked.

"Karl Seguin" wrote:

> Trisha:
> You are getting things confused.
>
> You are setting the bold property of a control to true, then going to
> another page. The control (linkbutton) doesn't survive through a
> redirect...you create a new instance.....
>
> If you want this boldedness value to survive postbacks and links you
> should
> use the :visited attribute of CSS.
> http://www.blooberry.com/indexdot/cs...assvisited.htm
>
>
> <asp:linkbutton id="x" runat="server" CssClass="someClass" ... />
>
> and your css should look like:
>
> someClass:visited{
> font-weight:bold;
> }
>
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Trisha" <tr****@nospam.nospam> wrote in message
> news:F8**********************************@microsof t.com...
> >I have a navigation user control navig.ascx that redirects to respective
> > pages based on webcontrols.linkbutton clicks using response.redirect.
> >
> > I would like to control the look and feel of those link buttons. Once I
> > click the button, I would like to make it bold using instructions like
> >
> > linkbutton.font.bold=true
> >
> > This works as long as its NOT followed by response.redirect
> >
> > For example:
> >
> > linkbutton.font.bold=true;
> > response.redirect("mypage.aspx");
> >
> > if I take out the response line, this works, with response line in the
> > code,
> > the instruction does get executed but some how link button does not get
> > bolded.
> > "mypage.aspx" does host navig.ascx user control as other navigated
> > pages.
> >
> > Please help.
> > Thanks
> > Trisha
>
>
>


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Zi | last post by:
I have a user control within a data grid. I am binding the user control to one of the values from the data grid. The data grid implements paging. It is all working ok for the first page but once i...
2
by: John Ninan | last post by:
I am creating Dynamic Usercontrol in Asp.net application. In this application I have a combobox(aspx Page). Which contains various items. Based on item selected I am dynamically populating...
4
by: Marty U. | last post by:
I have a Session variable I need to check the value of. If it is value a then redirect to some page. I need to implement this in a user control that is on all the relevent pages. I placed the if...
1
by: Andre Ranieri | last post by:
I have a quick question - I'd just like to have confirmation to be sure. I'm building an ASP.NET corporate site for my employer, some of the pages have e-commerce capability and will need to be...
5
by: Steve Richter | last post by:
In my user control I want to read the ViewState dictionary of the Parent control. But this sensible idea is not permitted by the compiler: Compiler Error Message: CS1540: Cannot access...
2
by: Nathan Sokalski | last post by:
I am using the Response.Redirect method in a User Control to allow visitors to click an ImageButton to take them to another page. However, when I click the ImageButton I recieve the following...
4
by: Max | last post by:
Hello, here a user control named aff.ascx : (this control is used to see the contains of a link) <%@ Control Language="VB" %> <script runat="server"> ' Insert user control code here Public...
5
by: c676228 | last post by:
Hi, I guess I am confused. In aspx script, I mean (you won't use Codebehind="enrollinfo.aspx.vb", but mix code with html and code together) You can access user control's property directly. Since I...
1
by: weboweb | last post by:
Hello aspnet experts! I have a design question for the more experienced developers (more than me at least :-)). 1) I have a page in the application I'm building that displays a web user...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.