I am not able to retrieve the values from hidden field. Sometimes I am getting values & sometimes its coming empty. Please assist.
Also let me know can we store a C# arraylist in a hiddenfield?
My HTML looks like this…
<input type="hidden" id="hdnSelectedContactID" value="@Model.Contact.ContactID" />
<input type="hidden" id="hdnSelectedAddressList" value="@Model.Contact.AddressList" />
$(document).ready(function () {
_contactID = $("#hdnSelectedContactID").val();
_addressList = $("#hdnSelectedAddressList").val();
}
After assigning a name to it in document.ready method, the outer html(in quick watch) appears like this…
outerHTML "<INPUT id=hdnSelectedContactID type=hidden name=hdnSelectedContactID>" String
outerHTML "<INPUT id=hdnSelectedAddressList value=Dell.USP.Business.Models.TelephoneList type=hidden name=hdnSelectedAddressList>" String
Why not use a helper to insert a hidden field?
You can’t store an arraylist in a hiddenfield as an object, but you can insert the values of an arraylist in a hiddenfield with delimiters to seperate them. You turn it into a string and load it in the view.