473,791 Members | 3,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing html links dynamically on page

32 New Member
Hello All, I am a newbie to web development, so please help me out with this issue.

html
---------

<form id="Form1" method="post" runat="server">
<asp:TextBox id="txtempid" style="Z-INDEX: 101; LEFT: 256px; POSITION: absolute; TOP: 160px"
runat="server" Width="184px"></asp:TextBox>
<asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 32px; POSITION: absolute; TOP: 152px" runat="server"
Width="152px" Height="32px">E nter Empid</asp:Label>
<br>
<A id="empid" href="#">Detail s for employee '1234'</A>
<A id=empdet href=#>"Employe e name is Scott Tiger"</A></td>
<asp:Button id="Button1" style="Z-INDEX: 103; LEFT: 112px; POSITION: absolute; TOP: 240px" runat="server"
Text="Button"></asp:Button>
</form>

code-behind in c#
--------------

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
Response.Write( txtempid.Text);
string mysql = "select empname from emp where empid = " + txtempid.text;
string empname;
//query db get empname
string myempid = "Details for employee " + txtempid.Text;
string myempdet = "Employee name is " + myempname;
//the above 2 lines need to be written to the browser in place of the two existing links
}




when the user enters a new empid as criteria, the criteria goes to the server, gets validated, details are obtained for the same and need to be displayed back on the page

Question - How do i change the text in the link to reflect the new values?
---------------------------------------------------------------------------------------------------------


Any help will be greatly appreciated

Thanks and regards
Nanda
Jan 12 '08 #1
2 1126
kunal pawar
297 Contributor
Make your myempid and dept variable as public and echo them,
as show in following......

<form id="Form1" method="post" runat="server">
<asp:TextBox id="txtempid" style="Z-INDEX: 101; LEFT: 256px; POSITION: absolute; TOP: 160px"
runat="server" Width="184px"></asp:TextBox>
<asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 32px; POSITION: absolute; TOP: 152px" runat="server"
Width="152px" Height="32px">E nter Empid</asp:Label>
<br>
<A id="empid" href="#"><%=mye mpid%></A>
<A id=empdet href=#><%=myemp det%></A></td>
<asp:Button id="Button1" style="Z-INDEX: 103; LEFT: 112px; POSITION: absolute; TOP: 240px" runat="server"
Text="Button"></asp:Button>
</form>


code-behind in c#
--------------
// MAke your variables public
public string myempid,myempde t ;
private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
Response.Write( txtempid.Text);
string mysql = "select empname from emp where empid = " + txtempid.text;
string empname;
//query db get empname
myempid = "Details for employee " + txtempid.Text;
myempdet = "Employee name is " + myempname;
//the above 2 lines need to be written to the browser in place of the two existing links
}




when the user enters a new empid as criteria, the criteria goes to the server, gets validated, details are obtained for the same and need to be displayed back on the page

Question - How do i change the text in the link to reflect the new values?
---------------------------------------------------------------------------------------------------------


Any help will be greatly appreciated

Thanks and regards
Nanda[/quote]
Jan 14 '08 #2
kunal pawar
297 Contributor
hi..
rather then use above classic asp method u can use server Hyperlink control and assign text from page behind code
Jan 14 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
16216
by: Kenny | last post by:
I have been trying to write a script that will increase the size of and image when you mouse over it, and decrease it to original size, when you mouse out. After a couple of attempts, this is what I've come up with. In this example, there are 5 images (0 thru 4) all with a height of 80px. When you mouse over an image, it changes the growingImage variable equal to the number of the image you mouse over, when you mouse out, it sets it to 5,...
2
2871
by: wjbell | last post by:
I have a piece of javascript I need to modify. Right now it changes a stylesheet in the document between style.css and no_indent.css. These are in the head of my document: <link rel=stylesheet href=/style.css> <link rel=stylesheet href=/no_indent.css> <link rel=stylesheet href=/style.css> What the code below does is toggle between the two depending on what
3
1523
by: John Telford | last post by:
I know this sound strange. I need is to convert a JavaScript Web site into HTML so Atomz <http://www.atomz.com/> can generate a search index for the site. Is there such a utility? ...John ------------------------------------------------------------------------ John Telford - Owner - JohnTelford.com LLC 503-292-6865 - fax: 503-292-3094
2
1745
by: Dominic Myers | last post by:
Hi there, wondered if someone could point me to an appropriate tutorial or offer advice on the following problem? I've got a web page which uses lots of divs to position the content of the page and I'm using a nice javascript to alter the css of a table of links. The thing is I don't want the table of links to point to an external site but to calla function which will replace the content of a layer... perhaps it's be better if I...
5
1552
by: Andrew Poulos | last post by:
I'm trying to change a style in a stylesheet. The following code works in FF, MZ, and IE6 but IE 5 gives the error of "invalid procedure call or argument": var oStyleSheet = window.document.styleSheets.imports; oStyleSheet.addRule("td","font-size:1.2em;"); Is there a way to do this with IE 5? Andrew Poulos
68
11204
by: Steve | last post by:
Hi There, Prob a simple answer to this (I hope) but I can't quite work it out yet... I have this in a page: <map name="Map"> <area shape="rect" coords="43,68,52,77" href="map.html" target="_blank" alt="Link to map"> </map>
2
14804
by: DartmanX | last post by:
I doubt this is possible, but I want to ask, just in case it is. I have a project going using Google Maps. This project spits out an HTML page template for people to post to their website and display a map. Most of the people doing this will have limited knowledge of HTML. I want to ensure that this page remains an XHTML 1.0 Transitional (or Strict) page, in case some newbie removes the DOCTYPE or some slightly more knowledgeable tries...
1
1944
by: Henry Nelson | last post by:
Hi all I'm very new to dotNet and just trying to get my head around the right way to do the thing that I would normally do in asp. In asp I would loop through a recordset and output all the html dynamically for the layout I want. I have seen some examples of using a repeater and they seem to be the thing to use when you don't want a table of results, but I'm not sure how to change the <ItemTemplate> depending on the contents of the...
5
1436
by: Alan Silver | last post by:
Hello, I'm not sure if this is a stupid question or not, so here goes. Suppose I want to achieve the very common design layout as shown here... http://www.kidsinaction.org.uk/floating.html This has a load of text (waffle in this case) with a div floated over to the right. If you look at the HTML, you will see that the HTML for the quick links div comes before the actual content of the page. That makes it easy to float over to the...
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9517
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10156
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9997
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.