Domanda

I have 8 text boxes in a form. And each text box changed event the text in the text box should be saved to Database. Is there any better approach than firing each text box's text changed event.

È stato utile?

Soluzione

  1. You could use only one event handler for all the text boxes and use the sender argument to get the changed text.

  2. You could put all of the textboxes in an UpdatePanel, so that the page is not refreshed even if you set AutoPostBack to true.

  3. You would write a PageMethod that receives the element to update and the updated text. This method could be called using AJAX and jQuery. This blog by Dave Ward should get you started.

Altri suggerimenti

A possible approach is using the timer. Have a timer that ticks every 1000 ms (say) and checks the textBox.Text.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top