質問

I am making an MVC4 application which is displaying data from CRM.

public ActionResult Index(string id)  
{  
    MyApplication.Data.ResourceData resourceData = new MyApplication.Data.ResourceData();  
    var resource1 = resourceData.showResource(id);

    return View(resource1);
    //return View();
}

I have created a button in CRM and when I click the button I get Id get url www.MyApplication.com?123456 where 123456 is Id of the Data in CRM.

Now how to parse data to open my application.

I mean how to tell my MVC application to take the string after ? and as Id which needs to be pased in Index.

役に立ちましたか?

解決

You need to add a key to the url. change it to www.MyApplication.com?id=123456. then in your controller

public ActionResult Index(string id){...} 

should catch the id. If that doesn't pull the id then Request.QueryString["id"] should get it also. Hopefully this helps.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top