1. Use of the FormView Control
The data sources of these three controls are operated using the object data source. You must first understand the usage of the ObjectDataSource control.
ObjectDataSource
ObjectDataSource is used to use a class as the data source. The TypeName attribute is the full name of the data source class, including DeleteMethod, InsertMethod, SelectMethod, UpdateMethod, and other attributes, the method names for deleting, inserting, querying, and updating data in the class. These methods may have parameters whose values are set by eparameters, UpdataParameters, InsertParameters, and other nested nodes.
It is too difficult to manually write the ObjectDataSource by using a visual interface. Drag and Drop ObjectDataSource to the interface, and select "configure data source" on the Smart ID in the upper right corner to complete the configuration. The data source class generally has a dataset. You can create a new dataset and drag the table to generate DataTable and Adapter. After the data source is generated, you can see the Adapter class in the "configure data source" section of ObjectDataSource, select a class, select [next], and select the corresponding methods for obtaining, deleting, updating, and inserting data.
BulletedList is used to display data. Render it in a browser as <ul> <li> </ul>
Manually bound: BulletedList2.DataSource = new string [] {"I select", "I like", "My Choose", "My Love! "};
BulletedList2.DataBind (); // manually bind data.
If you need to add an initial value to the control that has already set the data source, you need to set the attribute: AppendDataBoundItems = "True", which means to fill the data in the form of an additional, instead of flushing the original data.
FormView is used to edit, view, add, edit, and view a single piece of data. Three templates are added.
You can use a program to switch the display mode of FormView: Edit, Insert, or read-only.
Objectperformance1.selectparameters. Clear ();
Objectperformance1.selectparameters. Add ("Id", TypeCode. Int64, id); // The program dynamically adds parameters for the data source.
Objectperformance1.select (); // triggers the select method of the data source.
FormView1.ChangeMode (FormViewMode. ReadOnly); // you can change the FormView mode.
You can also obtain parameters automatically in the ObjectDataSource data source control. Set the parameter source of the data source to QueryString. Or other sources. Controls dynamically obtain data.
In response to the ItemCreated event of FormView, use FormView. currentMode determines the current rendered template. Because FormView can only render one template at the same time, e. item, e. itemType. then use FormView. findControl.
Protected void formviewincluitemcreated (object sender, EventArgs e)
{
If (FormView1.CurrentMode = FormViewMode. Insert)
{// Directly use FormView1.FindControl () to find the control. Bytes
TextBox tbTime = (TextBox) FormView1.FindControl ("CreateTimeTextBox ");
TbTime. Text = DateTime. Now. tow.datestring ();
}
}
CKEditor Integration
CKEditor, formerly known as FckEditor, is a famous HTML editor that can edit HTML content online.
Configuration Reference document: Decompress (adapters, images/lang?plugins=skins=themes=ckeditor.js=config.js#contents.css) in ckeditor to the js directory, reference ckeditor. js on the post page, and set multi-line text boxes
Class = "ckeditor", the code can still access the editor content through the Text attribute of the TextBox Control.
When submitting a page, asp.net regards the html content in the text editor as attack content. Therefore, set ValidateRequest = "false" in the page tag of aspx to disable attack detection. For vs2010, xxs detection must be disabled in the configuration file.