0

how can i access a hidden field value in Action methods parameter please refer following code

Url.Action("action","controller",new {para_name=hidden_field_value})
RobertKing
  • 1,853
  • 8
  • 30
  • 54

2 Answers2

0

Edit

Your code in the comment only assigns the value "country" to ViewBag.Country, which means it will not work.

again your only solution is to use the following

var url = '@Url.Action("action", "controller")?country=' + Ext.getCmp("CmbCountry").value

you say

i want to assign this value as a parameter to the Action Above and dont want to send it as a query-string parameter

but that's exactly what the Url.Action method do, if you observe the result of the Url.Action method you will see that it is one and the same

Mahmoud Darwish
  • 1,168
  • 1
  • 15
  • 28
  • i tried this but the `ViewBag.Item` is returning the name rather than value – RobertKing Jul 18 '13 at 11:18
  • here is my code `var country=""; var getCmbCountry = function () { country = Ext.getCmp("CmbCountry").value; App.hdnCountry.value=country; @(ViewBag.Country="country") };` – RobertKing Jul 18 '13 at 11:20
0

got the solution, first set the value to hidden field inside above getCmbCountry() function and then sent this hidden field value as a EXT.NET StoreParameter as below

.Params(new StoreParameter { Name="countryCode", Value="App.hdnCountry.getValue()", Mode=ParameterMode.Raw})
RobertKing
  • 1,853
  • 8
  • 30
  • 54