By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,112 Members | 1,601 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,112 IT Pros & Developers. It's quick & easy.

Question about array of controls

P: n/a
Hello,
I have started my first asp.net application (beginner). I have 2 text
boxes on the form that should contain 2 different dates (beginning and end).
It would be nice to have 2 small buttons besides each text box that allow to
open little form with calendar. I came from VB world where we had arrays of
controls, but here I can't make it. Should I have 2 controls with different
names and write code twice in the button click event or here is better way to
do it?
Any comments will be great appreciated
Diana M

Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
A big difference between "the VB world" and ASP.NET Web applications
programming is that you are dealing with a request-response model in Web
programming and you are not in VB6. Your learning curve will involve far
more than learning a new language and syntax. What follows is that you need
to think very carefully (at least at first) about *where* your code is
running... will it be on the server or will it be on the client... huge
implications for runtime preformance, scalability, etc. You will also need
to think about things like application state (which you really didn't have
to think much about in the VB world - but that's getting away from your
initial question).

What might make a whole lot of sense for the functionality you are trying to
create is if you were to implement the popup calendars via DHTML on the
client (so you won't have server-side code involved at all in the
presentation of the calendar). What this solution entails is having the
required JavaScript functions on the client. Then, next to each text box you
could have buttons that, when clicked, execute the requisite JavaScript that
opens the popup calendar (which, upon closing inserts the selected date into
the associated textbox). You would not have to duplicate the JavaScript
functions at all... just call the same function(s) from the buttons
associated with each textbox.

If you think the JavaScript (DHTML) solution I suggested is too complicated,
then you might consider the alternatives will *not* include what you are
expecting based on the VB6 forms model. So, you aren't going to find a
"better" way - per se, but rather "other possible" ways - given that the VB
forms model is not possible in an ASP.NET Web application. To emulate
something that looks/feels like it would involve opening up a modal dialog
(likely from client-side JavaScript). But things can get even more
complicated when your modal dialog has to do a PostBack (i.e., it has
server-side code supporting it that must execute before the modal dialog is
closed).

You can do a google search for "DHTML Date Picker" or variations of that
phrase to find samples. You will find many for sale, but there should be
plenty that are free.

HTH

"Diana M" <PleaseNoJunk@com> wrote in message
news:5D**********************************@microsof t.com...
Hello,
I have started my first asp.net application (beginner). I have 2 text
boxes on the form that should contain 2 different dates (beginning and
end).
It would be nice to have 2 small buttons besides each text box that allow
to
open little form with calendar. I came from VB world where we had arrays
of
controls, but here I can't make it. Should I have 2 controls with
different
names and write code twice in the button click event or here is better way
to
do it?
Any comments will be great appreciated
Diana M

Nov 19 '05 #2

P: n/a
Thanks for your response. It is really long answer to such short question. I
do have experience in Web development (asp/javascript/html) and I do know
about client / server side code.
My question was specific to .net. I thought that .net gives ability to use
web form controls (for instance calendar) to make programmers life easier
If you are saying that we still have to script manually everything using
javascript maybe there is no point to move to .net

"Jordan S" wrote:
A big difference between "the VB world" and ASP.NET Web applications
programming is that you are dealing with a request-response model in Web
programming and you are not in VB6. Your learning curve will involve far
more than learning a new language and syntax. What follows is that you need
to think very carefully (at least at first) about *where* your code is
running... will it be on the server or will it be on the client... huge
implications for runtime preformance, scalability, etc. You will also need
to think about things like application state (which you really didn't have
to think much about in the VB world - but that's getting away from your
initial question).

What might make a whole lot of sense for the functionality you are trying to
create is if you were to implement the popup calendars via DHTML on the
client (so you won't have server-side code involved at all in the
presentation of the calendar). What this solution entails is having the
required JavaScript functions on the client. Then, next to each text box you
could have buttons that, when clicked, execute the requisite JavaScript that
opens the popup calendar (which, upon closing inserts the selected date into
the associated textbox). You would not have to duplicate the JavaScript
functions at all... just call the same function(s) from the buttons
associated with each textbox.

