Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. placeholder

placeholder

Scheduled Pinned Locked Moved ASP.NET
question
38 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T terjk

    -Now the checkboxes work but the imagebutton click cannot(which work perfectly the previous time). Is this due the the page load code where both ispostback are place together? Both can work if only they are on different forms and only one can function in the particualar form. -one more problem:(checkbox) when i first view a particular page, everything was displayed as expected. however, when i make another selection (which is page ispostback), I'm able to view the data on the second button click. Which means when i first select and click on the button, no event was called but the breaskpoint did step into the method. Only upon 2nd selection and buttonClick, the data was then displayed. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here If IsPostBack And CType(Session("Checkbox"), Boolean) Then-->checkbox createcheckbox() End If If Not Session("ButtonCreated") Is Nothing Then---> imagebutton buttoncreated = CType(Session("ButtonCreated"), Boolean) Else buttoncreated = False End If If IsPostBack And buttoncreated Then createCalendar() End If End sub Is this due to the code in the page load? These are the codes you gave me and i have edited some and implement it

    J Offline
    J Offline
    John Kuhn
    wrote on last edited by
    #12

    Right... well... hmmm... The code I gave you was fairly generalized and not particularly optimized to a particular implementation. Therefore, it is difficult to characterize what you've shown here as "right" or "wrong". If anything, I'd refactor and simplify as much as possible:

    Protected checkboxExists As Boolean
    Protected buttonExists As Boolean

    Private Sub Page_Load(...) ...
    If IsPostBack Then
    Dim checkboxExists As Boolean = CType(Session("Checkbox"), Boolean)
    Dim buttonExists As Boolean = CType(Session("ButtonCreated"), Boolean)
    If checkboxExists Then
    createCheckBox()
    End If
    If buttonExists Then
    createCalendar()
    End If
    End If
    Session("CheckBox") = checkboxExists
    Session("ButtonCreated") = buttonExists
    End Sub

    This is normally the point at which it becomes increasingly difficult to impart any significant advice, unless there is something specific that is terribly wrong; at this point, you have to {code, test, debug} as many times as it takes to get it right. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

    T 3 Replies Last reply
    0
    • J John Kuhn

      Right... well... hmmm... The code I gave you was fairly generalized and not particularly optimized to a particular implementation. Therefore, it is difficult to characterize what you've shown here as "right" or "wrong". If anything, I'd refactor and simplify as much as possible:

      Protected checkboxExists As Boolean
      Protected buttonExists As Boolean

      Private Sub Page_Load(...) ...
      If IsPostBack Then
      Dim checkboxExists As Boolean = CType(Session("Checkbox"), Boolean)
      Dim buttonExists As Boolean = CType(Session("ButtonCreated"), Boolean)
      If checkboxExists Then
      createCheckBox()
      End If
      If buttonExists Then
      createCalendar()
      End If
      End If
      Session("CheckBox") = checkboxExists
      Session("ButtonCreated") = buttonExists
      End Sub

      This is normally the point at which it becomes increasingly difficult to impart any significant advice, unless there is something specific that is terribly wrong; at this point, you have to {code, test, debug} as many times as it takes to get it right. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

      T Offline
      T Offline
      terjk
      wrote on last edited by
      #13

      Well, this problem has been solved. However, the imagebutton still can't work!! It works before i add the mouseover tooltip. Stil wondering what went wrong. Can help? The codes in page_load is the same as above(what you gave) Createcalendar subroutin when i create the imagebutton: Dim img As New ImageButton AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\pencil.gif") cellleft.Controls.Add(img) row.Controls.Add(cellleft) buttoncreated = True Session("ButtonCreated") = buttoncreated what went wrong? :sigh:

      1 Reply Last reply
      0
      • J John Kuhn

        Right... well... hmmm... The code I gave you was fairly generalized and not particularly optimized to a particular implementation. Therefore, it is difficult to characterize what you've shown here as "right" or "wrong". If anything, I'd refactor and simplify as much as possible:

        Protected checkboxExists As Boolean
        Protected buttonExists As Boolean

        Private Sub Page_Load(...) ...
        If IsPostBack Then
        Dim checkboxExists As Boolean = CType(Session("Checkbox"), Boolean)
        Dim buttonExists As Boolean = CType(Session("ButtonCreated"), Boolean)
        If checkboxExists Then
        createCheckBox()
        End If
        If buttonExists Then
        createCalendar()
        End If
        End If
        Session("CheckBox") = checkboxExists
        Session("ButtonCreated") = buttonExists
        End Sub

        This is normally the point at which it becomes increasingly difficult to impart any significant advice, unless there is something specific that is terribly wrong; at this point, you have to {code, test, debug} as many times as it takes to get it right. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

        T Offline
        T Offline
        terjk
        wrote on last edited by
        #14

        The calendar just refresh when i click on the imagebutton

        J 1 Reply Last reply
        0
        • T terjk

          The calendar just refresh when i click on the imagebutton

          J Offline
          J Offline
          John Kuhn
          wrote on last edited by
          #15

          How many ImageButton controls are you creating and how many times is the method called? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

          T 3 Replies Last reply
          0
          • J John Kuhn

            How many ImageButton controls are you creating and how many times is the method called? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

            T Offline
            T Offline
            terjk
            wrote on last edited by
            #16

            One imagebutton is created when the date is >=date.today and also depends on the number of records in the database. So it hard for me to estimate the number imagebutton controls i wil be creating. It will check against the date and number of records in database. How many time the method is called depends on the number of rows.

            1 Reply Last reply
            0
            • J John Kuhn

              How many ImageButton controls are you creating and how many times is the method called? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

              T Offline
              T Offline
              terjk
              wrote on last edited by
              #17

              any possible solution to this?

              1 Reply Last reply
              0
              • J John Kuhn

                How many ImageButton controls are you creating and how many times is the method called? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                T Offline
                T Offline
                terjk
                wrote on last edited by
                #18

                help help PLEASE...........................................................................urgent

                J 1 Reply Last reply
                0
                • T terjk

                  help help PLEASE...........................................................................urgent

                  J Offline
                  J Offline
                  John Kuhn
                  wrote on last edited by
                  #19

                  Sorry about the delay -- Holiday weekend and all. I tried to get this to work, but I couldn't, either. :( Have you considered abandoning the default Calendar control and creating your own class? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                  T 1 Reply Last reply
                  0
                  • J John Kuhn

                    Sorry about the delay -- Holiday weekend and all. I tried to get this to work, but I couldn't, either. :( Have you considered abandoning the default Calendar control and creating your own class? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                    T Offline
                    T Offline
                    terjk
                    wrote on last edited by
                    #20

                    mmmm..............:(( Have you considered abandoning the default Calendar control and creating your own class?:confused: I really have no idea what to do now...:mad: :confused::~ :confused::~ :confused::~ :confused::~

                    J 1 Reply Last reply
                    0
                    • T terjk

                      mmmm..............:(( Have you considered abandoning the default Calendar control and creating your own class?:confused: I really have no idea what to do now...:mad: :confused::~ :confused::~ :confused::~ :confused::~

                      J Offline
                      J Offline
                      John Kuhn
                      wrote on last edited by
                      #21

                      Sorry, :(( My brain ceased to function on this one. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                      T 3 Replies Last reply
                      0
                      • J John Kuhn

                        Sorry, :(( My brain ceased to function on this one. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                        T Offline
                        T Offline
                        terjk
                        wrote on last edited by
                        #22

                        Thanks anyway

                        1 Reply Last reply
                        0
                        • J John Kuhn

                          Sorry, :(( My brain ceased to function on this one. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                          T Offline
                          T Offline
                          terjk
                          wrote on last edited by
                          #23

                          Why is it that the imagebutton click can only work with checkboxLIST but not with those checkbox what are created dynamically??????????

                          1 Reply Last reply
                          0
                          • J John Kuhn

                            Sorry, :(( My brain ceased to function on this one. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                            T Offline
                            T Offline
                            terjk
                            wrote on last edited by
                            #24

                            There must be something that links them together right? If not how come with the same code and just he change of checkbox codes, everything can't work??? Im going crazy soon.. Have been trying several ways..

                            J 1 Reply Last reply
                            0
                            • T terjk

                              There must be something that links them together right? If not how come with the same code and just he change of checkbox codes, everything can't work??? Im going crazy soon.. Have been trying several ways..

                              J Offline
                              J Offline
                              John Kuhn
                              wrote on last edited by
                              #25

                              Well, yes... I'm not certain which snippet you're referring to, but in general, bear in mind that you're writing code that responds to particular events and each control event is independent of others on the same page, except for the page level events, that fire each time the page loads or posts. So, if, for example, I write an event handler for a button that creates a checkbox dynamically and stores some indication of that in Session, and later on I write an event handler that responds to the click event of another control that also dynamically creates something, I have to store some other indicator of that in Session as well, and so on, for each thing that I do. Do you see? If need be, I can point to the places in MSDN that describe the sequence of events and ASP session or state management. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                              T 4 Replies Last reply
                              0
                              • J John Kuhn

                                Well, yes... I'm not certain which snippet you're referring to, but in general, bear in mind that you're writing code that responds to particular events and each control event is independent of others on the same page, except for the page level events, that fire each time the page loads or posts. So, if, for example, I write an event handler for a button that creates a checkbox dynamically and stores some indication of that in Session, and later on I write an event handler that responds to the click event of another control that also dynamically creates something, I have to store some other indicator of that in Session as well, and so on, for each thing that I do. Do you see? If need be, I can point to the places in MSDN that describe the sequence of events and ASP session or state management. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                                T Offline
                                T Offline
                                terjk
                                wrote on last edited by
                                #26

                                Now I can leave out the dynamic checkboxes. Will be using checkboxlist instead (which can wotk with the dynamic imagebutton the previous time), so i guess this wouldn't be much of a problem as compare to the dynamic checkbox, am i right? However, I got to run the weekly form before i can click the button of the daily? Page load If Not Session("ButtonCreated") Is Nothing Then buttoncreated = CType(Session("ButtonCreated"), Boolean) Else buttoncreated = False End If If IsPostBack And buttoncreated Then createCalendar() End If private sub createcalendar() imgholi.ID = rid imgholi.ImageUrl = Server.MapPath("Pics\pencil.gif") AddHandler imgholi.Click, AddressOf ImageClickHandler cellleft.Controls.Add(imgholi) buttoncreated = True Session("ButtonCreated") = buttoncreated i have 3 calendars(Daily, weekly, monthly). If i were to select the daily calendar and click on the imagebtn, the table refreshes unless i select the weekly calendar and click the imgbtn. why?

                                1 Reply Last reply
                                0
                                • J John Kuhn

                                  Well, yes... I'm not certain which snippet you're referring to, but in general, bear in mind that you're writing code that responds to particular events and each control event is independent of others on the same page, except for the page level events, that fire each time the page loads or posts. So, if, for example, I write an event handler for a button that creates a checkbox dynamically and stores some indication of that in Session, and later on I write an event handler that responds to the click event of another control that also dynamically creates something, I have to store some other indicator of that in Session as well, and so on, for each thing that I do. Do you see? If need be, I can point to the places in MSDN that describe the sequence of events and ASP session or state management. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                                  T Offline
                                  T Offline
                                  terjk
                                  wrote on last edited by
                                  #27

                                  BIG BIG PROBLEM! Any idea what error is this? An error has occurred because a control with auto-generated id '_ctl4' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events. When the page is loaded the first time, everything is fine. However, when i click next, to show other day of the event calendar, It create TWO calendars instead of 1. Why is this so? Dim buttoncreated As Boolean = CType(Session("ButtonCreated"), Boolean) If IsPostBack Then If Not buttoncreated Then createCalendar() End If End If Session("ButtonCreated") = buttoncreated (in page load) Public Sub createCalendar() If Not statuscheck = 0 Then Dim img As New ImageButton img.ID = rid Session.Add("ButtonClick", imgResource) AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\pencil.gif") cellleft.Controls.Add(img) row.Controls.Add(cellleft) buttoncreated = True Session("ButtonCreated") = buttoncreated createcalendar() is called each time user click on BUTTON GO.

                                  1 Reply Last reply
                                  0
                                  • J John Kuhn

                                    Well, yes... I'm not certain which snippet you're referring to, but in general, bear in mind that you're writing code that responds to particular events and each control event is independent of others on the same page, except for the page level events, that fire each time the page loads or posts. So, if, for example, I write an event handler for a button that creates a checkbox dynamically and stores some indication of that in Session, and later on I write an event handler that responds to the click event of another control that also dynamically creates something, I have to store some other indicator of that in Session as well, and so on, for each thing that I do. Do you see? If need be, I can point to the places in MSDN that describe the sequence of events and ASP session or state management. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                                    T Offline
                                    T Offline
                                    terjk
                                    wrote on last edited by
                                    #28

                                    BIG BIG PROBLEM! Any idea what error is this? An error has occurred because a control with auto-generated id '_ctl4' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events. When the page is loaded the first time, everything is fine. However, when i click next, to show other day of the event calendar, It create TWO calendars instead of 1. Why is this so? Dim buttoncreated As Boolean = CType(Session("ButtonCreated"), Boolean) If IsPostBack Then If Not buttoncreated Then createCalendar() End If End If Session("ButtonCreated") = buttoncreated (in page load) Public Sub createCalendar() If Not statuscheck = 0 Then Dim img As New ImageButton img.ID = rid Session.Add("ButtonClick", imgResource) AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\pencil.gif") cellleft.Controls.Add(img) row.Controls.Add(cellleft) buttoncreated = True Session("ButtonCreated") = buttoncreated createcalendar() is called each time user click on BUTTON GO.

                                    1 Reply Last reply
                                    0
                                    • J John Kuhn

                                      Well, yes... I'm not certain which snippet you're referring to, but in general, bear in mind that you're writing code that responds to particular events and each control event is independent of others on the same page, except for the page level events, that fire each time the page loads or posts. So, if, for example, I write an event handler for a button that creates a checkbox dynamically and stores some indication of that in Session, and later on I write an event handler that responds to the click event of another control that also dynamically creates something, I have to store some other indicator of that in Session as well, and so on, for each thing that I do. Do you see? If need be, I can point to the places in MSDN that describe the sequence of events and ASP session or state management. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                                      T Offline
                                      T Offline
                                      terjk
                                      wrote on last edited by
                                      #29

                                      What is the cause for this error? I have assigned a unique ID to each controls. An error has occurred because a control with auto-generated id '_ctl26' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events. How i can get the value of which iamgebutton is click. i need to pass the value to another form when click.

                                      J 1 Reply Last reply
                                      0
                                      • J John Kuhn

                                        Right... well... hmmm... The code I gave you was fairly generalized and not particularly optimized to a particular implementation. Therefore, it is difficult to characterize what you've shown here as "right" or "wrong". If anything, I'd refactor and simplify as much as possible:

                                        Protected checkboxExists As Boolean
                                        Protected buttonExists As Boolean

                                        Private Sub Page_Load(...) ...
                                        If IsPostBack Then
                                        Dim checkboxExists As Boolean = CType(Session("Checkbox"), Boolean)
                                        Dim buttonExists As Boolean = CType(Session("ButtonCreated"), Boolean)
                                        If checkboxExists Then
                                        createCheckBox()
                                        End If
                                        If buttonExists Then
                                        createCalendar()
                                        End If
                                        End If
                                        Session("CheckBox") = checkboxExists
                                        Session("ButtonCreated") = buttonExists
                                        End Sub

                                        This is normally the point at which it becomes increasingly difficult to impart any significant advice, unless there is something specific that is terribly wrong; at this point, you have to {code, test, debug} as many times as it takes to get it right. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                                        T Offline
                                        T Offline
                                        terjk
                                        wrote on last edited by
                                        #30

                                        If Not Session("ButtonCreated") Is Nothing Then buttoncreated = CType(Session("ButtonCreated"), Boolean) Else buttoncreated = False End If If IsPostBack And buttoncreated Then ' calEvent_DayRender() ' createcalendar() End If How can i apply this to monthly calendar? i make sure of the calendar control method-dayrender. I cant possible just code the sub just like what i did for the other calendar -createcalendar()

                                        J 1 Reply Last reply
                                        0
                                        • T terjk

                                          If Not Session("ButtonCreated") Is Nothing Then buttoncreated = CType(Session("ButtonCreated"), Boolean) Else buttoncreated = False End If If IsPostBack And buttoncreated Then ' calEvent_DayRender() ' createcalendar() End If How can i apply this to monthly calendar? i make sure of the calendar control method-dayrender. I cant possible just code the sub just like what i did for the other calendar -createcalendar()

                                          J Offline
                                          J Offline
                                          John Kuhn
                                          wrote on last edited by
                                          #31

                                          Which part -- the DayRender event or the CreateCalendar method or the setting of a session variable to indicate something already done? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

                                          T 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups