문제

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.

도움이 되었습니까?

해결책

  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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top