If you think the JavaScript (DHTML) solution I suggested is too complicated,
then you might consider the alternatives will *not* include what you are
expecting based on the VB6 forms model. So, you aren't going to find a
"better" way - per se, but rather "other possible" ways - given that the VB
forms model is not possible in an ASP.NET Web application. To emulate
something that looks/feels like it would involve opening up a modal dialog
(likely from client-side JavaScript). But things can get even more
complicated when your modal dialog has to do a PostBack (i.e., it has
server-side code supporting it that must execute before the modal dialog is
closed).

You can do a google search for "DHTML Date Picker" or variations of that
phrase to find samples. You will find many for sale, but there should be
plenty that are free.

HTH

"Diana M" <PleaseNoJunk@com> wrote in message
news:5D**********************************@microsof t.com...
Hello,
I have started my first asp.net application (beginner). I have 2 text
boxes on the form that should contain 2 different dates (beginning and
end).
It would be nice to have 2 small buttons besides each text box that allow
to
open little form with calendar. I came from VB world where we had arrays
of
controls, but here I can't make it. Should I have 2 controls with
different
names and write code twice in the button click event or here is better way
to
do it?
Any comments will be great appreciated
Diana M


Nov 19 '05 #3

P: n/a
Perhaps you should post a new question - "what is the point of moving to
..net for Web application development?"


"Diana M" <PleaseNoJunk@com> wrote in message
news:F8**********************************@microsof t.com...
Thanks for your response. It is really long answer to such short question.
I
do have experience in Web development (asp/javascript/html) and I do know
about client / server side code.
My question was specific to .net. I thought that .net gives ability to use
web form controls (for instance calendar) to make programmers life easier
If you are saying that we still have to script manually everything using
javascript maybe there is no point to move to .net

"Jordan S" wrote:
A big difference between "the VB world" and ASP.NET Web applications
programming is that you are dealing with a request-response model in Web
programming and you are not in VB6. Your learning curve will involve far
more than learning a new language and syntax. What follows is that you
need
to think very carefully (at least at first) about *where* your code is
running... will it be on the server or will it be on the client... huge
implications for runtime preformance, scalability, etc. You will also
need
to think about things like application state (which you really didn't
have
to think much about in the VB world - but that's getting away from your
initial question).

What might make a whole lot of sense for the functionality you are trying
to
create is if you were to implement the popup calendars via DHTML on the
client (so you won't have server-side code involved at all in the
presentation of the calendar). What this solution entails is having the
required JavaScript functions on the client. Then, next to each text box
you
could have buttons that, when clicked, execute the requisite JavaScript
that
opens the popup calendar (which, upon closing inserts the selected date
into
the associated textbox). You would not have to duplicate the JavaScript
functions at all... just call the same function(s) from the buttons
associated with each textbox.

If you think the JavaScript (DHTML) solution I suggested is too
complicated,
then you might consider the alternatives will *not* include what you are
expecting based on the VB6 forms model. So, you aren't going to find a
"better" way - per se, but rather "other possible" ways - given that the
VB
forms model is not possible in an ASP.NET Web application. To emulate
something that looks/feels like it would involve opening up a modal
dialog
(likely from client-side JavaScript). But things can get even more
complicated when your modal dialog has to do a PostBack (i.e., it has
server-side code supporting it that must execute before the modal dialog
is
closed).

You can do a google search for "DHTML Date Picker" or variations of that
phrase to find samples. You will find many for sale, but there should be
plenty that are free.

HTH

"Diana M" <PleaseNoJunk@com> wrote in message
news:5D**********************************@microsof t.com...
> Hello,
> I have started my first asp.net application (beginner). I have 2
> text
> boxes on the form that should contain 2 different dates (beginning and
> end).
> It would be nice to have 2 small buttons besides each text box that
> allow
> to
> open little form with calendar. I came from VB world where we had
> arrays
> of
> controls, but here I can't make it. Should I have 2 controls with
> different
> names and write code twice in the button click event or here is better
> way
> to
> do it?
> Any comments will be great appreciated
> Diana M
>


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.