[SOLVED] Execute the function I wrote in C # by changing the value (input)

Issue

How can I execute the function I wrote inside the c # code when I change the input value?

<input id="quantity2" runat="server" type="number" onserverclick="lod_gheymat" value="" min="1" max="20" />
 protected void lod_Price(object sender, EventArgs e)
    {
 lbl_Plural.Text = quantity2.Value;
}

enter image description here

Solution

Use a asp:Textbox instead of an input control with ‘runat=server’.
Then set the property AutoPostback to true, and handle the event ‘OnTextChanged’.

See: https://meeraacademy.com/textbox-autopostback-and-textchanged-event-asp-net/ for an example.

Answered By – tim-

Answer Checked By – Timothy Miller (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *