| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- @using Library.Models.Forum
- @{
- var boardID = ViewData["BoardID"] as int?;
- var boardList = ViewData["BoardList"] as List<Board>;
- }
- <div class="row">
- <div class="col">
- <h3>@ViewData["Title"]</h3>
- </div>
- <div class="col-auto">
- <select id="boardID" class="form-select" required>
- <option value="">게시판 선택</option>
- @if (boardList != null)
- {
- @foreach (var row in boardList)
- {
- <option value="@row.ID" selected="@(row.ID == boardID)">@row.Name</option>
- }
- }
- </select>
- </div>
- </div>
- <hr />
- <script type="module">
- $(document).on("change", "#boardID", function () {
- var boardID = $(this).val();
- if (boardID) {
- const url = new URL(window.location.href);
- const pathSegments = url.pathname.split('/');
- if (pathSegments.length >= 6) {
- pathSegments[5] = boardID;
- }
- const newPath = pathSegments.join('/');
- const newURL = `${newPath}${url.search}`;
- window.location.href = newURL;
- }
- });
- </script>
|