c# - how to modify data in a DetailsView Databound event -
I am using a description view with a sqldatasource in aspx page; I do some pre and post processing on some fields I'm trying to - basically to change an html list from a new line to a different list and restore it to the html to store it in the database.
Processing of itemUpdating is quite easy but the pre-processing in DatBond is messy ...
Protected Zero Details View1_DataBound (Object Sender, EventArgs e) {if (DetailsView1.Rows .Count & gt; 2) {String s = ((DataRowView DetailsView1.DataItem) .row.ItemArray [2] .ToString (); Text Box Box 1 = (Text Box) Details View 1 Fund Control ("Textbox 1"); If (box 1! = Null) {box1.Text = preprocessor (s); }}}
its weakness
string s = ((DataRowView DetailsView1.DataItem) .row.ItemArray [2] .ToString ();
It bothers me, I'm sure I'm missing something (more than one thing)!
I think I was hoping to update some more things ...
e New Value ["Threline"] = Postprocess (E. NewValues ["Threline"]. Toasting ()); Switch to
. P>
Set ObjectDataSource.TypeName
data access object Type.FullName
.
set ObjectDataSource.DataObjectTypeName
to DTO < Code> Type.FullName .
Set ObjectDataSource.SelectMethod
for Data Access Object Method, which meets a IQueryable & lt; MyDto & gt;
Set DetailsView1.DataSourceID
to ObjectDataSource.ID
.
set DetailsView1.ItemType
DTO Type.FullName
.
Do anything else (Item == blank) return; Var box 1 = (text box) Description view 1. FontControl ("Textbox 1 "); if (box 1 == empty) return; Box1.Text = Preprocess (item property name);
Comments
Post a Comment