Hi
I am dynamically adding HtmlTableCells to my WebUserControl within a RadGrid within a RadAjaxPanel.
However, when I come to access those dynamically added HtmlTableCells by clicking the Update button on my WebUserControl, and using the FindControl method I get a server side error. Null Object.
NB: The rendering code works fine. The object are displayed onthe screen wiithout any problems.
My rendering code is thus ....
For lnCount = 0 To 9
If System.IO.File.Exists(Me.Server.MapPath("../images/stock/" & loStockRow.S_nId.ToString("00000000") & "_" & lnCount.ToString("00") & ".jpg")) Then
Dim loTableCell As New HtmlTableCell
loTableCell.ID = "tdImage" & lnCount.ToString("00")
Dim loCheckBox As New CheckBox
loCheckBox.ID = "bImage" & lnCount.ToString("00")
loCheckBox.Text = "Delete"
Call loTableCell.Controls.Add(loCheckBox)
Call Me.trImages2.Cells.Add(loTableCell)
End If
Next lnCount
And the code I am using to access the object I have added is thus...
For lnCount = 0 To 9
If System.IO.File.Exists(Me.Server.MapPath("../images/stock/" & loStockRow.S_nId.ToString("00000000") & "_" & lnCount.ToString("00") & ".jpg")) Then
If Me.trImages2.FindControl("tdImages" & lnCount.ToString("00")) IsNot Nothing AndAlso Me.trImages2.FindControl("tdImages" & lnCount.ToString("00")).FindControl("bImage" & lnCount.ToString("00")) IsNot Nothing Then
If CType(Me.trImages2.FindControl("tdImages" & lnCount.ToString("00")).FindControl("bImage" & lnCount.ToString("00")), CheckBox).Checked Then
Call System.IO.File.Delete(Me.Server.MapPath("../images/stock/" & loStockRow.S_nId.ToString("00000000") & "_" & lnCount.ToString("00") & ".jpg"))
End If
lnCount2 += 1
End If
End If
Next lnCount
NB: The Count from the trImages object is zero. Unless I access the object immediatelyy after I have added the controls.
Kind Regards
David
I am dynamically adding HtmlTableCells to my WebUserControl within a RadGrid within a RadAjaxPanel.
However, when I come to access those dynamically added HtmlTableCells by clicking the Update button on my WebUserControl, and using the FindControl method I get a server side error. Null Object.
NB: The rendering code works fine. The object are displayed onthe screen wiithout any problems.
My rendering code is thus ....
For lnCount = 0 To 9
If System.IO.File.Exists(Me.Server.MapPath("../images/stock/" & loStockRow.S_nId.ToString("00000000") & "_" & lnCount.ToString("00") & ".jpg")) Then
Dim loTableCell As New HtmlTableCell
loTableCell.ID = "tdImage" & lnCount.ToString("00")
Dim loCheckBox As New CheckBox
loCheckBox.ID = "bImage" & lnCount.ToString("00")
loCheckBox.Text = "Delete"
Call loTableCell.Controls.Add(loCheckBox)
Call Me.trImages2.Cells.Add(loTableCell)
End If
Next lnCount
And the code I am using to access the object I have added is thus...
For lnCount = 0 To 9
If System.IO.File.Exists(Me.Server.MapPath("../images/stock/" & loStockRow.S_nId.ToString("00000000") & "_" & lnCount.ToString("00") & ".jpg")) Then
If Me.trImages2.FindControl("tdImages" & lnCount.ToString("00")) IsNot Nothing AndAlso Me.trImages2.FindControl("tdImages" & lnCount.ToString("00")).FindControl("bImage" & lnCount.ToString("00")) IsNot Nothing Then
If CType(Me.trImages2.FindControl("tdImages" & lnCount.ToString("00")).FindControl("bImage" & lnCount.ToString("00")), CheckBox).Checked Then
Call System.IO.File.Delete(Me.Server.MapPath("../images/stock/" & loStockRow.S_nId.ToString("00000000") & "_" & lnCount.ToString("00") & ".jpg"))
End If
lnCount2 += 1
End If
End If
Next lnCount
NB: The Count from the trImages object is zero. Unless I access the object immediatelyy after I have added the controls.
Kind Regards
David