asp.net mvc 4 - MVC avoiding querystring, url too long -


I have a table with checkbox in which there is a lot of contact list, checkbox is to select specific contact for them below My problem should be displayed on a text box. When I try to click on the add button, it throws an error that my URL is too long, mainly because it appears that every input is query string Via Trying to parse .. Is this another way of working?

See:

  & lt; Table id = "tblcontacts> gt; & lt; tr & gt; & lt; th colspan =" 1 "& gt; & lt; input type =" checkbox "id =" check ALL "/> gt; & lt; span & Select gt; all & lt; / span & gt; & lt; / th & gt; & lt; th colspan = "2" & gt; & lt; / th & gt; & lt; / tr & gt; & Lt; tr & gt; & lt; th & gt; @ Html.DisplayNameFor (model = & gt; Model contacts.First (selected))   Th> Html.DisplayNameFor (model = & gt; model.contacts.First (). Contact name)   Th & gt; @ Html.DisplayNameFor (model = & gt; model.contacts.First ( Contact.)  & lt; / tr & gt; @forac (Miscellaneous items in Model.contacts) {& lt; tr & gt; & lt; td style = "Text-align: Center "& gt; @ html.Che CkBoxFor (modelIt M => items selected) & lt; / td & gt; & lt; td id = "contactname" & gt; @HTML. DisplayFor (Model Itam => ItemContact) & lt ; / Td> & lt; td id = "contactnos" & gt; @HTML. DisplayFor (ModelItem => item.contact name) & lt; / td & gt; & lt; / TR & gt; } & Lt; / Table & gt; @ Click * @ & lt; Populate contacts via @Jquery (Commonscript.js) during input id = "hfContacts" name = "hfContacts" type = "hidden" />. & Lt; Input id = "hfContactnos" name = "hfContactnos" type = "hidden" /> & Lt; Div class = "button" & gt; & Lt; Input id = "btnadd" type = "submit" value = "add" /> & Lt; / Div & gt;  

Javascript:

  $ ('# btnadd'). Click (function () {// get txtMessageTo value contactname = $ ('# txtMessageTo'). ()) ""; If (contactname! = "") Contact name + = ','; // check & lt; Tr & gt; For the checked status where & lt; Td id = "contact" & gt; $ ('# (': (Check box: checked ').) Children (' # contact name ') each (function () {thisContact = $ (this); // check if the contact was previously added earlier If (! (Contact (contact.name = $ .timim (thisContact.text ()) gt; -1) contactname + = $ .trim (thisContact.text ()) + ',';}); $ ('#HFContacts' ). Val (contactname);});  

Controller:

  Public ActionResult MakeMez (String HF Contact, String HF Contactctum) // a different text Adds contacts to the model to appear on the box form  

Unless you have a reason for JS, check that asp.net mvc What is already built in. Your controller method uses any type of archive as an absolute one and you use html for loops with index values ​​(not foreach) loops

See this old but valuable:


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -