Thanks Girish,
In my aspx Page i have asp.net combobox. It has different values. So i am
generating usercontrol based on that. For example i have different flight leg
in my combobox. I select first flight leg , it populate usercontrol times 6
because it has 6 passenger.
Second time i select 2nd flight leg it has 2 usercontorl.
The usercontrol will populate correctly. But the value inside usercontrl is
not changing. I try to debug it . It seems, it is assigning the value but
messing up to show the value. Some how it is getting the value from first
flight leg.
here is my code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' This page allows the user to add/edit/delete reservations for
' for each leg of the flight. The user can navigate here from
' either the general passenger manifest or a specific leg's
' passenger manifest.
' Initializing login user id required every time page is loaded
loginUserID = CType(HttpContext.Current.Items("UserID"), Integer)
' Get FlightID
If Not Session("FlightID") Is Nothing Then
flightID = Session("FlightID")
' If not page postback do following else get leg id from ViewState
If Not Page.IsPostBack Then
' See if you can get the specific flightLegID
If Not Session("FlightLegID") Is Nothing Then
flightLegID = Session("FlightLegID")
Session.Remove("FlightLegID")
End If
' Get FlightLegs and put their numbers in dlstLeg
Dim ds As DataSet = fltLegBusiness.GetFlightLegs(flightID)
Dim dRow As DataRow
If Not ds Is Nothing AndAlso ds.Tables(0).Rows.Count > 0 Then
dlstLeg.DataSource = ds
dlstLeg.DataTextField = "iLegNumber"
dlstLeg.DataValueField = "iFlightLegID"
dlstLeg.DataBind()
' Make sure right flightLegID is highlighted and save
leg ID
If flightLegID > 0 Then
Dim dItem As ListItem =
dlstLeg.Items.FindByValue(flightLegID)
If Not dItem Is Nothing Then
dlstLeg.ClearSelection()
dItem.Selected = True
Else
flightLegID = dlstLeg.SelectedItem.Value
End If
Else
flightLegID = dlstLeg.SelectedItem.Value
End If
Else
' Warn user if no flight legs available for setting
reservations
Response.Redirect("../../ErrorReport.aspx?Source=Passenger Reservations
Page/Functionality&Message=Flight has no legs available for Crew
Reservations")
End If
Else
If Not ViewState("FlightLegID") Is Nothing Then
flightLegID = ViewState("FlightLegID")
Else
Response.Redirect("../../ErrorReport.aspx?Source=Passenger Reservations
Page/Functionality&Message=Cannot find flight leg for Passenger Reservations")
End If
End If
'' PopulateResv
'this procedure, will create different flight leg detail usercontrol.
Me.PopulateReservations()
Else
Response.Redirect("../../ErrorReport.aspx?Source=Passenger
Reservations Page/Functionality&Message=Cannot determine Flight for Passenger
Reservations")
End If
End Sub