Hi indradeo,
Use Substring function to get the first lettor from Name and concadinate with No TextBox to get the desired result.
Check the below sample.
HTML
Emp.No.:<asp:TextBox runat="server" ID="txtNo" AutoPostBack="true" OnTextChanged="OnJoin" />
<br />
Name:<asp:TextBox runat="server" ID="txtName" AutoPostBack="true" OnTextChanged="OnJoin" />
<br />
<asp:TextBox runat="server" ID="txtResult" />
Code
C#
protected void OnJoin(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtNo.Text.Trim()) && !string.IsNullOrEmpty(txtName.Text.Trim()))
{
txtResult.Text = txtName.Text.Trim().Substring(0, 1) + txtNo.Text.Trim();
}
}
VB.Net
Protected Sub OnJoin(ByVal sender As Object, ByVal e As EventArgs)
If Not String.IsNullOrEmpty(txtNo.Text.Trim()) AndAlso Not String.IsNullOrEmpty(txtName.Text.Trim()) Then
txtResult.Text = txtName.Text.Trim().Substring(0, 1) + txtNo.Text.Trim()
End If
End Sub