How to render ascx control in mvc controller class

İ have a hybrid project. it was a web forms project before then we convert it to mvc project and now old pages are web forms and new ones are mvc.

i have a control named as PickImage.ascx

normally i can load the control by using following code.

        Controls_ImagePicker imagePicker = (Controls_ImagePicker)LoadControl("~/Controls/ImagePicker.ascx");
        imagePicker.FileClass = FileClass.COURSE_ICON;
        imagePicker.RandomIfEmpty = false; 
        imagePicker.FileID = iconID;

but now i want same thing in mvc controller page. how can i do this?

Answers


i have create an instance of my page and then loaded the control.

        Page  aspx = new Page();
        Controls_ImagePicker imagePicker = (Controls_ImagePicker)aspx.LoadControl("~/Controls/ImagePicker.ascx");

Need Your Help

OpenCart Category and Product View blank in Frontend

opencart

I "inherited" an existing and working install of OpenCart 1.5.2.1.