HOW TO PASS DATA FROM CONTROLLER TO .ASCX PAGE

venkat gosetty

Total Post:15

Points:105
Posted by  venkat gosetty
 2911  View(s)
Ratings:
Rate this:
Please give me solution
  1. Jenry Hock

    Post:18

    Points:126
    Re: How to pass data from controller to .ascx page

    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!