c# - Pass value of html.label to Controller -
i need pass value of @html.label variable"data" of controller"verificar" after click button.
i did:
@html.label("modaltitle", new { id = "modaltitle" }) <button type="button" class="btn btn-defaultgreen" onclick="location.href = '@url.action("verificar", "feriado", new { date = @html.label("modaltitle", new { id = "modaltitle" }).tostring() }, null)'">create event</button>
but not working method.... need helps! thanks
change calendar function add together info attribute set info against label info attribute:
$('#calendar').fullcalendar({ editable: false, events: "/reglamento/getevents/", selectable:true, select: function(start, end, jsevent, view) { //bootstrap modal $('#modaltitle').html(start.tostring().substring(0, 15)); //add info attribute - can have improve date format here (e.g. yyyy-mm-dd) $('#modaltitle').data("startdate", start.tostring().substring(0, 15); $('#fullcalmodal').modal(); } });
update button phone call function grabs info attribute, constructs url , sets location:
function navigatebydate() { var date = $('#modaltitle').data("startdate"); //this done better...should show intention though var url = '@url.action("verificar", "feriado")' + '?data=' + date; location.href = url; }
c# asp.net asp.net-mvc-5
No comments:
Post a Comment