473,398 Members | 2,525 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,398 software developers and data experts.

changing html links dynamically on page

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">Enter Empid</asp:Label>
<br>
<A id="empid" href="#">Details for employee '1234'</A>
<A id=empdet href=#>"Employee 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(object sender, System.EventArgs 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 1072
kunal pawar
297 100+
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">Enter Empid</asp:Label>
<br>
<A id="empid" href="#"><%=myempid%></A>
<A id=empdet href=#><%=myempdet%></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,myempdet ;
private void Page_Load(object sender, System.EventArgs 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 100+
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
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...
2
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...
3
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...
2
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...
5
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 =...
68
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"...
2
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...
1
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...
5
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...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.