sara afzal
sara afzal

Reputation: 13

How to get value in textarea tag in c#?

I'm making a form for "EDIT PRODUCTS INFORMATION' in which I'm retrieving data from the database. I have retrieved all the values except for the product's description which is displayed in textarea tag. The text-input tag works perfectly fine but textarea tag does not. Below is the code attached.

    <!-- Text input-->
    <div class="form-group">
        <label class="col-md-4 control-label" for="product_id">Stock Name *</label>
        <div class="col-md-4">
            <input pattern="^[0-9a-zA-Z\s\.\-]+$" placeholder="Floral Vine Sneakers - Pink." value="@Model[i].Stock_Name" maxlength="150" id="name" name="Stock_Name" class="form-control input-md" required="" type="text">
        </div>
    </div>

  <!-- Textarea -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="product_description">Stock Description *</label>
            <div class="col-md-4">
                <textarea class="form-control" id="product_description" pattern="^[0-9a-zA-Z\s\.\-\,]+$" name="Stock_Description" value="@Model[i].Stock_Description" required=""></textarea>
            </div>
        </div>

Upvotes: 1

Views: 355

Answers (1)

LazZiya
LazZiya

Reputation: 5729

just put the contents inside html tags:

<textarea class="form-control" id="product_description" pattern="^[0-9a-zA-Z\s\.\-\,]+$" name="Stock_Description" required="">@Model[i].Stock_Description</textarea>

Upvotes: 3

Related Questions