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
Liked By
Write Answer
How to pass data from controller to .ascx page
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
11-Nov-2011Hi 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