Google Groups no longer supports new usenet posts or subscriptions. Historical content remains viewable.
Dismiss

4 ASP.Net & C# questions

3 views
Skip to the first unread message

ASP Yaboh

unread,
31 Aug 2004, 5:15:12 pm31/8/04
to
1) In JSP, the <form>'s "action" tag could point to a servlet. Is there
similar functionality in ASP.Net, i.e. can a C# class be called like a
servlet?

2) In some ".aspx.cs" files I can access the HTML's <form> object but others
I can not. In both cases, the <form> tag has an "id", "name" and
"runat=server". What do I need to do to reliably expose the HTML <form>?
UPDATE: I found the <form> object is not available to the .aspx.cs page
unless I close my project and reopen it! I am using VS.Net 2003 (Miscrosoft
Development Environment 2003 version7.1.3088 and .Net Framework 1.1
version1.1.4322).

3) When I do a "document.forms[0].submit()" through javascript, what, if
any, event handler in the associated "aspx.cs" catches this submit?

4) There are some cases when debugging C# classes in an ASP.Net web
application where I would like to display data to the Output console. I tried
"Console.Writeline" but the text did not appear in the Output window. How can
I display data in a C# class that is part of an ASP.Net web app?

I am new to ASP.Net but have several years experience in JSP. Any assistance
would be appreciated.
Thank you.

Frank Mamone

unread,
31 Aug 2004, 5:32:28 pm31/8/04
to
4) Try Debug.WriteLine(); You'll need to run the project in Debug mode of
course.

There's also other commands you can lookup like:

Debug.Assert();
Debug.WriteIf();

The cool thing about it is that you can leave the Debug code in and it will
be ignored when you compile for Release.

You may also want to lookup the Trace commands which can write debug info to
a Trace file , event log , etc.

Hope this helps.

- Frank

"ASP Yaboh" <ASPY...@discussions.microsoft.com> wrote in message
news:C743C0FA-BEBF-4F28...@microsoft.com...

Hermit Dave

unread,
31 Aug 2004, 6:06:52 pm31/8/04
to
1. in ASP.NET a form can only post to itself. if you want to submit to
another page you have to use html form (without runat=server)

2. a server side form (ie form which has runat=server) has child controls..
they are a part of the resulting class and can be accessed directly ie
this.controlname
you do not need to iterate the form object using DOM

3. if you do a javascript submit then page_load event handler with handle
it.if an object does a submit it will set the correct eventargs so that the
correct event handlers are fired on the server side

4. the debug statement was mentioned in the other post.


--

Regards,

Hermit Dave
(http://hdave.blogspot.com)


"ASP Yaboh" <ASPY...@discussions.microsoft.com> wrote in message
news:C743C0FA-BEBF-4F28...@microsoft.com...

Hermit Dave

unread,
31 Aug 2004, 6:14:52 pm31/8/04
to
ASP.NET version 2 which is currently in beta enables something called cross
posting.. ie you can post to another aspx page

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Hermit Dave" <hermitd...@CAPS.AND.DOTS.hotmail.com> wrote in message
news:eY2xUb6...@TK2MSFTNGP11.phx.gbl...

bruce barker

unread,
31 Aug 2004, 6:44:37 pm31/8/04
to
if you do not use asp.net postback model, it works pretty much like JSP. to
follow this model, use html controls, and repeaters.

if you use the postback model, you have a new paradigm, an abstracted form
based metaphor, with control events. you should forget all you know about
jsp.


-- bruce (sqlwork.com)

"ASP Yaboh" <ASPY...@discussions.microsoft.com> wrote in message
news:C743C0FA-BEBF-4F28...@microsoft.com...

ASP Yaboh

unread,
1 Sept 2004, 3:19:02 pm1/9/04
to
It definitely helps.
Thank you

ASP Yaboh

unread,
1 Sept 2004, 3:29:05 pm1/9/04
to
Forget my JSP - that might be too much of a shock to my system.

Thank you for the info!

ASP Yaboh

unread,
1 Sept 2004, 3:29:10 pm1/9/04
to
Dave,

Your information has been very helpful.

Further to the <form> tag. I have an HTML page with 3 frames. All three
frames are aspx. The top frame where the action begins successfully redirects
results to another frame by setting the "target" attribute. After that
though, I can no longer redirect out of the initial 'target' frame; the
"target" attribute seems to be ignored then.

Since the "target" attribute appears to be supported (it's a listed property
of the <form> object), how can I enable use of it?

Thank you again.

Hermit Dave

unread,
1 Sept 2004, 4:05:23 pm1/9/04
to
i am unsure of what you are trying to do... let me see if i understand it
correctly.

you have a html page with 3 frames.. each having one aspx page.. now you
want on submit of one to redirect the results to another frame...
oh... not sure you gonna get it done in a easy way. have to be very careful
with asp.net and frames.

okay what you can do (i think this is the only real option is to use
javascript to redirect the second frame. ie use javascript to do a client
redirect to a url.. aspx page with a server side form will not support any
action on target. target is there cause its a part of generic html. but it
will only post to itself (no matter what the target you specify in aspx).

try and use funky do javascript to do the redirection.

BTW as Bruce said earlier.. its a total paradigm shift and it takes a few
days to get used to it. Believe me its makes so much sense when it get used
to it.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"ASP Yaboh" <ASPY...@discussions.microsoft.com> wrote in message

news:FE1A8E41-1E91-4EA4...@microsoft.com...

ASP Yaboh

unread,
1 Sept 2004, 4:15:04 pm1/9/04
to
Wow, you get back quick - Thank you. I am trying to come to grips with
looking at this as a completely different approach from the past few years.
Instead of going the Javascript route with this I'm looking at redesigning
what I'm doing. Thanks.

Hermit Dave

unread,
1 Sept 2004, 4:47:44 pm1/9/04
to
well i was watching tv in between check the posts and saw you write back...
hence a quick reply on my part as well.. plus when i started asp.net i found
out a few things the hard way.. :) just trying to help other people avoid
it... specially people from a background in server side code (we are used to
old ways... :) )

if you need any help just drop in a message..

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"ASP Yaboh" <ASPY...@discussions.microsoft.com> wrote in message

news:3D1ADEC8-C098-4E37...@microsoft.com...

0 new messages