Hi Liste -
ich habe mir ein Datagrid gebastelt, mit folgender doItemCreated Funktion:
Sub doItemCreated(sender As Object,e As DataGridItemEventArgs)
if (e.Item.ItemType = ListItemType.Item OR e.Item.ItemType =
ListItemType.AlternatingItem _
OR e.Item.ItemType = ListItemType.EditItem) Then
Dim button As WebControl =
CType(e.Item.Cells(2).Controls(0),WebControl)
button.Attributes.Add("onclick", "javascript:return confirm
('M�chten Sie dieses Backup reinladen?');")
Dim button2 As WebControl =
CType(e.Item.Cells(3).Controls(0),WebControl)
button2.Attributes.Add("onclick", "javascript:return confirm
('Eintrag unwiderruflich l�schen?');")
Dim rec As DataRowView
rec = e.Item.DataItem
'Make sure that you have the data.
If Not IsDBNull(rec) Then
If rec("bezeichnung").ToString().Trim() = "Default" Then
button2.Visible = false
End If
End If
End If
End Sub
Bei ersten Aufruf funzt das auch super, die Eintr�ge werden angezeigt.
Sobald ich aber auf einen Button - entweder Edit oder Delete - eines
Datensatzen dr�cke, bekomme ich nach dem Postback die Fehlermeldung:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
Gastro.Backup.doItemCreated(Object sender, DataGridItemEventArgs e) +300
System.Web.UI.WebControls.DataGrid.OnItemCreated(DataGridItemEventArgs e)
+110
System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32
dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem,
DataGridColumn[] columns, TableRowCollection rows, PagedDataSource
pagedDataSource) +111
System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean
useDataSource) +1407
System.Web.UI.WebControls.BaseDataList.CreateChildControls() +60
System.Web.UI.Control.EnsureChildControls() +100
System.Web.UI.WebControls.BaseDataList.get_Controls() +12
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +292
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +414
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +414
System.Web.UI.Page.LoadPageViewState() +306
System.Web.UI.Page.ProcessRequestMain() +423
Irgendwie bin ich ziemlich planlos, woran das liegen k�nnte ...
Hilfe!
gruss-
tom
_______________________________________________
Asp.net Mailingliste, Postings senden an:
[email protected]
An-/Abmeldung und Suchfunktion unter:
http://www.glengamoi.com/mailman/listinfo/asp.net