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
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
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