开发者

Return Pop Up As a response In MVC ASP.NET

开发者 https://www.devze.com 2023-04-11 01:40 出处:网络
In facebook after I shared something in my wall I get a nice pop message about my activity. Sometimes whenever there is an error with they gave a nice pop about the error. Like this.

In facebook after I shared something in my wall I get a nice pop message about my activity. Sometimes whenever there is an error with they gave a nice pop about the error. Like this.

Return Pop Up As a response In MVC ASP.NET

I know in facebook everything is about ajax.

I am creating a web application using mvc 3 asp.net. In my web app there is something similar to sharing links like in facebook.

I implemented this feature using ajax and partial views and it is works fine.

When user submit a new link, In my controller action method I update the db and return a partial view finally update my view with nice animation.

Now my problem is how can I give a pop up response while updating开发者_运维百科 my view(facebook wall).

I want to do both of them with the ActionResult.

I not sure this is the correct way to do this.

Briefly what I want is update my view with automatic pop up response. Hope you understand what I want.

Let me know If you need any clarification on this.

Please help me to implement this function.

Thanks !!


Well a "popup" is client-side functionality, not server-side. You can't do it with actionresult per-se.

Perhaps you should return a PartialViewResult from an action method, which is fired by an AJAX call (e.g jQuery).

Then in the callback, set the HTML of a hidden container/div to the partial view's HTML, then show it in a fancy way.

Something like jQModal or jQuery UI dialog is perfect for this.


I found the answer myself. Add Jquery library and unrobustive javascript and

return JavaScript("alert('Some message')");
0

精彩评论

暂无评论...
验证码 换一张
取 消