I have a TextBox
in my popup page. I need to determine if the text entered in the TextBox
is "Admin" by using TextBox.Text.Equals("Admin");
Here is how the TextBox
is defined:
<asp:TextBox ID="TextBox1" runat="server" Height="35px"
ontextchanged="TextBox1_TextChanged" AutoPostBack="true"
style="text-align: right; font-size: x-large" Width="200px">
</asp:TextBox>
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
if(TextBox1.Text.Equals("Admin"))
{
Page.ClientScript.RegisterOnSubmitStatement(typeof(Page), "closePage", "window.onunload = CloseWindow();");
}
}
The function of TextBox1_TextChanged
does not trigger when the text is changed.
I am looking for a way to automatically close the window when some text is entered. Can anyone provide assistance or suggest an alternative solution? I prefer not to require button click for closing.
(The text will be entered into the textbox via card reader, hence the need for automatic closure)
Thank you in advance.