Create an ASP.NET web page that displays a multi-line text box, a “Find:” text b
ID: 3667757 • Letter: C
Question
Create an ASP.NET web page that displays a multi-line text box, a “Find:” text box, a “Replace with:” text box, and a “Replace all” button.
Clicking the button causes the multi-line text box’s text to be changed. Specifically, the Replace All button causes the Find text to be replaced with the Replace with text. For details, see the sample session.
Sample session:
Initial display:
After typing text into the text area control:
After clicking the Replace All button:
After entering text into the two fields and clicking the Replace All button:
John | | | Text Manipulator -C f D localhost:50910/hw3/replaceText.aspx Insert text here. elext.aspx QE a Find: Replace with: Replace allExplanation / Answer
Comments added
//using replace function, i am replacing characters in a given string
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
if(find.Text == ""){
errorMessage.Text = "you must enter a value field ina FIND field"
}
textbox.Text = textbox.Text.Replace(find.Text, replaceWith.Text)
End Sub
</script>
<!DOCTYPE html>
<html>
<body>
<form runat="server">
<!-- Creating web elements-->
<asp:TextBox id="textbox" TextMode="multiline" runat="server" />
<br><br>
Find:
<asp:TextBox id="find" runat="server" />
Replace With:
<asp:TextBox id="replaceWith" runat="server" />
<asp:Button Text="Replace All" runat="server" />
<p><asp:Label id="errorMessage" runat="server" /></p>
</form>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.