user1951007
user1951007

Reputation: 233

use ascx control in a div tag

I Created a user control named "Uctest.ascx". I want to show this .ascx control in a div tag with out using aspx page. If it's possible means please help me to do this?

Upvotes: 0

Views: 1280

Answers (3)

G.Y
G.Y

Reputation: 6159

Impossible.. since a Web User Control has events in its code-behind and those need to be executed, ie who will call the load_event ??

What you can do however... Is create an IFrame.. and load aspx page into it, which serves as container to your ascx..

Upvotes: 0

Stasel
Stasel

Reputation: 1298

As people say here it's impossible without aspx page. However, I can think about a not so clean solution for this.

You can create aspx page, place your control there and load that aspx page through AJAX into your div. But you will lose all server side functionality of this control so I don't know if this solution is any good for you

Upvotes: 1

Habib
Habib

Reputation: 223187

I want to show this .ascx control in a div tag with out using aspx page

You can't.

From ASP.NET User Controls Overview MSDN:

User controls cannot run as stand-alone files. Instead, you must add them to ASP.NET pages, as you would any control.

Upvotes: 0

Related Questions