Value in a alertbox
I have some value in controller ,i need to display that value in alert box.could you please tell me how to do that
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sunny SharmaPosted Oct 24, 2013, 7:53 AM
-----------------------------------------
Sasi ReddyPosted Oct 30, 2013, 7:39 AM
Sasi ReddyPosted Oct 30, 2013, 7:38 AM
That was working fine, thank u.
Jaganathan BantheswaranPosted Oct 30, 2013, 12:40 AM
You cant, just leave it.
Sasi ReddyPosted Oct 29, 2013, 1:17 AM
Jaganathan BantheswaranPosted Oct 28, 2013, 6:03 AM
Jaganathan BantheswaranPosted Oct 28, 2013, 2:28 AM
Sasi ReddyPosted Oct 24, 2013, 9:13 AM
Vinoth KumarPosted Oct 24, 2013, 9:03 AM
Sasi ReddyPosted Oct 24, 2013, 8:02 AM
Sasi ReddyPosted Oct 24, 2013, 7:59 AM
Sasi ReddyPosted Oct 24, 2013, 7:58 AM
In alet u r displaying message,along with that i want to display some value.can u tell me that
Jaganathan BantheswaranPosted Oct 24, 2013, 7:53 AM
Its not better approach to have all the values in ViewBag, use your own model/viewmodel instead of ViewBag.
RobbinsonPosted Oct 24, 2013, 7:49 AM
The one of the easiest way to achieve this is to return value from controller using ViewData.
For example:
In your view, you can write in script block.
Another way to achieve the same is directly response the script from your controller.
public ActionResult UploadPropertyImage()
{
// Business logic....
return Content("");
}
Hope, this will help you out.
Please Don't forget to mark as answer if this post helps you.
Sunny SharmaPosted Oct 24, 2013, 7:49 AM
Sunny SharmaPosted Oct 24, 2013, 7:45 AM
Jaganathan BantheswaranPosted Oct 24, 2013, 7:40 AM
Sunny SharmaPosted Oct 24, 2013, 7:39 AM
Sasi ReddyPosted Oct 24, 2013, 7:35 AM
Sunny SharmaPosted Oct 24, 2013, 7:31 AM
Show me your View and controller.
@ Jaganathan Bantheswaran: ViewBag will also work, TempData is a kind of temporary container which is emptied after the value is read.
Sasi ReddyPosted Oct 24, 2013, 7:30 AM
Jaganathan BantheswaranPosted Oct 24, 2013, 7:22 AM
Sasi ReddyPosted Oct 24, 2013, 7:17 AM
Sunny SharmaPosted Oct 24, 2013, 5:49 AM
Keeping it simple, add the value to ViewBag use it in View, like:
Controller
-----------------
....
ViewBag.myValue = 45;// set your value here.
....
-----------------
View
-----------------
-----------------
Simple as that.
HTH :)