Can someone tell me how to add several pages in a user control .ascx, I need to redirect from a page to another.

How to do that?

Should I add page.aspx to the user control?


You can redirect in two ways

  1. Using server-side use Response.Redirect(URL)
  2. Using client-side use window.location.href = url;

You can't add a Page inside UserControl. User Control basically lives inside a Page.

| improve this answer | |
  • Yes User Control is inside a Client Web Part,can I call more than a user Control in my web part ?? How do I realize more than an interface page ? My question is not about how to redirect from page to another but how can I proceed ? – N.Sahraoui Apr 22 '15 at 13:24
  • Your question is not clear. Try adding what you are trying to achieve. – Amal Hashim Apr 22 '15 at 13:25
  • I called a User Control from my web part and then I retrieved data from SP lists using CSOM. Then this page ( In which data is retrieved ) should be redirected to a second page ( when a user clicked in a button he should be redirected to a second page). So should I prepare the second page in other user control ? Or in the same user control in which I retrieve data? – N.Sahraoui Apr 22 '15 at 13:32
  • It depends on how complex your WebPart is. There is no problem with adding multiple user controls in same webpart (you can show/hide instead of redirecting). Or you can create a different web part, then add the user control inside it.. Then create a page and host it.. Then redirect to new page. – Amal Hashim Apr 22 '15 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.