User Control's/serverside-forms/IsPostBack/Viewstate?

M

MattGood

Hi!

I can't show a ascx-control in a correct manner when the ascx-control uses
another ascx-control, the IsPostBack and ViewState's etc. don't seems to
work, problably because there can only be one form that runs at server per
page.

When I have this first control as an aspx-page instead, the DropDownLists in
the ascx-control I use in the aspx-page are filled with correct data and
everything works just fine, but as I tried to explain, nothing works when
converting this aspx-page that uses a ascx-control, to be an ascx-control
itself.

How do you other fellas solve the issue of multiple serverside-forms/page,
and the possibilities of using ascx-controls that's using ascx-controls
etc.?

If anybody have a solution of this problem, I would appreciate it...

Thanx for taking the time to read about this...
 
C

Curt_C [MVP]

dont rename an ASPX to ASCX and expect it to work as a control.
In visual studio (which I'm assuming you are using) select control as the
item you want to add, it will be properly setup then.
Controls dont get a <form> tag, they aren't meant to be used "stand-alone"
so they dont need it.
 
M

MattGood

Thanx Curt!

But that don't seem to be the problem...
I don't just rename the ASPX, and I have "Control Language="c#"
AutoEventWireup="false" Codebehind="" etc. in the ASCX, I set it up that way
you described, so that's not the problem, and I don't have form-tags,
starting directly with a table-tag, and I register a tagprefix and tagname
and src so I can use the other ascx-file in this one with these tags...

Actually, both the ASCX-control and the ASCX-control that is in the other is
shown, but the data is not filled, seems to be IsPostBack and ViewStates
that doesn't work...

MattGood
 
M

MattGood

But I really can't find out how to solve the problem, I was forced to have
an IFRAME in my default page, where my layout is, and put ASPX-pages in
that, to make the things work... I just want to add controls to a TD-tag or
DIV-tag or something like that, so the size of the page/control doesnt
matter in the same way it does when using a IFRAME. The IFRAME is not the
solution for me, I think... I can easily add controls to a TD-tag or
DIV-tag. But thats when the problems occurs, on postback, the whole page
reloads, and the control is vanished or has to be reloaded in page_load, and
then the states before postback is gone, of course... But, is there
something that I may have foreseen that may cause my troubles? And is there
any solution of this?

MattGood
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top