Hi there,
I'm facing this problem with my Telerik RadGrid control for Asp.Net Ajax (2007.3.1425.20). it keeps giving the "Object reference not set to an instance of an object" error each time I try to export RadGrid data to excel.
The RadGrid contains a template item that is populated using the code below along with the line where the above mentioned error take a place:
below code is where i rebind the data grid and execute the ExportToExcel function, when I do that the previous mentioned error happens, If I remove the ItemDataBound event it works fine
Would really appreciate if any body can help me with this issue
Thanks in advance :-)
I'm facing this problem with my Telerik RadGrid control for Asp.Net Ajax (2007.3.1425.20). it keeps giving the "Object reference not set to an instance of an object" error each time I try to export RadGrid data to excel.
The RadGrid contains a template item that is populated using the code below along with the line where the above mentioned error take a place:
| Protected Sub myRadGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles myRadGrid.ItemDataBound |
| If e.Item.ItemType = GridItemType.Item Or e.Item.ItemType = GridItemType.AlternatingItem Then |
| Dim xLabel As New Label |
| xLabel = CType(e.Item.FindControl("employedLabel"), Label) |
| If xLabel.Text = "False" Then ' here where the error happens |
| xLabel.Text = "No" |
| Else |
| xLabel.Text = "Yes" |
| End If |
| End If |
| End Sub |
below code is where i rebind the data grid and execute the ExportToExcel function, when I do that the previous mentioned error happens, If I remove the ItemDataBound event it works fine
| Protected Sub generateReportButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles generateReportButton.Click |
| Dim SelectStr As String = "select....." |
| 'Custome code to manipulate SQL queries |
| Me.mySqlDataSource.SelectCommand = SelectStr |
| Me.myRadGrid.Rebind() |
| myRadGrid.ExportSettings.OpenInNewWindow = True |
| Me.myRadGrid.MasterTableView.ExportToExcel() |
| End Sub |
Would really appreciate if any body can help me with this issue
Thanks in advance :-)