Home > Article > Backend Development > ASP.NET basic knowledge (2)
The RadioButton control will be rendered as on the client side. Like the server-side control, it can also be grouped through the GroupName attribute.
Button control will be rendered on the client side as
LinkButton control will be rendered on the client side as
ImageButton control is a You can set the ImageUrl Button, which will be rendered on the client as
The same point: you can set the OnClientClick property to "return confirm('Are you sure you want to delete?')";
You can set the attributes NavigateUrl="" and Target="". If you set the ImageUrl attribute, it will be rendered into
Generally, the code for uploading files is written like this
if(FileUpload1.hasFile())
{
string uploadPath = Server.MapPath("~/upload/");
FileUpload1.SaveAs(uploadPath + FileUpload1.FileName);
}
1) HTML control
2) ASP.NET server control
3) with runat="server "HTML control
1) RequireFieldValidator: a required field, which can be used for non-empty verification on the server side. Commonly used properties are: ErrorMessage, ControlToValidate, InitialValue. When verifying on the server side, you can write if(this.IsValide) like this {…}
2) RangeValidator: Determine whether the value is between the given maximum value (MaximumValue) and minimum value (MinimumValue). Comparable data types include string, int, currency.
3) CompareValidator: Used to compare two Whether the relationship between the values meets the requirements or the specified type of data. Comparison operators include: <,>,=,!=. Common properties: ValueToCompare: which value to compare with, ControlToCompare: which control to compare with.
4) RegularExpressionValidator: Regular expression used to verify that data satisfies. Common properties: ValidationExpression: Define regular expressions.
5) CustomValidator: Custom validation for special situations.
6) Note: (1) Almost all validation controls must be verified on the client and server.
(2) Group the validation controls: ValidationGroup
(3) Whether to trigger the verification event: CauseValidation: false, which means the verification event is not triggered
(4) Modify whether the verification control takes place: Display is set to Dynamic or Static.
1) For example:
2) Repeater data control is used to bind the traversal display of data. Of course, we also It can be written by hand using foreach statement.
3) Other templates of the Repeater control
(1)
(2) or
wait.
(3)
(1) The automatically generated style should be extracted into the css style and not made inline;
(2) It is generally not necessary to use
(3) There must be a server-side control with the ID itemPlaceHolder in
(1) Determine the type of data row e.Item.ItemType == ListViewItemType.DataRow
(2) Get the corresponding RowView ListViewDataItem lvDataItem = (ListViewDataItem)e.Item; DataRowView rowView = ( DataRowView)lvDataItem.DataItem;
(3) When using FindControl, you should pay attention to the AlternatingItemTemplate issue.
The difference between ListView and GridView
(1) GridView can only be rendered into Table
(2) ListView can be rendered into both Table and
DropDownList control binds the SelectedValue property, such as: SelectedValue="<%#Eval('txtName')%>"
If there is a pure display page that does not involve interactive information such as adding, deleting, modifying, etc. on the front end of the page, you can disable ViewState. There are two methods:
(1) Page Disable ViewState as a whole: Add EnabelViewState="false" in the top
(2) Disable ViewState for the specified control: Add EnabelViewState="false" on the properties of the control
Website performance tuning
(1) Cache is the first means of website performance tuning;
(2) Index is the first means of database performance tuning;
How to set page cache: Set< in the page header area
Data cache setting method, set properties for ObjectDataSource,
(1) EnableCaching="True"
(2) CacheDuration="20"
Written at the back: Mr. Lu Xun has a saying, "Where is the genius? I spend all the time other people drink coffee on working and studying. ! "I strongly agree, it is a good lesson to be diligent in making up for your shortcomings. Well, that’s it for today!