Hi micah,
Refer the below code.
HTML
<div>
<asp:TextBox runat="server" ID="Username" AutoPostBack="true" OnTextChanged="TextChange" />
<asp:HiddenField ID="newUsername" runat="server" />
<asp:Button ID="Save" Text="Save" runat="server" OnClick="Save_Click" />
</div>
Code
C#
protected void TextChange(object sender, EventArgs e)
{
newUsername.Value = "@" + Username.Text;
}
protected void Save_Click(object sender, EventArgs e)
{
string value = newUsername.Value;
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('" + value + "')", true);
}
VB.Net
Protected Sub TextChange(sender As Object, e As EventArgs)
newUsername.Value = "@" + Username.Text
End Sub
Protected Sub Save_Click(sender As Object, e As EventArgs)
Dim value As String = newUsername.Value
ClientScript.RegisterClientScriptBlock(Me.[GetType](), "alert", (Convert.ToString("alert('") & value) + "')", True)
End Sub
Screenshot