mvc model datatable clone row

mvc model datatable clone row

hmverizonhmverizon Posts: 6Questions: 0Answers: 0
edited August 2011 in General
How can I clone a row in which drop down columns are there.

Replies

  • hmverizonhmverizon Posts: 6Questions: 0Answers: 0
    Could you please help me, how to clone a table row: I have a table like this :



    ID
    Company>



    Html.TextBoxFor( m => m.id)
    Html.DropDownList("ddlMyList",ViewData("Companies") as IEnurable, new { Style = "width : 30" } )
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    jquery allows you to clone an element, optionally including data and events attached to it. optionally performing a deep copy for cloned elements

    http://api.jquery.com/clone/

    it would help if you added a class or id to your row(s) so you could select them
    [code]
    // clone first row in first table (if you used an id, you could select a particular table)
    // append that cloned row to the same table
    $('table:first').find('tr:first').clone(true).appendTo($('table:first'));
    [/code]

    (this is off the top of my head.. might need to be tested/debugged.. but the idea is there)
  • hmverizonhmverizon Posts: 6Questions: 0Answers: 0
    I did tried as advised, but didnt work.. Here is the actual table :



    Select
    Line Item
    Profile #
    Container Category
    Weight
    Wt. Unit
    Volume
    Vol Unit
    Quantity




    <% if (Model.ShipmentManifests.Count > 0)
    if( Model.ShipmentManifests[0].ShipmentInformationLineItems.Count > 0)
    {
    for (int i = 0; i < Model.ShipmentManifests[0].ShipmentInformationLineItems.Count; i++)
    {%>

    <%= Html.CheckBox("chkBxLineItemSelect", false, new { @value = "1-A"})%>
    <%: Html.TextBoxFor(m => m.ShipmentManifests[0].ShipmentInformationLineItems[i].LineId, new { style = "width: 70px" })%>

    <%: Html.DropDownListFor(model => model.ShipmentManifests[0].ShipmentInformationLineItems[i].WasteProfileId, ViewData["ProfileNumbers"] as IEnumerable, new { id = "profileNum" })%>


    <%: Html.DropDownListFor(model => model.ShipmentManifests[0].ShipmentInformationLineItems[i].ContainerCategory, ViewData["ContainerCategories"] as IEnumerable, new { id = "ddlContainerCategories" })%>

    <%: Html.TextBoxFor(m => m.ShipmentManifests[0].ShipmentInformationLineItems[i].ContainerWeight, new { style = "width: 70px" })%>

    <%: Html.DropDownListFor(model => model.ShipmentManifests[0].ShipmentInformationLineItems[i].ContainerWeightUnits, ViewData["WeightTypes"] as IEnumerable, new { id = "weightType" })%>

    <%: Html.TextBoxFor(m => m.ShipmentManifests[0].ShipmentInformationLineItems[i].ContainerVolume, new { style = "width: 70px" })%>


    <%: Html.DropDownListFor(model => model.ShipmentManifests[0].ShipmentInformationLineItems[i].ContainerVolumeUnits, ViewData["VolumeTypes"] as IEnumerable, new { id = "volumeType" })%>


    <%: Html.TextBoxFor(m => m.ShipmentManifests[0].ShipmentInformationLineItems[i].ContainerQuantity)%>


    <%}
    } %>
  • hmverizonhmverizon Posts: 6Questions: 0Answers: 0
    Any comments on this please. Urgent, I need to meet deadline.
  • ysor123ysor123 Posts: 9Questions: 0Answers: 0
    use code box
  • hmverizonhmverizon Posts: 6Questions: 0Answers: 0
    edited August 2011
    I am sorry, I could not understand what you mean by code box. any example.
  • hmverizonhmverizon Posts: 6Questions: 0Answers: 0
    Any comment to clone a row from datatable
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    depends on what you mean. in Javascript? use JQuery .clone()
This discussion has been closed.