Work Summary (1)-Tips

Source: Internet
Author: User

I have been working for guangzhuo for a month. During this month, I learned a lot of things. Maybe for others, those things are the simplest, but I didn't know it before. Think of yourself as a fool to learn more. No matter how hard the road will be in the future, I will go on with a smile. During this period, not only did my colleagues help me, but he also silently supported me. Besides taking care of my diet, he was still working to help me. This week, I am really tired and have a hard time working. I have caught a cold, but I am still strong enough to face it.

1. When the gridview inputs an English character or number, it will not wrap itself, and it will be handwritten in page_loadCodeConvert it into rows.

This. fslgridview1.attributes. Add ("style", "word-break: Break-all; Word-wrap: Break-word ");

2. In SQL, for a datetime field, you only need to obtain its date and do not need the following time (hours, minutes, And seconds ).

Three formats:

select convert (char (10), getdate (), 120) -- yyyy-mm-DD 15:10:02
select convert (char (10), getdate (), 112) -- yyyymmdd 20090315
select convert (char (10), getdate (), 111) -- yyyy/mm/DD 2009/03/15
select convert (char (10), getdate (), 105) -- DD-mm-yyyy 15-03-2009

Select Convert(Varchar(12),Getdate(),102)--2009.03.15


 

3. IP address verification:

Protected void customvalidator1_servervalidate (Object source, servervalidateeventargs ARGs)
{// Verify that the Entered IP address is correct
String Pattern = @ "^ (0 | [1-9] [0-9]? | 1 [0-9] {2} | 2 [0-4] [0-9] | 25 [0-5]) \. (0 | [1-9] [0-9]? | 1 [0-9] {2} | 2 [0-4] [0-9] | 25 [0-5]) \. (0 | [1-9] [0-9]? | 1 [0-9] {2} | 2 [0-4] [0-9] | 25 [0-5]) \. (0 | [1-9] [0-9]? | 1 [0-9] {2} | 2 [0-4] [0-9] | 25 [0-5]) $ ";

String strip = this.txt servermgip. Text. Trim ();

If (strip! = NULL & Strip! = "")
{
If (! System. Text. regularexpressions. RegEx. ismatch (strip, pattern ))
Args. isvalid = false;
}
}

Note: When using some verification controls, you do not need to set controltovalidate on the foreground, but you only need to set errormessage. For example:

<Asp: customvalidator id = "customvalidator1" runat = "server" errormessage = "Check IP Address"
Onservervalidate = "customvalidator1_servervalidate">! </ASP: customvalidator>

4. Question about JavaScript ID card and military ID regular expression?

Today, I did form verification and met the ID card and military ID verification. I thought it was very simple. I wrote the following regular expression:
VaR identitycard =/\ D {15} | \ D {18 }/;
VaR armycard =/\ D {7 }/;
Unfortunately, it is incorrect. The correct one is as follows:
VaR identitycard =/^ (\ D {15} | \ D {18}) $ /;
VaR armycard =/^ \ D {7} $ /;
Only when "^" and "$" are added can we ensure that there are only a fixed number of N bits, and one or more bits will not work. You can try it !!!

5. Separator string: String [] serverswname = this.txt serverswname. Text. Trim (). Split ("\ r \ n". tochararray ());
6. Practical HTML jump


class =" dropdownlist "style =" height: 20px; width: 137px "> O & M center /portal homepage Development Center demand center Test Center

7. execution sequence of girdview events:
fslgridview1_databinding
fslgridview1_rowcreated
bind the foreground page
Accept
fslgridview1_rowdatabound

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.