CopyCode The Code is as follows: pageddatasource objpage = new pageddatasource ();
Dataview DV = bllbook. getlistbystate ("", true );// Set the data sourceObjpage. datasource = DV;
// Allow PagingObjpage. allowpaging = true;
// Set the
Converts a string to an integer.
ASP:
CINT () -- note that only the range of short integer values can be converted must be between-32768 and 32767, and clng () is applied to long integers ()
If the input is not a pure numeric string or a null
CopyCode The Code is as follows:
Copy codeThe Code is as follows: Width = "pixel PX" Height = "150px" onkeydown = "countnum ();"Onmousemove = "countnum ();" onmouseout = "countnum ();" onkeyup = "countnum ();"> (The word has been entered)
Error:
When the data on the current page is deleted from any page on the first page, the total number of pages with the new condition is smaller than the page number obtained in the previous query, an error similar to "index 20 is not a negative
After learning about the custom controls, I developed my own paging controls by referring to aspnetpager. Compared with aspnetpager, it has many functions, but I personally feel that it has too many code.
Interface:
Usage:
Page registration
Common replacement Functions
Copy codeThe Code is as follows: public function HighLight (S, F)
Dim tL, tM, tR, k
TL = ""
TM = ""
TR = S
K = instr (1, tR, F, 1)
Do while k> 0
TL = tL & left (tR, k-1)
TM = mid (tR, k, len (F ))
TL = tL & ""
Due to the end of the project, I have been busy optimizing some methods and made some suggestions for you.
When there are many controls in the page, it is too troublesome to clear their values one by one. So I wrote this method to customize the
Add the following two attributes to the Button or other controls.
1. UseSubmitBehavior = "false" uses the server-side commit mechanism to execute the OnClick event.
2. After the OnClientClick client clicks the button, set the control to
All arrays start from 0. Javascript is arrayname [I], while vbscript is arrayname (I)
The javascript string starts from 0, for example, taking the first character, stringname. charAt (0 ).
Var s = "abcd ";
S. indexOf ("B") returns 1
The string
Define a simple array
There are two ways to define and initialize arrays in asp. Let's take a look at each example:
Method 1:
MyArray = Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep ", "Oct", "Nov", "Dec ")
The array size is
Today, UpdatePanel is used in. NET, and the input box in it uses the calendar selector of jQuery:
Copy codeThe Code is as follows:
After running:However, after running the task, click "query" and partial page refresh. I found that the calendar
Copy codeThe Code is as follows: // calculate the number of days
Protected int getDays (DateTime date1, DateTime date2)
{
Int days = 0;If (date1.Year = date2.Year){If (date1.Month {Days = (date2.Day-date1.Day) + (date2.Month-date1.Month) * 30;}If
[Authorize]Public ActionResult Index ()
Marking method. The marked ACTION can be accessed only by authenticated users;
Use
[Authorize (Users = "username")]
Can realize that the marked ACTION can be accessed only by a specific user. The above two
HttpContext. Current. Request. Url. ToString () is not reliable.
If the current URL isHttp: // localhost/search. aspx? User = http://csharp.xdowns.com & tag = % BC % CA % F5
Obtained Through HttpContext. Current. Request. Url. ToString () is
Http: //
The file upload control is: FileUpload.
Asp. Net has a limit on the size of the uploaded files. By default, users can only upload 4 MB files, which may cause inconvenience to users. Therefore, if you want to upload a 40 MB file. Only configuration
Copy codeThe Code is as follows:
In the above Code, document. getElementById ("time"). innerHTML = tm; "time" is the label id, so that the online time can be displayed!
CInt is rounded to get the even number closest to it. That is to say, when the decimal part is XXXX, it gets the even number closest to X.5XX.
For example, Cint (0.5) = 0; Cint (1.5) = 2; Cint (2.5) = 2; Cint (3.5) = 4
Int Is the integer function,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.