forum

Home / DeveloperSection / Forums / How to a dynamic row in a table using Razor view in MVC4?

How to a dynamic row in a table using Razor view in MVC4?

Samuel Fernandes1081105-Oct-2013

I have a table in the razor view and this table contain some Html controls like below:-

 <table style="text-align: center; width: 680px; background-color: White;" rules="all" id="tableId"> 
                <tr>
                    <td style="width: 20px;"></td>
                    <td>
                        <label>
                            Campaign Name</label>
                    </td>
                    <td>
                        <label>
                            Valid Date From</label>
                    </td>
                    <td>
                        <label>
                            Valid Date To</label>
                    </td>
                    <td>
                        <label>
                            Is Active</label>
                    </td>
                    <td>
                        <label>
                            ContractPDF</label>
                    </td>
                    <td>
                        <label>
                            Browse Contract</label>
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.HiddenFor(m => m.Customer_ID)
                    </td>
                    <td class="trBorder">
                        @Html.TextBoxFor(m => m.Customer_Name)
                    </td>
                    <td class="trBorder">
                        @Html.TextBoxFor(m => m.ValidFrom, new { @class = "datepicker" })
                    </td>
                    <td>
                        @Html.TextBoxFor(m => m.ValidTo, new { @class = "datepicker" })
                    </td>
                    <td>
                        @Html.CheckBox("gridChkCampaignIsActive", m => m.IsActive)
                    </td>
                    <td>
                        @Html.TextBoxFor(m => m.ContractDocumentPath)
                    </td>
                    <td>
                        @Html.ActionLink("Browse", "FileUpload")
                    </td>
                </tr>
            </table>

 Add Customer button

<input type="button" value="Add Customer" name="btnAddCustomer" id="btnAddCustomer" style="margin-left: 20px;"/>


My problem is that I want this table like a grid control and when I click on "Add Customer" button, a blank row will be added in the grid control.

please Help me!

Any Help Will be Appreciated


Updated on 05-Oct-2013

Can you answer this question?


Answer

1 Answers

Liked By