can't figure out this simple task

G

Guest

I'm using VS to create a form. I want a user to be able to input in to a
field either the html code (<a href="http:\\www.mysite.com" Click here!</a>)
or use some built in function where when the form is submitted and displayed
back to me it displays the label as a hyperlink rather than the full web
address.

Any help would be greatly appreciated.
 
G

Guest

Is this a web app or windows app? Is it public or private?

Reason I ask is that what you need to do is have the server-side code render
the HTML that the user entered into a text box on postback. That could be
exceedingly dangerous if the client enters various forms of script.

Anyhow. With a web app, you can capture the posted client text in a variable
and use Response.Write to write it back to the document stream on postback.
That's the simplist way. There are others, including client-side JavaScript.
 
G

Guest

<html>
<head>
<script language="javascript" type="text/javascript">
<!--

function myButton_onclick()
{
document.getElementById("myDiv").innerHTML =
document.getElementById("myTextBox").value;
}

// -->
</script>
</head>
<body>
<div id="myDiv"></div>
<input id="myTextBox" type="text" />
<input id="myButton" type="button" value="Click Me!"
language="javascript" onclick="return myButton_onclick()" />
</body>
</html>

________________________
(e-mail address removed)
http://www.openwinforms.com/
OpenWinForms - open source windows forms and controls
Google group - http://groups.google.com/group/open-winforms
 
A

AMDRIT

This, to me, appears to be client side wiring of an event for a web page
using javascript.

1. Type something in a text box
2. Click the button
3. The text in the text box is then written in the Div tag.

The moving pieces are:

1. onclick="return myButton_OnClick();" This bit tell the web page what to
do when the button is clicked. Kinda like a delegate pointer in .Net
2. myButton_OnClick() this function is the routine that places the text
from the textbox in the Div Tag
3. getElementById says find an html tag that has it's ID attribute set to a
certain value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top