Hi rajeesh,
Refer below sample.
HTML
Question No :
<asp:TextBox runat="server" ID="txtQuestioNo" OnTextChanged="Save" AutoPostBack="true" />
<br />
<asp:Label ID="lblNumber" runat="server" />
Namespaces
C#
using System.Text.RegularExpressions;
VB.Net
Imports System.Text.RegularExpressions
Code
C#
protected void Save(object sender, EventArgs e)
{
string number = Regex.Replace(txtQuestioNo.Text, "[^0-9]+", string.Empty);
ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('" + number + "');", true);
}
VB.Net
Protected Sub Save(ByVal sender As Object, ByVal e As EventArgs)
Dim number As String = Regex.Replace(txtQuestioNo.Text, "[^0-9]+", String.Empty)
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "Message", "alert('" & number & "');", True)
End Sub
Screenshot