On postback should a TextboxFor send the data back to the action

I built an editable table using HTMLand jquery and it worked brilliantly then we were told that the table also needed to be sortable so a colleague took over and changed some of the code and made the table sortable but it is only now I have noticed since this was done, the table no longer posts back when you press enter after you change any thing to make the change go back to the DB. For the life of me I cannot figure out why.
I put in a bit of $.ajax to post it back to the action and it does post back now but the is no data being posted. I thought when I'm using a TextboxFor it would have happened automatically but I found out I was wrong.
here is some of the code.
part of the table
<td class="edit"; id = "AGENTID">

                        <span class="item-display">@Model.getConfirmationData[idx].AGENT_ID</span>            

                        <span class="item-field">@Html.TextBoxFor(modelItem => Model.getConfirmationData[idx].AGENT_ID, new { @class = "inputID", name="getConfirmationData[" + idx + "].AGENT_ID" })</span>

                    </td>

                    <td  class="edit", id="AGENTNAME">

                        <span class="item-display">@Model.getConfirmationData[idx].AGENT_Name</span>       

                        <span class="item-field">@Html.TextBoxFor(modelItem => Model.getConfirmationData[idx].AGENT_Name, new { @class = "inputname", name="getConfirmationData[" + idx + "].AGENT_Name"})</span> 

                    </td>        

                    <td class="edit"; id = "DBAName";>

                        <span class="item-display">@Model.getConfirmationData[idx].DBA_Name</span>       

                        <span class="item-field">@Html.TextBoxFor(modelItem => Model.getConfirmationData[idx].DBA_Name, new { @class = "inputname", name="getConfirmationData[" + idx + "].DBA_Name" })</span>

                    </td>

Open in new window


also this is the script
 

$(document).ready(
      $(document.documentElement)
        .on("click", "span.item-display", function (event)
        {
          $(this).parent().closest('tr').addClass('blue')
          var originalcontent = $(this).text();
          $(event.currentTarget)
            .hide()
            .next("span.item-field")
            .show()
            .find(":input:first")
            .focus()
            .select();
         })
        .on("keypress", "span.item-field", function (event)
        {                    
          if (event.keypress != 13 && event.which != 13)     
            return;
          event.preventDefault();   
          $.ajax({ type: "POST", url: "/AGENT/Confirmation/"})
          var $field = $(event.currentTarget),
          $display = $field.prev("span.item-display");
          $display.html($field.find(":input:first").val());
          $display.show();
          $field.hide();
        })
    );

Open in new window


and the Action
[HttpPost]

       public ActionResult Confirmation(AgentConfirmationViewModel records) //Save updated records

       {

            CWA_AgentEntities CWA = new CWA_AgentEntities();
            foreach (STAGING_TABLE_Details record in records.getConfirmationData)
            {
                STAGING_TABLE Old_Rec = CWA.STAGING_TABLE.Find(record.ID);
                Old_Rec.AGENT_ID = record.AGENT_ID;

                Old_Rec.AGENT_Name = record.AGENT_Name;

                Old_Rec.DBA_Name = record.DBA_Name;              

                [More fields.]     

            }
            CWA.SaveChanges();
            return this.Confirmation();

Open in new window


I know I am not sending data back with my ajax call but I was under the impression because I was using helpers it would take care of that + it used to work before there were changes made to the table but now I can't see what might be causing the problem.

Any help is GREATLY appreciated.
Niall GallagherDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Niall GallagherDeveloperAuthor Commented:
I eventually figure it out
I added data to my ajax call
data: $(#formConfirmation").serialize()

to look like $.ajax({ type: "POST", url: "/Agent/Confirmation/", data: $("#formConfirmation").serialize() })

when you look at it, it makes perfect sense, but it worked anyway
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Niall GallagherDeveloperAuthor Commented:
This answered the question asked and posted the data
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.