DOTNET technology (1)

Source: Internet
Author: User
About dynamic use Web User control problems:
Existing control Webusercontrol1 , A page Webform1.aspx , There is Table1 Of Table Control, now you want Table Add several dynamic Webusercontrol1 . I do this:
For (INT I = 0; I <10; I ++ ){

Webusercontrol1 WUC = new webusercontrol1 ();

Tablecell Tc = new tablecell ();

TC. Controls. Add (WUC );

Tablerow TR = new tablerow ();

Tr. cells. Add (TC );

Table1.rows. Add (TR );

}
Solved! Not usedNewMethod, but useLoadcontrolMethod! Haha.

 

C # How to obtain the first day of this month?
New datetime (datetime. Now. Year, datetime. Now. month, 1)
Excuse me C # Is it equivalent STL In Set And Map Container
Sortedlist It can be considered Map, Set What about it? Other feelings Collection In Arraylist It can contain any Type object. It is not good if you do not set the type limit.
Hashtable Yes <Key, value> With Set It should be different.

Use Databind After that, you can easily display database records, <% # Databinder. eval (...) %> Only strings can be displayed. Eval The calculated data shows different content, for example, the value may have 1 , 2 , 3 , 4 , 5 Are displayed according to the value size. 1 , 2 , 3 , 4 , 5 What should a star do? ?
Eval Only convert the data type. In fact, if you are sure that your data source type is correct, you can get more Good performance. The data source is an implementation Ienumerable Interface Class. For example, if your data source is Int [] , Then you can display the statement <% (INT) container. dataitem). tostring () %> To replace Databinder. So you can use
<% # If (INT) container. dataitem = someint) response. Write ( " The integer is "+ Someint. tostring ()) %>
To achieve the effect you want.

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.