开发者

How to populate textbox value real time upon date start and end entry on a razor view?

开发者 https://www.devze.com 2023-04-09 17:45 出处:网络
Q: How can I populate a text box value (number of days) realtime based on a 开发者_如何学Pythonuser entering start and stop dates within an mvc3/razor view?Thx!Either you would onblur, postback with A

Q: How can I populate a text box value (number of days) realtime based on a 开发者_如何学Pythonuser entering start and stop dates within an mvc3/razor view? Thx!


Either you would onblur, postback with Ajax and use server logic to fill the textbox value with number of days. Or, ideally, you would use jquery to do this so it is most responsive and realtime.


    $("#textbox1, #textbox2").change(function()
    {
    $.ajax(
        {url: '/controller/action',
        data: { date1: $("#textbox1").val(),date2: ("#textbox1").val()},
        success: function(data){
                 $("#days_textbox").val(data);
               }})
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消