String format (C#) : String « Language Basics « ASP.Net






String format (C#)

<%@ page language="C#" %>

<script runat="server">
    
void BT_Submit_Click(object sender, System.EventArgs e)
{
    this.LT_Name.Text = string.Format("Your name is: {0}", this.TB_Name.Text);
}
    
</script>

<html>
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form runat="server">
        <p>Please enter your name:
            <br /><br />
            <asp:textbox id="TB_Name" runat="server"/>
            <asp:button id="BT_Submit" runat="server" text="OK" onclick="BT_Submit_Click" />
        </p>
        <p><asp:literal id="LT_Name" runat="server"/></p>
    </form>
</body>
</html>

           
       








Related examples in the same category

1.Sub a string value (VB.net)
2.Convert String to int and decimal (C#)
3.String concatenation (C#)