User(server) controls confusion.
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngibuyspy' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Duncan C. Ion
Hi,
A little while ago I posted a query regarding the fact that I'd added a
webform textbox to the _menu ascx (IBS Store application) and then got a
problem in that you can't have two <form runat=server tags on the same page.
Andre Colbiornsen kindly pointed out that if you place the form tag in what
is effectively the container page and then remove all other form tags in the
user controls, that would do it - which it does.

The problem with this approach is that when you create several controls,
this 'dependence' on the parent page setup starts to fall apart and any
chance that one might write a self-contained control seems to evaporate.
I've looked at the ASP.net book from wrox and I'm still at a loss as to how
you might have 'form islands' within the same page.
Am I right in thinking that this just isn't possible?

At the root of these questions is a (possibly basic) problem. I have a
textbox in the _menu ascx. I want to pass the contents of that box onto my
other pages and need to access the value in the Page_Load event (usually
through the request.params method). I don't want to use the session state as
that destroys my overall statelessness. I can't use Viewstate as that is a
function of a form (catch 22 I think).

Any hints would be appreciated.
regards,
Duncan.

Reply to this message...
 
    
Phil Orion
If you reference a thread that I started 7-17-2002 --which you responded to --I see that this
topic is still boiling.
Please alert us all if you or someone else in the community can come up with an answer. If you recall,
I am trying to place multiple controls (ascx's) with forms (<form method...)
in desktopdefault.asp
since postback is to self --I agree that we cannot continue to alter desktopdefault.asp.

Phil

"Duncan C. Ion" <Click here to reveal e-mail address> wrote in message news:687108@aspngibuyspy...
[Original message clipped]

Reply to this message...
 
    
Brian Bilbro (VIP)
I think you'll are making a problem out of something that isn't a problem. I've never had to create <FORM runat=server> within my user controls. I think it's very feasible to just assume that the page (.aspx) you are within has a form runatserver tag. If your .aspx doesn't have a form runat-server tag then why are you creating an ASP.NET page? The <form runat=server> is a fundamental infrastructure block of asp.net. You might as well also say you don't won't your .aspx pages to inherit from the Page class but to inherit from something else (that doesn't indirectly inherit from the Page class). You might have a design reason for doing this but it's just outside of the infrastructure capabilities of ASP.NET Whenever I create a .aspx page I always add a <form runat=server> tab right after the body tab and add the ending </form> tag right before the ending </body> tag (VS.NET does this for you by default anyway).

My Two Cents,
Brian
----- Original Message -----
From: Phil Orion
Newsgroups: aspngibuyspy
To: aspngibuyspy
Sent: Thursday, July 25, 2002 5:31 PM
Subject: [aspngibuyspy] Re: User(server) controls confusion.

