1

I have a page called

EditProject.aspx?id=xxx

I would like to invoke it wherever I want in a modal dialog. The modal dialog is simple with bootstrap.

I would just like to know if there is a control to invoke the page somehow in a div or modal dialog.

I know about IFrame, but is there a nicer more modern way with asp .net?

Thanks

1 Answer 1

1

You'd be better off moving EditProject.aspx to a user control, EditPorject.ascx.

Userconrols work much the same as aspx pages, supporting the same events, but you can embed them within ASPX pages like so:

<div id="edit-project-popup">
    <namespace:EditProject ID="editProject" runat="server" />
</div>

You can still access the query string parameters from the usercontrol. You can also pass values to the usercontrol by adding a property:

    public partial class EditProject : UserControl
    {
        public int ID
        {
            get;
            set;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
           // Your Code   
        }
    }

You can then set this property in the ASPX pages markup:

<uc:EditProject ID="editProject" runat="server" ID="xxx" />

or in the ASPX pages code behind:

editProject.ID = "xxx";

Hope this helps.

For more information on user controls see this overview on MSDN: http://msdn.microsoft.com/en-us/library/fb3w5b53(v=vs.100).aspx

Sign up to request clarification or add additional context in comments.

3 Comments

Web User Controls can access the same querystring parameters as the page it's inserted on.
Is there a guide to making a usercontrol from a page using a master page? All my style sheets are gone.
There is a basic walk-though on MSDN here: link If you have copied the link to your CSS file into the user control the relative path may no longer be the same. You're better off leaving the link to the stylesheet in the aspx page, or better still the master page. If this is the case then it could be that your CSS is targeting the controls ID's which could have been changed due to being nested in the usercontrol.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.