samedi 24 février 2018

ASP.net web TextChangedEvent not fireing

I'm trying to make a website with some fun features that require a working TextChanged event with textboxes. Here's what I tried to do: //textbox html code C# embedded code

protected void Page_Load(object sender, EventArgs e)
{
    TextBox1.TextChanged += TextBox1_TextChanged;
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
    DateTime time = new DateTime();
    try
    {
        int textBoxValue = Convert.ToInt32(TextBox1.Text);
        Label2.Text = "valid" + time.ToString("hh:mm:ss");
    }
    catch
    {
        Label2.Text = "test";
        TextBox1.Text = "1";
    }
}

https://pastebin.com/mAyKMLE5 also contains some html code.

Somehow I think it's not registering any textChangedEvents at all. I'm thinking the page has to actually reload for it to register it? Anyway, I hope someone could help me out. If you need additional information about the problem I'll gladly give it.

Thanks in advance, DutchJelly




Aucun commentaire:

Enregistrer un commentaire