If you reference a thread that I started 7-17-2002 --which you responded to --I see that this
topic is still boiling.
Please alert us all if you or someone else in the community can come up with an answer. If you recall,
I am trying to place multiple controls (ascx's) with forms (<form method...)
in desktopdefault.asp
since postback is to self --I agree that we cannot continue to alter desktopdefault.asp.

Phil

"Duncan C. Ion" <Click here to reveal e-mail address> wrote in message news:687108@aspngibuyspy...
[Original message clipped]

| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
 
    
Duncan C. Ion
Could be. However, when I did as you suggested, the textbox - which was
set to postback on change - refused to do so! At this point I gave up
and decided to bite the bullet and institute a frameset (I'd wanted to
do this anyway for UI reasons). I still have a related problem in that I
want to pass the returned value of the postback in frame A and use that
in the page_load of frame Bs'.aspx page.

I thought that I could use the EventBubble method (But I can't get the
MSDN sample to work!!!) - Is this the right approach??

Thanks for the input. I guess my mistake was assuming that the term
'user control' meant just that - that one could write a self-contained
(empirical) 'black-box' that was data-bidirectional and drop it in
anywhere. The User-control is, I believe, 'merely' a UI drop-in - but
you have to be careful about the restrictions.

Duncan

-----Original Message-----
From: Brian Bilbro [mailto:Click here to reveal e-mail address]
Sent: 26 July 2002 14:46
To: aspngibuyspy
Subject: [aspngibuyspy] Re: User(server) controls confusion.

I think you'll are making a problem out of something that isn't a
problem. I've never had to create <FORM runat=server> within my user
controls. I think it's very feasible to just assume that the page
(.aspx) you are within has a form runatserver tag. If your .aspx
doesn't have a form runat-server tag then why are you creating an
ASP.NET page? The <form runat=server> is a fundamental infrastructure
block of asp.net. You might as well also say you don't won't your .aspx
pages to inherit from the Page class but to inherit from something else
(that doesn't indirectly inherit from the Page class). You might have a
design reason for doing this but it's just outside of the infrastructure
capabilities of ASP.NET Whenever I create a .aspx page I always add
a <form runat=server> tab right after the body tab and add the ending
</form> tag right before the ending </body> tag (VS.NET does this for
you by default anyway).

My Two Cents,

Brian

----- Original Message -----

From: Phil Orion <mailto:Click here to reveal e-mail address>

Newsgroups: aspngibuyspy

To: aspngibuyspy <mailto:Click here to reveal e-mail address>

Sent: Thursday, July 25, 2002 5:31 PM

Subject: [aspngibuyspy] Re: User(server) controls confusion.

If you reference a thread that I started 7-17-2002 --which you responded
to --I see that this

topic is still boiling.

Please alert us all if you or someone else in the community can come up
with an answer. If you recall,

I am trying to place multiple controls (ascx's) with forms (<form
method...)

in desktopdefault.asp

since postback is to self --I agree that we cannot continue to alter
desktopdefault.asp.

Phil

"Duncan C. Ion" < <mailto:Click here to reveal e-mail address> Click here to reveal e-mail address>
wrote in message <news:687108@aspngibuyspy> news:687108@aspngibuyspy...

[Original message clipped]

| http://www.asplists.com/search = SEARCH Archives

| [aspngibuyspy] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngibuyspy.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
 
    
Brian Bilbro (VIP)
Hmm...wierd I don't remember suggesting that. :) I also disagree that you can't create "black-box" user controls. I never look at your original problem, I was only responding to the complaint of multiple runat=server forms.

Having said the above and after looking at your original problem:

[Original message clipped]

Steps to solving your problem.
1. I would define an Interface that requires the property you want to expose.
2. Have your menu implement the inferface and have the property expose the value of the textbox
3. Whenever another control wants access to said property, it can search through the controls hierachcy for any controls that implement the Interface and then get the value of the property.

HTHs,
Brian

----- Original Message -----
From: Duncan C. Ion
To: aspngibuyspy
Sent: Friday, July 26, 2002 10:26 AM
Subject: [aspngibuyspy] Re: User(server) controls confusion.

Could be. However, when I did as you suggested, the textbox - which was set to postback on change - refused to do so! At this point I gave up and decided to bite the bullet and institute a frameset (I'd wanted to do this anyway for UI reasons). I still have a related problem in that I want to pass the returned value of the postback in frame A and use that in the page_load of frame Bs'.aspx page.

I thought that I could use the EventBubble method (But I can't get the MSDN sample to work!!!) - Is this the right approach??

Thanks for the input. I guess my mistake was assuming that the term 'user control' meant just that - that one could write a self-contained (empirical) 'black-box' that was data-bidirectional and drop it in anywhere. The User-control is, I believe, 'merely' a UI drop-in - but you have to be careful about the restrictions.

Duncan

-----Original Message-----
From: Brian Bilbro [mailto:Click here to reveal e-mail address]
Sent: 26 July 2002 14:46
To: aspngibuyspy
Subject: [aspngibuyspy] Re: User(server) controls confusion.

I think you'll are making a problem out of something that isn't a problem. I've never had to create <FORM runat=server> within my user controls. I think it's very feasible to just assume that the page (.aspx) you are within has a form runatserver tag. If your .aspx doesn't have a form runat-server tag then why are you creating an ASP.NET page? The <form runat=server> is a fundamental infrastructure block of asp.net. You might as well also say you don't won't your .aspx pages to inherit from the Page class but to inherit from something else (that doesn't indirectly inherit from the Page class). You might have a design reason for doing this but it's just outside of the infrastructure capabilities of ASP.NET Whenever I create a .aspx page I always add a <form runat=server> tab right after the body tab and add the ending </form> tag right before the ending </body> tag (VS.NET does this for you by default anyway).

My Two Cents,

Brian

----- Original Message -----

From: Phil Orion

Newsgroups: aspngibuyspy

To: aspngibuyspy

Sent: Thursday, July 25, 2002 5:31 PM

Subject: [aspngibuyspy] Re: User(server) controls confusion.

If you reference a thread that I started 7-17-2002 --which you responded to --I see that this

topic is still boiling.

Please alert us all if you or someone else in the community can come up with an answer. If you recall,

I am trying to place multiple controls (ascx's) with forms (<form method...)

in desktopdefault.asp

since postback is to self --I agree that we cannot continue to alter desktopdefault.asp.

Phil

"Duncan C. Ion" <Click here to reveal e-mail address> wrote in message news:687108@aspngibuyspy...

[Original message clipped]

| http://www.asplists.com/search = SEARCH Archives

| [aspngibuyspy] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngibuyspy.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

| [aspngibuyspy] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngibuyspy.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
 
    
Phil Orion
Brain,
You seem to have some insight into this topic so if you can indulge me I'd like to pose the question this way.
I have three forms on a page that need to post to different pages outside the framework of IBS. What is a clan way to do this...

My example is this... If you place a HTML Module on a tab and place the following <form> into the module
the form will appear on the portal. Upon clicking submit, you are posted to desktopdefault.aspx and not dictionary.com..

<form id="bubba" name="bubba" method="post" action="http://www.dictionary.com/cgi-bin/dict.pl";>
<table width="100%" CELLSPACING=0 BORDER=1>
<tr><td bgcolor="#ffffcc" class="normal">
<font color="#993300" face="Myriad,Arial,Helvetica,sans-serif"><strong> Look up:</strong></font><br> 
<input type="text" name="term" size=28 maxlength=48 value=""><br> 
<input type="submit" alt="OK" value="Submit" />
</td></tr>
</table>
</form>

How would one code a standard code block in the deskopdefault.aspx to be able to handle every possible submit from a <form> stored in a module???

Phil

"Brian Bilbro" <Click here to reveal e-mail address> wrote in message news:689360@aspngibuyspy...
I think you'll are making a problem out of something that isn't a problem. I've never had to create <FORM runat=server> within my user controls. I think it's very feasible to just assume that the page (.aspx) you are within has a form runatserver tag. If your .aspx doesn't have a form runat-server tag then why are you creating an ASP.NET page? The <form runat=server> is a fundamental infrastructure block of asp.net. You might as well also say you don't won't your .aspx pages to inherit from the Page class but to inherit from something else (that doesn't indirectly inherit from the Page class). You might have a design reason for doing this but it's just outside of the infrastructure capabilities of ASP.NET Whenever I create a .aspx page I always add a <form runat=server> tab right after the body tab and add the ending </form> tag right before the ending </body> tag (VS.NET does this for you by default anyway).

My Two Cents,
Brian
----- Original Message -----
From: Phil Orion
Newsgroups: aspngibuyspy
To: aspngibuyspy
Sent: Thursday, July 25, 2002 5:31 PM
Subject: [aspngibuyspy] Re: User(server) controls confusion.

If you reference a thread that I started 7-17-2002 --which you responded to --I see that this
topic is still boiling.
Please alert us all if you or someone else in the community can come up with an answer. If you recall,
I am trying to place multiple controls (ascx's) with forms (<form method...)
in desktopdefault.asp
since postback is to self --I agree that we cannot continue to alter desktopdefault.asp.

Phil

"Duncan C. Ion" <Click here to reveal e-mail address> wrote in message news:687108@aspngibuyspy...
[Original message clipped]

| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
 
    
Brian Bilbro (VIP)
>Brain,
Awe, sucks. I hope you aren't making fun of me. :)

[Original message clipped]

hmm... actually this is a pretty good (and valid) situation. :)

<form id="bubba" name="bubba" method="post" action="http://www.dictionary.com/cgi-bin/dict.pl"" target="_blank">http://www.dictionary.com/cgi-bin/dict.pl";>
<table width="100%" CELLSPACING=0 BORDER=1>
<tr><td bgcolor="#ffffcc" class="normal">
<font color="#993300" face="Myriad,Arial,Helvetica,sans-serif"><strong> Look up:</strong></font><br> 
<input type="text" name="term" size=28 maxlength=48 value=""><br> 
<input type="submit" alt="OK" value="Submit" />
</td></tr>
</table>
</form>

>How would one code a standard code block in the deskopdefault.aspx to be able to handle every possible submit from a <form> stored in a module???

Here are a few possible solutions:

1. Have your module udpate the action right before it submits:
<input type="submit" alt="OK" value="Submit" onClick="document.forms[0].action='http://www.dictionary.com/cgi-bin/dict.pl'" >

Haven't tested but something of that variation should work.

2. Handle the button click on your post back and do a server-side HttpPost to the URL and return the results back (.NET HttpPost are easy to do...should be a few articles out there).

3. Test to see if dictionary.com doesn't accept querystring parameters (I bet it does), in that case I would handle the post on the server-side and then do a redirect like so:

http://www.dictionary.com/cgi-bin/dict.pl?term=foobar" target="_blank">http://www.dictionary.com/cgi-bin/dict.pl?term=foobar

HTHs,
Brian
Reply to this message...
 
    
Nightspore
You should probably use a datalist webcontrol with all it's power. You could
use response redirect on the click event of the submit button, having set
the value of each button the url you will redirect to(probably getting the
url from the database).
-----Original Message-----
From: Phil Orion [mailto:Click here to reveal e-mail address]
Sent: Friday, July 26, 2002 9:41 AM
To: aspngibuyspy
Subject: [aspngibuyspy] Re: User(server) controls confusion.

Brain,
You seem to have some insight into this topic so if you can indulge me I'd
like to pose the question this way.
I have three forms on a page that need to post to different pages outside
the framework of IBS. What is a clan way to do this...

My example is this... If you place a HTML Module on a tab and place the
following <form> into the module
the form will appear on the portal. Upon clicking submit, you are posted
to desktopdefault.aspx and not dictionary.com..

<form id="bubba" name="bubba" method="post"
action="http://www.dictionary.com/cgi-bin/dict.pl";>
<table width="100%" CELLSPACING=0 BORDER=1>
<tr><td bgcolor="#ffffcc" class="normal">
<font color="#993300"
face="Myriad,Arial,Helvetica,sans-serif"><strong> Look
up:</strong></font><br> 
<input type="text" name="term" size=28 maxlength=48
value=""><br> 
<input type="submit" alt="OK" value="Submit" />
</td></tr>
</table>
</form>

How would one code a standard code block in the deskopdefault.aspx to be
able to handle every possible submit from a <form> stored in a module???

Phil

"Brian Bilbro" <Click here to reveal e-mail address> wrote in message
news:689360@aspngibuyspy...
I think you'll are making a problem out of something that isn't a
problem. I've never had to create <FORM runat=server> within my user
controls. I think it's very feasible to just assume that the page (.aspx)
you are within has a form runatserver tag. If your .aspx doesn't have a
form runat-server tag then why are you creating an ASP.NET page? The <form
runat=server> is a fundamental infrastructure block of asp.net. You might
as well also say you don't won't your .aspx pages to inherit from the Page
class but to inherit from something else (that doesn't indirectly inherit
from the Page class). You might have a design reason for doing this but
it's just outside of the infrastructure capabilities of ASP.NET Whenever
I create a .aspx page I always add a <form runat=server> tab right after the
body tab and add the ending </form> tag right before the ending </body> tag
(VS.NET does this for you by default anyway).

My Two Cents,
Brian
----- Original Message -----
From: Phil Orion
Newsgroups: aspngibuyspy
To: aspngibuyspy
Sent: Thursday, July 25, 2002 5:31 PM
Subject: [aspngibuyspy] Re: User(server) controls confusion.

If you reference a thread that I started 7-17-2002 --which you
responded to --I see that this
topic is still boiling.
Please alert us all if you or someone else in the community can come
up with an answer. If you recall,
I am trying to place multiple controls (ascx's) with forms (<form
method...)
in desktopdefault.asp
since postback is to self --I agree that we cannot continue to alter
desktopdefault.asp.

Phil

"Duncan C. Ion" <Click here to reveal e-mail address> wrote in message
news:687108@aspngibuyspy...
[Original message clipped]

| http://www.asplists.com/search = SEARCH Archives

| [aspngibuyspy] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngibuyspy.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
 
    
Bio
I have built a site and on one of the pages I have built a module that
includes javascript and a form that when clicked submits the collected
information to another site. However although the form works on its own
when I include it as a module it fails, is this to do with the two forms
on one page problem that I saw a while back???? Can anyone suggest ways
that I can get this to work??

Many thanks

John Pether

http://www.uk-website-designer.co.uk

+44 (0) 1842 820522
Reply to this message...
 
    
Dave
The way I made this work is before your form put a <form></form> then it
should work fine i.e. <form></form><form> your form stuff here</form>
I hope this helps,
David Luper II
www.mommiesanddaddies.com <http://www.mommiesanddaddies.com/>

-----Original Message-----
From: Bio [mailto:Click here to reveal e-mail address]
Sent: Friday, August 16, 2002 10:33 AM
To: aspngibuyspy
Subject: [aspngibuyspy] Re: User(server) controls confusion.

I have built a site and on one of the pages I have built a module that
includes javascript and a form that when clicked submits the collected
information to another site. However although the form works on its own
when I include it as a module it fails, is this to do with the two forms
on one page problem that I saw a while back???? Can anyone suggest ways
that I can get this to work??

Many thanks

John Pether
http://www.uk-website-designer.co.uk
+44 (0) 1842 820522

| [aspngibuyspy] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngibuyspy.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
 
    
James Yang
when u use forms in a user control the id of the form element change.

if your user control id is "ctrName" and if a textbox id is "txtID"

when you place txtID in ctrName the id changes to something like

__ctrName__txtID

I think that's the problem

James

----- Original Message -----
From: Bio
To: aspngibuyspy
Sent: Saturday, August 17, 2002 1:33 AM
Subject: [aspngibuyspy] Re: User(server) controls confusion.

I have built a site and on one of the pages I have built a module that includes javascript and a form that when clicked submits the collected information to another site. However although the form works on its own when I include it as a module it fails, is this to do with the two forms on one page problem that I saw a while back???? Can anyone suggest ways that I can get this to work??

Many thanks

John Pether

http://www.uk-website-designer.co.uk

+44 (0) 1842 820522

| [aspngibuyspy] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngibuyspy.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives
Reply to this message...
 
 




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com