473,396 Members | 1,758 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,396 software developers and data experts.

Still confused...using an HTML Control to modify an HTML tag's value

I've asked this a few times and gotten answers, but I'm still missing a
piece of the puzzle.

Here's what I have:

- page.aspx
- title tag
- usercontrol.aspx
- usercontrol.aspx.vb

I'd like to change the value of the title tag from the usercontrol.aspx.vb
codebehind.

Some suggestions were to add a runat="server" as such:

<title id="pageTitle" runat="server">my text</title>

And then declare it in the codebehind. That's where I'm stuck. What do I
declare this as?

It was also suggested that I use a title HTML Control. However, I can't seem
to find any reference to Title HTML controls specifically...

-Darrel
Nov 18 '05 #1
6 1185
Haven't tried this, but the user control's "parent" control is the page that
you wish to modify the title of. The title is a property of the page
itself, so if you can find a way to reference the page, you should be able
to just adjust the .title property.
"darrel" <no*****@hotmail.com> wrote in message
news:ub**************@TK2MSFTNGP14.phx.gbl...
I've asked this a few times and gotten answers, but I'm still missing a
piece of the puzzle.

Here's what I have:

- page.aspx
- title tag
- usercontrol.aspx
- usercontrol.aspx.vb

I'd like to change the value of the title tag from the usercontrol.aspx.vb
codebehind.

Some suggestions were to add a runat="server" as such:

<title id="pageTitle" runat="server">my text</title>

And then declare it in the codebehind. That's where I'm stuck. What do I
declare this as?

It was also suggested that I use a title HTML Control. However, I can't
seem
to find any reference to Title HTML controls specifically...

-Darrel

Nov 18 '05 #2
In the design view of the aspx page, add a "Label" control to the page. Name
it "TitleLabel" or something. Save the page. The code-behind for the page
there is a declaration , probably in the "Web Form Designer Generated Code"
section, for the label control. Move it out of the "Web Form Designer
Generated Code" section to somewhere else near the top of the class code.
Change the declaration to be similar to the following.
Public Shared WithEvents TitleLabel As System.Web.UI.WebControls.Label

You should now be able to reference it by name and change the text.

I do something similar in a user-control that I use to house a
page-banner-section in which I customize the label for each page at runtime.
Nov 18 '05 #3
> In the design view of the aspx page, add a "Label" control to the page.

Ah! Duh. OK, so I'm actually going to write out the HTML via the label.
Seems obvious now. ;o)

Second question...if I do this, can I declare this label in the usercontrol
codebehind? In otherwords, the control is part of the parent page, and I
want to manipulate it via a separate userControl on this page.

-Darrel
Nov 18 '05 #4
> Haven't tried this, but the user control's "parent" control is the page
that
you wish to modify the title of. The title is a property of the page
itself, so if you can find a way to reference the page, you should be able
to just adjust the .title property.


Right...that's my question. ;o)

I was hoping I could do something like page.parent.title.text = "whatever"

-Darrel
Nov 18 '05 #5
You can put it in the user control if you want. If you want you can
manipulate the content of the label fromn the parent page.

"darrel" wrote:
In the design view of the aspx page, add a "Label" control to the page.


Ah! Duh. OK, so I'm actually going to write out the HTML via the label.
Seems obvious now. ;o)

Second question...if I do this, can I declare this label in the usercontrol
codebehind? In otherwords, the control is part of the parent page, and I
want to manipulate it via a separate userControl on this page.

-Darrel

Nov 18 '05 #6
> You can put it in the user control if you want. If you want you can
manipulate the content of the label fromn the parent page.


I may not have asked the question very clearly.

Can I have the Label exist on the parent.aspx page and manipulate it via the
usercontrol.aspx.vb page?

-Darrel
Nov 18 '05 #7

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

Similar topics

22
by: Long | last post by:
Problem: to insert the content of a file in an HTML document at a specific location. One possible way is to add a WebCharm tag like this: <%@charm:text 20 0 my_include_file.txt %> When the...
3
by: Mike Kamermans | last post by:
How do I find out from which tag I called a javascript function at runtime? I have a stack of nested custom tags, in the following structure: <tag_1 value="someval"> <tag_2>content</tag_2>...
1
by: Suhail A, Salman | last post by:
Dear All, I placed a HtmlSelect control on a web page and set it to "Run at Server", the objective of this HtmlSelect control is that the client adds all his accounts to a text box, and...
2
by: Daniel | last post by:
I'm new to .Net and all of its abilities so I hope this makes sense. Basically I'm confused on when is the appropriate time to use web forms controls vs. regular HTML. For example in ASP...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
6
by: Shashi | last post by:
I have developed ASP.Net application using .Net 1.1 Framework. When the user clicks image file through Java script I am using my search window as below. QueryString =...
0
by: Chris Fink | last post by:
My goal is to have an ASP.NET checkbox server tag with it's autopostback set to true, that when clicked will run the checkbox's CheckedChanged event. However, I would like to try to add a...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
3
by: Paul | last post by:
Hello All, I am working through the SAMS "ASP.NET 2.0 - Unleased" book to teach myself ASP.NET. It is a great book, but Chapter 21 "Using ASP.NET Membership" is causing me problems - or maybe I...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.