Skip to main content
added 4 characters in body
Source Link
user3559349
user3559349

RaterRather than polluting your markup with behavior, use Unobtrusive Javascript. Give you link a class name and add the value of the Licensor property as a data- attribute and move the 2 hidden inputs into the same table cell for easier selection

<td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) <a href="#" data-licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td> var currentCell; $('.edit'verify').click(function() { currentCell = $(this).closest('td'); licensor = $(this).data('licensor'); // get your partial view and display the popup }); 

Similarly give the confirm button a unique id attribute

$('#confirm').click(function() { var inputs = currentCell.children('input'); inputs.eq(0).val(....); // set the value of ActionId inputs.eq(1).val(....); // set the value of ReferenceId }); 

Note that you question indicates Set the corresponding IsVerified checkbox to true. Because this is in the previous cell, you could do it using

currentCell.prev('td').find('input[type="checkbox"]').prop(checked, true); 

however you have disabled the checkbox using new { @disabled = "disabled" } which means it wont post back, but the associated hidden input generated by CheckBoxFor() will, meaning that irrespective of checking it, you will always post back false

If the checkbox is intended to give a visual representation that verification has been completed, then a better approach would be to include a hidden input bound to IsVerified and an unbound checkbox.

<td> <input type="checkbox" disabled="disabled" /> </td> <td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) @Html.HiddenFor(m => m[i].IsVerified) <a href="#" data-licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td> 

Then you can 'check' the checkbox as noted above and include

inputs.eq(2).val("True"); // set the value of IsVerified 

in the script

You may also want to consider deleting the 'Verify' link from the DOM once you close the popup (assuming you don't want to verify it again

currentCell.children('a').remove(); 

Rater than polluting your markup with behavior, use Unobtrusive Javascript. Give you link a class name and add the value of the Licensor property as a data- attribute and move the 2 hidden inputs into the same table cell for easier selection

<td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) <a href="#" data-licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td> var currentCell; $(.edit').click(function() { currentCell = $(this).closest('td'); licensor = $(this).data('licensor'); // get your partial view and display the popup }); 

Similarly give the confirm button a unique id attribute

$('#confirm').click(function() { var inputs = currentCell.children('input'); inputs.eq(0).val(....); // set the value of ActionId inputs.eq(1).val(....); // set the value of ReferenceId }); 

Note that you question indicates Set the corresponding IsVerified checkbox to true. Because this is in the previous cell, you could do it using

currentCell.prev('td').find('input[type="checkbox"]').prop(checked, true); 

however you have disabled the checkbox using new { @disabled = "disabled" } which means it wont post back, but the associated hidden input generated by CheckBoxFor() will, meaning that irrespective of checking it, you will always post back false

If the checkbox is intended to give a visual representation that verification has been completed, then a better approach would be to include a hidden input bound to IsVerified and an unbound checkbox.

<td> <input type="checkbox" disabled="disabled" /> </td> <td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) @Html.HiddenFor(m => m[i].IsVerified) <a href="#" data-licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td> 

Then you can 'check' the checkbox as noted above and include

inputs.eq(2).val("True"); // set the value of IsVerified 

in the script

You may also want to consider deleting the 'Verify' link from the DOM once you close the popup (assuming you don't want to verify it again

currentCell.children('a').remove(); 

Rather than polluting your markup with behavior, use Unobtrusive Javascript. Give you link a class name and add the value of the Licensor property as a data- attribute and move the 2 hidden inputs into the same table cell for easier selection

<td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) <a href="#" data-licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td> var currentCell; $('.verify').click(function() { currentCell = $(this).closest('td'); licensor = $(this).data('licensor'); // get your partial view and display the popup }); 

Similarly give the confirm button a unique id attribute

$('#confirm').click(function() { var inputs = currentCell.children('input'); inputs.eq(0).val(....); // set the value of ActionId inputs.eq(1).val(....); // set the value of ReferenceId }); 

Note that you question indicates Set the corresponding IsVerified checkbox to true. Because this is in the previous cell, you could do it using

currentCell.prev('td').find('input[type="checkbox"]').prop(checked, true); 

however you have disabled the checkbox using new { @disabled = "disabled" } which means it wont post back, but the associated hidden input generated by CheckBoxFor() will, meaning that irrespective of checking it, you will always post back false

If the checkbox is intended to give a visual representation that verification has been completed, then a better approach would be to include a hidden input bound to IsVerified and an unbound checkbox.

<td> <input type="checkbox" disabled="disabled" /> </td> <td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) @Html.HiddenFor(m => m[i].IsVerified) <a href="#" data-licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td> 

Then you can 'check' the checkbox as noted above and include

inputs.eq(2).val("True"); // set the value of IsVerified 

in the script

You may also want to consider deleting the 'Verify' link from the DOM once you close the popup (assuming you don't want to verify it again

currentCell.children('a').remove(); 
added 177 characters in body
Source Link
user3559349
user3559349

Rater than polluting your markup with behavior, use Unobtrusive Javascript. Give you link a class name and add the value of the Licensor property as a data- attribute and move the 2 hidden inputs into the same table cell for easier selection

<td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) <a href="#" data-licensor = "@Model[i]licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td>   var currentCell; $(.edit').click(function() { currentCell = $(this).closest('td'); licensor = $(this).data('licensor'); // get your partial view and display the popup }); 

Similarly give the confirm button a unique id attribute

$('#confirm').click(function() { var inputs = currentCell.children('input'); inputs.eq(0).val(....); // set the value of ActionId inputs.eq(1).val(....); // set the value of ReferenceId }); 

Note that you question indicates Set the corresponding IsVerified checkbox to true. Because this is in the previous cell, you could do it using

currentCell.prev('td').find('input[type="checkbox"]').prop(checked, true); 

however you have disabled the checkbox using new { @disabled = "disabled" } which means it wont post back, but the associated hidden input generated by CheckBoxFor() will, meaning that irrespective of checking it, you will always post back false

If the checkbox is intended to give a visual representation that verification has been completed, then a better approach would be to include a hidden input bound to IsVerified and an unbound checkbox.

<td> <input type="checkbox" disabled="disabled" /> </td> <td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) @Html.HiddenFor(m => m[i].IsVerified) <a href="#" data-licensor = "@Model[i]licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td> 

Then you can 'check' the checkbox as noted above and include

inputs.eq(2).val("True"); // set the value of IsVerified 

in the script

You may also want to consider deleting the 'Verify' link from the DOM once you close the popup (assuming you don't want to verify it again

currentCell.children('a').remove(); 

Rater than polluting your markup with behavior, use Unobtrusive Javascript. Give you link a class name and add the value of the Licensor property as a data- attribute and move the 2 hidden inputs into the same table cell for easier selection

<td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) <a href="#" data-licensor = "@Model[i].Licensor" class="btn verify">Verify</a> </td>   var currentCell; $(.edit').click(function() { currentCell = $(this).closest('td'); licensor = $(this).data('licensor'); // get your partial view and display the popup }); 

Similarly give the confirm button a unique id attribute

$('#confirm').click(function() { var inputs = currentCell.children('input'); inputs.eq(0).val(....); // set the value of ActionId inputs.eq(1).val(....); // set the value of ReferenceId }); 

Note that you question indicates Set the corresponding IsVerified checkbox to true. Because this is in the previous cell, you could do it using

currentCell.prev('td').find('input[type="checkbox"]').prop(checked, true); 

however you have disabled the checkbox using new { @disabled = "disabled" } which means it wont post back, but the associated hidden input generated by CheckBoxFor() will, meaning that irrespective of checking it, you will always post back false

If the checkbox is intended to give a visual representation that verification has been completed, then a better approach would be to include a hidden input bound to IsVerified and an unbound checkbox.

<td> <input type="checkbox" disabled="disabled" /> </td> <td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) @Html.HiddenFor(m => m[i].IsVerified) <a href="#" data-licensor = "@Model[i].Licensor" class="btn verify">Verify</a> </td> 

Then you can 'check' the checkbox as noted above and include

inputs.eq(2).val("True"); // set the value of IsVerified 

in the script

Rater than polluting your markup with behavior, use Unobtrusive Javascript. Give you link a class name and add the value of the Licensor property as a data- attribute and move the 2 hidden inputs into the same table cell for easier selection

<td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) <a href="#" data-licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td> var currentCell; $(.edit').click(function() { currentCell = $(this).closest('td'); licensor = $(this).data('licensor'); // get your partial view and display the popup }); 

Similarly give the confirm button a unique id attribute

$('#confirm').click(function() { var inputs = currentCell.children('input'); inputs.eq(0).val(....); // set the value of ActionId inputs.eq(1).val(....); // set the value of ReferenceId }); 

Note that you question indicates Set the corresponding IsVerified checkbox to true. Because this is in the previous cell, you could do it using

currentCell.prev('td').find('input[type="checkbox"]').prop(checked, true); 

however you have disabled the checkbox using new { @disabled = "disabled" } which means it wont post back, but the associated hidden input generated by CheckBoxFor() will, meaning that irrespective of checking it, you will always post back false

If the checkbox is intended to give a visual representation that verification has been completed, then a better approach would be to include a hidden input bound to IsVerified and an unbound checkbox.

<td> <input type="checkbox" disabled="disabled" /> </td> <td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) @Html.HiddenFor(m => m[i].IsVerified) <a href="#" data-licensor="@Model[i].Licensor" class="btn verify">Verify</a> </td> 

Then you can 'check' the checkbox as noted above and include

inputs.eq(2).val("True"); // set the value of IsVerified 

in the script

You may also want to consider deleting the 'Verify' link from the DOM once you close the popup (assuming you don't want to verify it again

currentCell.children('a').remove(); 
added 678 characters in body
Source Link
user3559349
user3559349

Rater than polluting your markup with behavior, use Unobtrusive Javascript. Give you link a class name and add the value of the Licensor property as a data- attribute and move the 2 hidden inputs into the same table cell for easier selection

<td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) <a href="#" data-licensor = "@Model[i].Licensor" class="btn verify">Verify</a> </td> var currentCell; $(.edit').click(function() { currentCell = $(this).closest('td'); licensor = $(this).data('licensor'); // get your partial view and display the popup }); 

Similarly give the confirm button a unique id attribute

$('#confirm').click(function() { var inputs = currentCell.children('input'); inputs.eq(0).val(....); // set the value of ActionId inputs.eq(1).val(....); // set the value of ReferenceId }); 

Note that you question indicates Set the corresponding IsVerified checkbox to true. Because this is in the previous cell, you could do it using

currentCell.prev('td').find('input[type="checkbox"]').prop(checked, true); 

however you have disabled the checkbox using new { @disabled = "disabled" } which means it wont post back, but the associated hidden input generated by CheckBoxFor() will, meaning that irrespective of checking it, you will always post back false

If the checkbox is intended to give a visual representation that verification has been completed, then a better approach would be to include a hidden input bound to IsVerified and an unbound checkbox.

<td> <input type="checkbox" disabled="disabled" /> </td> <td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) @Html.HiddenFor(m => m[i].IsVerified) <a href="#" data-licensor = "@Model[i].Licensor" class="btn verify">Verify</a> </td> 

Then you can 'check' the checkbox as noted above and include

inputs.eq(2).val("True"); // set the value of IsVerified 

in the script

Rater than polluting your markup with behavior, use Unobtrusive Javascript. Give you link a class name and add the value of the Licensor property as a data- attribute and move the 2 hidden inputs into the same table cell for easier selection

<td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) <a href="#" data-licensor = "@Model[i].Licensor" class="btn verify">Verify</a> </td> var currentCell; $(.edit').click(function() { currentCell = $(this).closest('td'); licensor = $(this).data('licensor'); // get your partial view and display the popup }); 

Similarly give the confirm button a unique id attribute

$('#confirm').click(function() { var inputs = currentCell.children('input'); inputs.eq(0).val(....); // set the value of ActionId inputs.eq(1).val(....); // set the value of ReferenceId }); 

Note that you question indicates Set the corresponding IsVerified checkbox to true. Because this is in the previous cell, you could do it using

currentCell.prev('td').find('input[type="checkbox"]').prop(checked, true); 

however you have disabled the checkbox using new { @disabled = "disabled" } which means it wont post back, but the associated hidden input generated by CheckBoxFor() will, meaning that irrespective of checking it, you will always post back false

Rater than polluting your markup with behavior, use Unobtrusive Javascript. Give you link a class name and add the value of the Licensor property as a data- attribute and move the 2 hidden inputs into the same table cell for easier selection

<td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) <a href="#" data-licensor = "@Model[i].Licensor" class="btn verify">Verify</a> </td> var currentCell; $(.edit').click(function() { currentCell = $(this).closest('td'); licensor = $(this).data('licensor'); // get your partial view and display the popup }); 

Similarly give the confirm button a unique id attribute

$('#confirm').click(function() { var inputs = currentCell.children('input'); inputs.eq(0).val(....); // set the value of ActionId inputs.eq(1).val(....); // set the value of ReferenceId }); 

Note that you question indicates Set the corresponding IsVerified checkbox to true. Because this is in the previous cell, you could do it using

currentCell.prev('td').find('input[type="checkbox"]').prop(checked, true); 

however you have disabled the checkbox using new { @disabled = "disabled" } which means it wont post back, but the associated hidden input generated by CheckBoxFor() will, meaning that irrespective of checking it, you will always post back false

If the checkbox is intended to give a visual representation that verification has been completed, then a better approach would be to include a hidden input bound to IsVerified and an unbound checkbox.

<td> <input type="checkbox" disabled="disabled" /> </td> <td> @Html.HiddenFor(m => m[i].ActionId) @Html.HiddenFor(m => m[i].ReferenceId) @Html.HiddenFor(m => m[i].IsVerified) <a href="#" data-licensor = "@Model[i].Licensor" class="btn verify">Verify</a> </td> 

Then you can 'check' the checkbox as noted above and include

inputs.eq(2).val("True"); // set the value of IsVerified 

in the script

Source Link
user3559349
user3559349
Loading