[CLOSED] Access hidden field in code behind

  1. #1

    [CLOSED] Access hidden field in code behind

    Hi

    I have a hidden field declared in my MVC view as follows:

    @(X.Hidden().ID("hdn").Value(22))
    and i try to access it in my controller using following code:

      var hdn= this.GetCmp<Hidden>("hdn");
    but when I try to get is value using hdn.Value it gives me undefined.

    Any suggestion whats wrong or missng

    Thanks
    Last edited by Daniil; Jul 23, 2013 at 12:57 PM. Reason: [CLOSED]
  2. #2
    Hi @PriceRightHTML5team,

    It means that a Hidden's value is not submitted. Generally speaking, the ASP.NET MVC concept exclude auto submitting of everything how it is done in ASP.NET WebForm by means of
    <form runat="server">
    If you call a controller action via a DirectEvent/DirectMethod, I would suggest you to send a Hidden's Value as an extra parameter.

    For example, as here with a DirectMethod in #3:
    http://mvc.ext.net/#/Events/DirectMethod/

Similar Threads

  1. .Hidden in Code behind reset to aspx code
    By bit9bug in forum 1.x Help
    Replies: 0
    Last Post: Apr 19, 2013, 8:11 AM
  2. [CLOSED] the hidden field does not retain value
    By JCarlosF in forum 2.x Premium Help
    Replies: 4
    Last Post: Mar 12, 2013, 4:23 AM
  3. [2.0 Beta 2] nCannot access Hidden field
    By Alexx in forum 2.x Help
    Replies: 2
    Last Post: May 03, 2012, 9:31 AM
  4. Replies: 5
    Last Post: Aug 26, 2009, 1:48 PM
  5. [CLOSED] Hidden field problem
    By tdracz in forum 1.x Premium Help
    Replies: 4
    Last Post: Dec 12, 2008, 1:39 PM

Tags for this Thread

Posting Permissions