Question about array of controls

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Diana M

    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

  • Jordan S

    #2
    Re: Question about array of controls

    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@c om> wrote in message
    news:5DA53DF9-0937-4401-9094-A60747D96B21@mi crosoft.com...[color=blue]
    > 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
    >[/color]


    Comment

    • Diana M

      #3
      Re: Question about array of controls

      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:
      [color=blue]
      > 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@c om> wrote in message
      > news:5DA53DF9-0937-4401-9094-A60747D96B21@mi crosoft.com...[color=green]
      > > 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
      > >[/color]
      >
      >
      >[/color]

      Comment

      • Gordon Smith

        #4
        Re: Question about array of controls

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




        "Diana M" <PleaseNoJunk@c om> wrote in message
        news:F82F2EFB-3446-4CF8-BCC8-461141738B04@mi crosoft.com...[color=blue]
        > 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:
        >[color=green]
        >> 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@c om> wrote in message
        >> news:5DA53DF9-0937-4401-9094-A60747D96B21@mi crosoft.com...[color=darkred]
        >> > 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
        >> >[/color]
        >>
        >>
        >>[/color][/color]


        Comment

        Working...