0

I have a modal dialog in my ASP.NET Web application using the following code:

        <div class="modal fade" id="mdlNewNote" tabindex="-1" aria-labelledby="mdlNewNoteLabel" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="mdlNewNoteLabel">Add New Note</h5>
                        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <form class="was-validated" id="frmNote" name="frmNote" method="post">
                        <div class="modal-body">
                            <div class="container-fluid">
                                <div class="row">
                                    <div class="form-floating col-sm-12">
                                        <textarea class="form-control" rows="10" id="NoteBody" name="NoteBody"></textarea>
                                        <label for="NoteBody">Notes</label>                                    
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary">Save</button>
                            <button type="button" class="btn btn-success" data-bs-dismiss="modal">Close</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

In that block there is a <textarea> element that I want to be sized inside the modal according to its row count, which is set at 10. However, it only actually displays three rows in the modal, as shown below:

What modal looks like in browser

How do I fix it so that the <textarea> element is as tall as it should be (based on number of rows it is given) rather than the 3 rows it shows now?

FrontRangeGuy
  • 101
  • 2
  • 10

2 Answers2

1

With bootstrap, you have to override the height by using:

.specific-textarea { height: 100% !important; }

cf: https://stackoverflow.com/a/58398265/12172974

Mamisoa
  • 11
  • 4
0

Use HTML for textarea sizing.

<label for="story">Tell us your story:</label>

<textarea id="story" name="story"
          rows="5" cols="33">
It was a dark and stormy night...
</textarea>

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea