how to send input value to control using asp.net querystring? [closed]

-4

I have this code in View

    @using (Html.BeginForm("VisualizaJogoParaExclusao", "Relatorios", FormMethod.Post))
    {

        <div class="row">
            <div class="span12">
                <input class="form-control input-lg " id="NumeroJogo" required onkeyup="somenteNumeros(this);" placeholder="número"  type="text"  />
            </div>
        </div>

        <br />


        <div class="row">
            <div class="span6">
                <button class="btn btn-lg btn-block btn-primary glyphicon glyphicon-search" type="submit" value="pesquisar">  Pesquisar</button>
                <a href="@Url.Action("Index", "MenuPrincipal")" class="btn btn-lg btn-block btn-warning ">
                    Retorno
                </a>
            </div>
        </div>
    
asked by anonymous 31.12.2015 / 01:46

2 answers

0
  • Switch the form to FormMethod.Get
  • Add the name in the input
  • Get the result in controller int idDoregistro = Convert.ToInt32(Request.QueryString["NumeroJogo"]) ;
  • 31.12.2015 / 05:04
    1

    Change from FormMethod.Post to FormMethod.Get that field value will be sent as querystring .

        
    31.12.2015 / 03:41