473,396 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Question about array of controls

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
3 1253
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: TheSpongeBob | last post by:
I have a .aspx that contains 2 .ascx. I need the first .ascx to fire off an event that the second .ascx handles. Is this possible ? and could anyone point me to an example. I can't seem to get the...
0
by: Patty O'Dors | last post by:
1) It seems that if you make an application with an installer project and give one of the components a strong name and designate it to be installed to the GAC, then the unique key is the...
1
by: VMI | last post by:
Im using a separate thread in my code to copy a huge file, but I get the "Controls created on one thread cannot be parented to a control on a different thread" when I want to update the Form...
1
by: Bruce | last post by:
Hello, Whats the difference b/w HTML control w/ ranat=server and "asp:" control ? Thanks.
1
by: PiPOW | last post by:
Hi. I have a question. I am developing an application and I have to choose the most suitable control to show records from some database queries, with freedom in customizing control layout and...
11
by: Sensei | last post by:
Hi again! I have ``yet another silly question'', about arrays this time. I've looked through the FAQs in the array & memory sections without finding an answer. I surely didn't look deep enough. ...
1
by: jungle38 | last post by:
Hi Guys. This is my first question regarding programming in a long time. See below a program that creates a form with a button array. The question is simple. After the AddHandler MessageBox.Show...
7
by: RBrowning1958 | last post by:
here's an easy one for you guys - .NET form designer generates this: private System.ComponentModel.IContainer components = null; but I don't see it used anywhere in the generated code - what's...
2
by: calenlas | last post by:
Hi all, I'm taking my first steps into C# <--C++ DLL Interop and unfortunately I've run into (what seems to be) a very complicated case as my first task. Perhaps someone here can help me. I...
0
by: MAJIK123 | last post by:
I'm Now in VB 2005 and I need help to put in 200 label box without binding a row of and datagrid in VB6 datagrid.row = 1 for x = 0 to 199 datagrid.col = x label(x).caption =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.