5 February 2014

how to use query string in mvc




Read both the parameter values in bellow index method.

public string Index(string id, string name)
{
    return "The value of Id = " + id + " and Name = " + name;
}

      (or)


Just like web forms, you can also use "Request.QueryString"

public string Index(string id)
{
    return "The value of Id = " + id + " and Name = " + Request.QueryString["name"];
}

No comments:

Post a Comment