PDA

Click to See Complete Forum and Search --> : Urgent help with repeater!!!!


MrNorth
Feb 18th, 2004, 02:00 AM
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:



Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
FillUI()
Else
RenderOrderLineRep()
End If

End Sub



Public Sub RenderOrderLineRep()
Dim oOrder As New COrder
repOrderRows.DataSource = oOrder.GetOrderLineItemsByOrderId("1")
repOrderRows.DataBind()
oOrder = Nothing
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)



Private Sub calFromDate_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calFromDate.SelectionChanged
lblFromDate.Text = calFromDate.SelectedDate.ToShortDateString
calFromDate.Visible = False
imgFromDate.Visible = True
Dim oOrder As New COrder
oOrder.SetAllOrderLinePrices("1", DateDiff(DateInterval.Day, CDate(lblFromDate.Text), CDate(lblToDate.Text)))
'oOrder = Nothing
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

MrNorth
Feb 18th, 2004, 03:22 AM
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