c# - TargetInvocationException: Exception has been thrown by the target of an invocation. on Data Bind -
I'm trying to force a Gridwwv data source to ride editing program, but it throws an exception:
targeting charge: exception has been thrown by the target of an orientation.) Databesing methods such as Eval (), XPath (), and use the bind () reference to only one database control Can be done in
lblackout = EXMailbox.GetBlackouts (); BlackoutGridView.DataSource = lblackout; Protected void BlackoutGridView_RowEditing (object sender, GridViewEditEventArgs e) {BlackoutGridView.EditIndex = e.NewEditIndex; BlackoutGridView.DataSource = lblackout; // Exceptions thrown here: BlackoutGridView.DataBind (); } & Lt; asp: GridView ID = "Blackautgreed" Rnat = "server" Otojnent columns = "false" Onro Delting = "Blackautgreed_wara deletion" Onroveting = "Blackautgreed_aroaditing" Orokankelidet = "Blackautgreed_wu_arokenling edit" & gt; & Lt; Columns & gt; & Lt; ASP: BoundfieldDefined = "BlackoutID" header text + "blackout ID" & gt; & Lt; / ASP: BoundField & gt; & Lt; Asp: TemplateField Header Text = "Region" & gt; & Lt; EditItemTemplate & gt; & Lt; ASP: Dropdown list id = "dropdown list 11" runat = "server" text = '& lt;% # bind ("area")%> DataSourceID = "lblackout" DataTextfield = "Region" DataVillefield = "Region" & gt; & Lt; / Asp: dropdownlists & gt; & Lt; asp: ObjectDataSource ID = "lblackout" runat = "server" SelectMethod = "GetDataItem" Prkarnam = "exchange. MailboxMove.WebUI.BlackoutScreen" & gt; & Lt; / Asp: ObjectDataSource & gt; & Lt; / EditItemTemplate & gt; & Lt; ItemTemplate & gt; & Lt; Asp: Label ID = "Label1" runat = "server" text = '& lt;% # bind ("area")% & gt; & Gt; & Lt; / Asp: Label & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; ASP: Boundfield headerText = "server" datfield = "server" & gt; & Lt; / ASP: BoundField & gt; & Lt; Asp: boundfield header text = "date-field" datafield = "startdate" dataformat string = "{0: D}" & gt; & Lt; / ASP: BoundField & gt; & Lt; ASP: Boundfield headtext = "to date" datafield = "enddatetime" dataform string = "{0: D}" & gt; & Lt; / ASP: BoundField & gt; & Lt; ASP: Boundfield HeaderText = "Data from Time" DataField = "StartDate" Dataformat String = "{0: T}" & gt; & Lt; / ASP: BoundField & gt; & Lt; ASP: Boundfield header text = "time" datafilled = "enddate" dataformat string = "{0: T}" & gt; & Lt; / ASP: BoundField & gt; & Lt; Asp: checkbox field header text = "really" datafield = "really" & gt; & Lt; / ASP: CheckBoxField & gt; & Lt; Asp: CommandFile DeleteText = "Cancel" headerText = "Action" ShowDeleteButton = "True" ShowEditButton = "True" ShowHeader = "True" & gt; & Lt; / ASP: CommandField & gt; According to your code, I think you lost the DataValue field for Gridview. Are there. This is a sample of MSDN, how to share the dropdown list
& amp; ATP: Insert dropdown list id = "Krendaundaundaunlaist" Datasorsaidi = "Sreniyadetasors" Detatakstfild = "Sreninam" Datavillefild = "Sreniaidi" Rnatt = "server" / & gt;
Without the DataVille field, the line editing and other event logic will not do. I hope I have helped you. You can also check in
Comments
Post a Comment