Problem with hidden input and very large values ​​in HTML and ASP.NET MVC 3 Razor

Since there is a limit of 1024 characters for hidden input values, what does everyone do for values ​​that exceed this limit? Can a reasonable choice of a hidden file (<input type = "file" value = "some very long value" ...)? What are the field length limitations of any such solution?

<input id="someId" type="hidden" 
value="5538680,5538683,5538858,5539195,5540063,5540812,5540814,5541665,5541666,5541667,
5541668,5541669,5541670,5541671,5541672,5541673,5541674,5541675,5541676,5541677,5541678,
5541679,5541680,5541682,5541683,5541684,5541685,5541686,5541687,5541688,5541689,5541690,
5541691,5541692,5541693,5541694,5541695,5541696,5541697,5541698,5541728,5543254,5543501,
5543502,5543949,5543950,5544073,5544867,5545079,5545642,5545827,5545890,5545891,5545895,
5545896,5546323,5546631,5546632,5546972,5547794,5547900,5547945,5547980,554923...735181,
5735182,5735183,5735184,5735185,5735187,5735188,5735189,5735227,5735228,5735229,5735235,
5735236,5735237,5735238,5735239,5735240,5735241,5735242,5735243,5735273,5735744,5735745,
5735746,5735747,5735748,5735749,5735836,5735837,5735838,5735839,5735840,5735841,5735842,
5735843,5735844,5735845,5735846,5735847,5735848,5735849,5735850,5735851,5735852,5735853,
5735854,5735855,5735856,5735857,5735858,5735859,5737183,5738250,5738563,5738564,5738565,
5738566,5738567,5738568,5738569,5738570,5738731,5738732,5738946" name="someName">

I am using ASP.NET MVC 3 and I would be grateful for a solution that can integrate with minimal effort. Ideally, I would like to be able to pass model values ​​over 1024 characters with razor syntax.

I also need to be able to manipulate the value on the client side using JavaScript / jQuery.

, ? . ? , -, 40 000.

: ... , , 1024 , value. , , . - / , -, . , . .

: ! Firebug "..." JavaScript. -, 1024 . ( firebug ). , , firebug. .

+5
6

<input name="someIDs[0]" type="hidden" value="5538680"/>
<input name="someIDs[1]" type="hidden" value="5538683/>

:

public ActionResult Test()
    {
        Random rand = new Random();
        List<int> list = new List<int>();
        for (int i = 0; i < 10000; i++)
        {
            list.Add(rand.Next(1,999999));
        }
        return View(list);
    }
    [HttpPost]
    public ActionResult Test(int[] item)
    {
        return View(item.ToList());
    }

@model List<int>
@{
    ViewBag.Title = "Test";
}

@using (Html.BeginForm())
{
    foreach (int item in Model)
    {

        <input type="hidden" name="item" value="@item" />
    }
    <input type="submit" value="submit" />
}
+4

<textarea name="someName">5538680,5538683,...</textarea>

style/css display:none?

+5

1024 - HTML HTML 3 . , , .

, - AJAX, .

0

, "" - .

#my-info {
    display: none;
}

<div id="my-info" data-ids="id1,id2,etc"></div>

javascript:

<script>
    $("#my-info").data("ids", @Model.JsonIds);
</script>

Model.JsonIds Json.

, .

0

@Gaby . , javascript. , . .

0

I really don't think there is a limit. as long as you can get the length of the string between quotation marks and the same string, it should accept it. there are rumors about this of 65,000 characters, however, someone wrote javascript and received more than 2,000,000 characters.

0
source

All Articles