Home > DeveloperSection > Forums > How to pass data from controller to .ascx page
venkat gosetty
venkat gosetty

Total Post:15

Points:105
Posted on    November-11-2011 1:58 AM

 ASP.NET MVC ASP.NET MVC 
Ratings:


 1 Reply(s)
 2579  View(s)
Rate this:
Please give me solution


Jenry Hock
Jenry Hock

Total Post:18

Points:126
Posted on    November-11-2011 5:35 AM

Hi venkat,

You can use concept of ViewData in ASP.NET mvc to pass value from controller to view. You can use following code-snippet to pass value from controller to view or ascx page,

ViewData["viewDataName"]="This is a vaiew data demo";

You can use following code snippet to retrive data on view page

<h2><%=ViewData["viewDataName"]%></h2>

May be this is useful for you.

Thanks,

Please mark it as a answer if this will provide you a solution


Don't want to miss updates? Please click the below button!

Follow MindStick