This is weird, at least to me. I have code that populates 2 dropdownlist in a gridview. DropStart And DropEnd I want to add time values depending on a few things here's the routine I cal.
now this code is called, and runs fine, it goes in the for loop and I see if I trace it that combostart and comboend both have 96 Items in them as expected. hence it did find the controls in the gridview. but when I exit this sub and continue the code by just running the code in the asp.net page the two corresponding dropdown control don't get the values that did get added in the code behind.Code:Public Sub GenerateTime(RowIndex As Integer) Dim ComboStart As New DropDownList Dim ComboEnd As New DropDownList Dim ItemList As ListItem Dim TimeInterval As Integer Dim IntervalleCalcul As Integer Dim NombreIntervalles As Integer Dim HeureCalcule As String Dim Laps As Integer ComboStart = GridDetails.Rows(RowIndex).FindControl("DropStartTime") ComboEnd = GridDetails.Rows(RowIndex).FindControl("DropEndTime") If Not (IsNothing(ComboStart) Or IsNothing(ComboEnd)) Then ComboStart.Items.Clear() ComboEnd.Items.Clear() ' -------------------------------------------- ' DETERMINATION DES PARAMETRES D'INTERVALLES ' -------------------------------------------- Select Case TimeInterval Case 5 IntervalleCalcul = 12 Laps = 5 Case 10 IntervalleCalcul = 6 Laps = 10 Case 15 IntervalleCalcul = 4 Laps = 15 Case 30 IntervalleCalcul = 2 Laps = 30 Case 60 IntervalleCalcul = 1 Laps = 60 Case Else IntervalleCalcul = 4 Laps = 15 End Select NombreIntervalles = 24 * IntervalleCalcul HeureCalcule = "00:00" ItemList = New ListItem ItemList.Text = HeureCalcule ItemList.Value = HeureCalcule ComboStart.Items.Add(ItemList) ComboEnd.Items.Add(ItemList) For Compteur = 1 To NombreIntervalles - 1 HeureCalcule = CalculerTemps(HeureCalcule, Laps) ItemList = New ListItem ItemList.Text = HeureCalcule ItemList.Value = HeureCalcule ComboStart.Items.Add(ItemList) ComboEnd.Items.Add(ItemList) Next Compteur ComboStart.DataBind() ComboEnd.DataBind() End If End Sub
In the RowEditing is when I call this routine.
I'm a little more than perplexed by this. lolCode:Private Sub GridDetails_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridDetails.RowEditing GridDetails.EditIndex = e.NewEditIndex GridDetails.DataBind() GenerateTime(GridDetails.EditIndex) End Sub




Reply With Quote
