�@ �@

�A�ځFASP.NET MVC����y�o�[�W����3�Ή��z

��5��@�V�����r���[�E�G���W���uRazor�v�̊�{�𗝉����悤

�R�c �ˊ��ihttp://www.wings.msn.to/�j
2011/07/25
Page1 Page2 Page3 Page4

�r���[�J��������������u�r���[�E�w���p�[�v

�@�r���[�E�w���p�[�Ƃ́A�r���[�E�X�N���v�g���L�q����ۂɖ𗧂ƒ��\�b�h�̂��ƁBASP.NET MVC�ł́A�T�[�o�E�R���g���[���𗘗p�ł��Ȃ�����ɁA�r���[�E�w���p�[�𗘗p���邱�ƂŁA�����N��t�H�[���v�f�̐����Ȃǂ������V���v���ȃR�[�h�ŕ\���ł���B

�@�ȉ��ł́A���̒��ł��ł��悭���p����Ǝv����t�H�[���A�����N�n�w���p�[���܂Ƃ߂Ă����B���̂ق��A���،n�̃w���p�[�ɂ‚��Ă��O��̋L�����Q�Ƃ������������B�܂��A�t�H�[���n�w���p�[�̒��ł�DisplayFor�^EditorFor���\�b�h�ɂ‚��ẮA���񂠂炽�߂ĉ���̗\��ł���B

���t�H�[���𐶐����� �| Html.BeginForm���\�b�h �|

�@BeginForm���\�b�h�́Ausing���߂ƍ��킹�Đ錾���邱�ƂŁAusing�u���b�N�̊J�n����<form>�J�n�^�O���A�u���b�N�̏I������</form>�I���^�O���A���ꂼ��o�͂���B�������ȗ������ꍇ�A<form>�^�O��action�����ɂ͌��݂̃A�N�V���������̂܂܃Z�b�g�����B

�@�������ȗ�������͂���܂ł̉�ł����x���o�ꂵ�Ă���̂ŁA�ȉ��ł͂������̈������w�肵���ꍇ�̗�����Ă݂悤�B

@using (Html.BeginForm(
  "Edit", // �A�N�V������
  "Books", // �R���g���[����
  new { id = "978-4-7981-2344-8", flag = "1" }, // ���[�g�E�p�����[�^
  FormMethod.Post, // HTTP���\�b�h�imethod�����j
  new { enctype = "multipart/form-data"} // ���̂ق��̑���
)) {
  �c�c�t�H�[���̓��e�c�c
}
@Using Html.BeginForm(
  "Edit", ' �A�N�V������
  "Books", ' �R���g���[����
  New With {.id = "978-4-7981-2344-8", .flag = "1"}, ' ���[�g�E�p�����[�^
  FormMethod.Post, ' HTTP���\�b�h�imethod�����j
  New With {.enctype = "multipart/form-data"} ' ���̂ق��̑���
)
  �c�c�t�H�[���̓��e�c�c
End Using
���X�g22�@BeginForm���\�b�h�ɂ��t�H�[���̐����i��FC#�A���FVB�j

<form action="/Books/Edit/978-4-7981-2344-8?flag=1"
  enctype="multipart/form-data" method="post">�`</form>
���X�g23�@���s���Ƀ��X�g22�ɂ��o�͂����HTML�R�[�h

�@���[�g��`�Ɋ܂܂�Ȃ��p�����[�^���w�肵���ꍇ�A���̃p�����[�^�̓N�G�����Ƃ��Ēlj������_�ɂ����ӂ��Ăق����B

�����[�g��`�Ɋ�Â��ăt�H�[���𐶐����� �| Html.BeginRouteForm���\�b�h �|

�@BeginRouteForm���\�b�h�́ABeginForm���\�b�h�Ɠ������A<form>�^�O�𐶐����邽�߂̃��\�b�h�ł��邪�A�|�X�g����i������ł͂Ȃ��j���[�g�E�p�����[�^��\�������^�Ƃ��Ďw��ł���_���قȂ�B

�@�ȉ��́A���X�g22�̃R�[�h��BeginRouteForm���\�b�h�ŏ������������̂��B

@using (Html.BeginRouteForm(
  "Default", // ���[�g��
  new {
    action = "Edit", // �A�N�V������
    controller = "Books", // �R���g���[����
    id = "978-4-7981-2344-8",
    flag = "1" // ���̂ق��̃p�����[�^
  }, // ���[�g�E�p�����[�^
  FormMethod.Post, // HTTP���\�b�h�imethod�����j
  new { enctype = "multipart/form-data"} // ���̂ق��̑���
)) {
  �c�c�t�H�[���̓��e�c�c
}
@Using Html.BeginRouteForm(
  "Default", ' ���[�g��
  New With {
    .action = "Edit", ' �A�N�V������
    .controller = "Books", ' �R���g���[����
    .id = "978-4-7981-2344-8",
    .flag = "1" ' ���̂ق��̃p�����[�^
  }, ' ���[�g�E�p�����[�^
  FormMethod.Post, ' HTTP���\�b�h�imethod�����j
  New With {.enctype = "multipart/form-data"} ' ���̂ق��̑���
)
  �c�c�t�H�[���̓��e�c�c
End Using
���X�g24�@BeginRouteForm���\�b�h�ɂ��t�H�[���̐����i��FC#�A���FVB�j

�����x���𐶐����� �| Html.LabelFor���\�b�h �|

�@LabelFor�́A�w�肳�ꂽ�v���p�e�B�̕\�����iDisplayName�����j�⌾��ݒ�ɉ�����<label>�^�O�𐶐����邽�߂̃��\�b�h���B�֘A�t����v���p�e�B�́A�umodel => model.�v���p�e�B���v�̂悤�Ƀ����_���Ƃ��Ďw��ł���i����́A�ȍ~�ŏЉ�Ă���u�`For�v���\�b�h�ɂ‚��āA���ׂē��l�j�B

@Html.LabelFor(model => model.Isbn)
@Html.LabelFor(Function(model) model.Isbn)
���X�g25�@LabelFor���\�b�h�ɂ�郉�x���̐����i��FC#�A���FVB�j

<label for="Isbn">ISBN�R�[�h</label>
���X�g26�@���s���Ƀ��X�g25�ɂ��o�͂����HTML�R�[�h

���e�L�X�g�{�b�N�X�^�e�L�X�g�G���A�𐶐����� �| Html.TextBoxFor�^PasswordFor�^TextAreaFor���\�b�h �|

�@TextBoxFor�^PasswordFor�^TextAreaFor���\�b�h�́A���ꂼ���ʓI�ȃe�L�X�g�{�b�N�X�A�p�X���[�h���̓{�b�N�X�A�����s�e�L�X�g�G���A�𐶐����邽�߂̃��\�b�h���B�e�L�X�g�{�b�N�X�^�e�L�X�g�G���A�ɂ́A�v���p�e�B�̌��ݒl�����f�����B

�e�L�X�g�{�b�N�X�F
@Html.TextBoxFor(
  model => model.Title, // �v���p�e�B
  new { size = 15, maxlength = 18 } // ���̂ق��̑���
)

�p�X���[�h���̓{�b�N�X�F
@Html.PasswordFor(
  model => model.Password, // �v���p�e�B
  new { size = 10, maxlength = 20 } // ���̂ق��̑���
)

�e�L�X�g�G���A�F
@Html.TextAreaFor(
  model => model.Title, // �v���p�e�B
  10, // �s��
  70, // ����
  new { @class = "area" } //���̂ق��̑���
)
�e�L�X�g�{�b�N�X�F
@Html.TextBoxFor(
  Function(model) model.Title, ' �v���p�e�B
  New With {.size = 15, .maxlength = 18} ' ���̂ق��̑���
)

�p�X���[�h���̓{�b�N�X�F
@Html.PasswordFor(
  Function(model) model.Password, ' �v���p�e�B
  New With {.size = 10, .maxlength = 20} ' ���̂ق��̑���
)

�e�L�X�g�G���A�F
@Html.TextAreaFor(
  Function(model) model.Title, ' �v���p�e�B
  10, ' �s��
  70, ' ����
  New With { .class = "area" } ' ���̂ق��̑���
)
���X�g27�@TextBoxFor�^PasswordFor�^TextAreaFor���\�b�h�ɂ��e�L�X�g�{�b�N�X�̐����i��FC#�A���FVB�j

�e�L�X�g�{�b�N�X�F
<input id="Title" maxlength="18" name="Title"
  size="15" type="text" value="JavaScript�{�i����" />

�p�X���[�h���̓{�b�N�X�F
<input id="Password" maxlength="20" name="Password"
  size="10" type="password" />

�e�L�X�g�G���A�F
<textarea class="area" cols="70" id="Title" name="Title" rows="10">
JavaScript�{�i����</textarea>
���X�g28�@���s���Ƀ��X�g27�ɂ��o�͂����HTML�R�[�h

�@�G���e�B�e�B�������ؑ�������`����Ă���ꍇ�ɂ́A���؃p�����[�^��\��data-xxxxx���������킹�ďo�͂����B�{�e�ł́ATextBoxFor�^PasswordFor�^TextAreaFor���\�b�h���܂��f�t�H���g�ŏo�͂���R�[�h�𕪂���₷�����邽�߁A�����̑����͊������Ă���̂Œ��ӂ��ꂽ���B

�m���Ӂnreadonly�����Aclass�����Ȃǂɗv���ӁiC#�̏ꍇ�j

�@���̂ق��̑����Ƃ���class�Areadonly�̂悤�ȑ������w�肷��ꍇ�ɂ͗v���ӂ��B�Ƃ����̂��A�����̃L�[���[�h��C#�̗\���ł��邽�߁A���̂܂܎w�肵�Ă��܂��ƁA�G���[�ƂȂ��Ă��܂��̂��B

�@���̂悤�ȑ������w�肷��ꍇ�́A�L�[���[�h���L�[���[�h�Ƃ��Č��Ȃ��Ȃ��悤�ɂ��邽�߁A�v���p�e�B���̐擪�Ɂu@�v��t�^���Ȃ���΂Ȃ�Ȃ��i���X�g27�̑��������j�B



�@INDEX
�@ ASP.NET MVC����y�o�[�W����3�Ή��z
�@ ��5��@�V�����r���[�E�G���W���uRazor�v�̊�{�𗝉����悤
�@   1�DASPX�Ƃ̔�r�ŗ�������Razor���@�i1�j
�@   2�DASPX�Ƃ̔�r�ŗ�������Razor���@�i2�j
  3�D�r���[�J��������������u�r���[�E�w���p�[�v�i1�j
�@   4�D�r���[�J��������������u�r���[�E�w���p�[�v�i2�j
�@
�C���f�b�N�X�E�y�[�W�w �@�uASP.NET MVC����y�o�[�W����3�Ή��z�v


Insider.NET �t�H�[���� �V���L��
  • ��2��@�Ȍ��ȃR�[�f�B���O�̂��߂� �i2017/7/26�j
    �@�����_���ŋL�q�ł��郁���o�̑����Athrow���Aout�ϐ��A�^�v���ȂǁAC# 7�ɂ͈ȑO�����R�[�h���Ȍ��ɋL�q�ł���悤�ȋ@�\����������Ă���
  • ��1��@Visual Studio Code�f�o�b�O�̊�b�m�� �i2017/7/21�j
    �@Node.js�v���O�������f�o�b�O���Ȃ���AVisual Studio Code�ɓ�������Ă���f�o�b�O�@�\�̊�{�́u�L�v���}�X�^�[���悤
  • ��1��@���ĂȃR�[�f�B���O�̂��߂� �i2017/7/19�j
    �@C# 7�Œlj����ꂽ�V�@�\�̒�����A�u���l���e�����\���̉��P�v�Ɓu���[�J���֐��v���Љ��B�����͕�����₷���R�[�h���L�q����̂Ɏg����
  • Presentation Translator �i2017/7/18�j
    �@Presentation Translator��PowerPoint�p�̃A�h�C���B�v���[���e�[�V�������̎����̕t����A������ł̎��^�����A�X���C�h�̖|����s����
��IT���[���}�K�W���@�V������X�^�b�t�̃R���������[���œ͂��܂��i�����j

���ڂ̃e�[�}

Insider.NET �L�������L���O

�{�� ����