Hi:
I have a strange problem that I could solve and it's driving me nuts!
I have dynamically added a Lookup column to my grid during form load:
c = New GridViewLookUpColumn("ColFinalGrade_Manual", "FinalGrade_Manual")
c.ValueMember = "GdRule_GradeCode"
c.DisplayMember = "GdRule_GradeCode"
c.DataSource = ds_Gd.Tables(0)
RGV_StdEnrl.MasterGridViewTemplate.Columns.Insert(RGV_StdEnrl.Columns.Count - 1, c)
Then during CellBeginEdit of the grid, I have the following codes (except from longer codes)
If RGV_StdEnrl.Columns(e.ColumnIndex).UniqueName = "ColFinalGrade_Manual" Then
Dim editor As IInputEditor = Me.RGV_StdEnrl.ActiveEditor
If Not editor Is Nothing AndAlso TypeOf (editor) Is RadComboBoxEditor Then
Dim comboElement As RadComboBoxElement = CType(CType(editor, RadComboBoxEditor).EditorElement, RadComboBoxElement)
For I As Integer = 0 To comboElement.Items.Count - 1 (!!!!!PROBLEM IS HERE!!!!)
If comboElement.Items(I).Text = "" & RGV_StdEnrl.MasterGridViewTemplate.Rows(e.RowIndex).Cells("ColFinalGrade_Manual").Value Then
comboElement.SelectedIndex = I
Exit For
End If
Next
. . .
The problem is: The item count for comboElement is ALWAYS 0 when I click on that particular cell FOR THE FIRST TIME after the form is loaded. So, the correct value never gets selected. In fact, during the FIRST run of CellBeginEdit, the DataSource for the comboElement is ALWAYS Nothing. There is nothing I could do to change that. EVEN IF I first test for it begin nothing and then try to assign it a datasource at that time (If comboElement.DataSource Is Nothing Then comboElement.DataSource = theTable), the item count for the comboElement remains 0. It almost as if it doesn't want to take anything. No error is generated either.
The strangest part is: This problem only happens ONCE every form load (the very first time that cell is click). After that, the above code works exact as it should.
I'm just stumped, and would appreciate some help on this.
Thanks!
Justin
I have a strange problem that I could solve and it's driving me nuts!
I have dynamically added a Lookup column to my grid during form load:
c = New GridViewLookUpColumn("ColFinalGrade_Manual", "FinalGrade_Manual")
c.ValueMember = "GdRule_GradeCode"
c.DisplayMember = "GdRule_GradeCode"
c.DataSource = ds_Gd.Tables(0)
RGV_StdEnrl.MasterGridViewTemplate.Columns.Insert(RGV_StdEnrl.Columns.Count - 1, c)
Then during CellBeginEdit of the grid, I have the following codes (except from longer codes)
If RGV_StdEnrl.Columns(e.ColumnIndex).UniqueName = "ColFinalGrade_Manual" Then
Dim editor As IInputEditor = Me.RGV_StdEnrl.ActiveEditor
If Not editor Is Nothing AndAlso TypeOf (editor) Is RadComboBoxEditor Then
Dim comboElement As RadComboBoxElement = CType(CType(editor, RadComboBoxEditor).EditorElement, RadComboBoxElement)
For I As Integer = 0 To comboElement.Items.Count - 1 (!!!!!PROBLEM IS HERE!!!!)
If comboElement.Items(I).Text = "" & RGV_StdEnrl.MasterGridViewTemplate.Rows(e.RowIndex).Cells("ColFinalGrade_Manual").Value Then
comboElement.SelectedIndex = I
Exit For
End If
Next
. . .
The problem is: The item count for comboElement is ALWAYS 0 when I click on that particular cell FOR THE FIRST TIME after the form is loaded. So, the correct value never gets selected. In fact, during the FIRST run of CellBeginEdit, the DataSource for the comboElement is ALWAYS Nothing. There is nothing I could do to change that. EVEN IF I first test for it begin nothing and then try to assign it a datasource at that time (If comboElement.DataSource Is Nothing Then comboElement.DataSource = theTable), the item count for the comboElement remains 0. It almost as if it doesn't want to take anything. No error is generated either.
The strangest part is: This problem only happens ONCE every form load (the very first time that cell is click). After that, the above code works exact as it should.
I'm just stumped, and would appreciate some help on this.
Thanks!
Justin