Results 1 to 2 of 2

Thread: Urgent help with repeater!!!!

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Urgent help with repeater!!!!

    I have apage where the user selects two dates, and then a repeater is showing price information depending on the date interval(discounts etc) My problem is that the repeater isn't filled with new values when a postback occurs, here is my code:

    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         If Not Page.IsPostBack Then
    3.                 FillUI()
    4.         Else
    5.                  RenderOrderLineRep()
    6.         End If
    7.  
    8.     End Sub
    9.  
    10.  
    11.  
    12. Public Sub RenderOrderLineRep()
    13.         Dim oOrder As New COrder
    14.         repOrderRows.DataSource = oOrder.GetOrderLineItemsByOrderId("1")
    15.         repOrderRows.DataBind()
    16.         oOrder = Nothing
    17.     End Sub

    The FillUI() is a method that fills abunch of labels.. and calls the RenderOrderLineRep which is binding the control with the data


    On the calendar control I ahve the following code when the user is selecting a date (tried first with a button to post the page, but for the information in the repeater to update I had to click TWICE)


    VB Code:
    1. Private Sub calFromDate_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calFromDate.SelectionChanged
    2.         lblFromDate.Text = calFromDate.SelectedDate.ToShortDateString
    3.         calFromDate.Visible = False
    4.         imgFromDate.Visible = True
    5.         Dim oOrder As New COrder
    6.         oOrder.SetAllOrderLinePrices("1", DateDiff(DateInterval.Day, CDate(lblFromDate.Text), CDate(lblToDate.Text)))
    7.         'oOrder = Nothing
    8.     End Sub


    As I understand it, when the user select a date, the new prices in updated into the database using oOrder.SetAllOrderLinePrices (I have checked in the database, and it works)
    and then the page does a postback, and RenderOrderLineRep() is binding the new data to the repeater...

    But why isn't this working? If I did the updating in a submit button instead of on date selection I had to press the button twice to see price changes in repeater, even that the db was updated on the first click.

    Am I forgetting to close or flush or commit something??? This is getting on my nerves...

    help, quickly please

    kind regards
    henrik

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    I think I have found the problem... the datecontrol doesn't perform a postback when I click on a date, only when I change months, and stuff like that, but never when I select the date, then it only performs the date-event without the postback....

    perhaps this is the right way it should be, but it feels wrong somehow

    kind regards
    henrik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width