Asp.net小技术总结2

1.Arraylist中每项是数组的操作方法
public  ArrayList ImgList
        
{
            
get
            
{
                ArrayList arrImgList 
= new ArrayList();
                
for(int i = 0; i<lb_ImageList.Items.Count; i++)
                
{
                    
string [] strImgItem = new string[2];
                
                    ListItem LI 
= this.lb_ImageList.Items[i];
                    strImgItem[
0=LI.Text;
                    strImgItem[
1]=LI.Value;
                    
                    arrImgList.Add(strImgItem);
                }

                
return arrImgList;
            }

            
set
            
{
                lb_ImageList.Items.Clear();

                ArrayList arrImgList 
= (ArrayList)value;
                
for(int i = 0;i<arrImgList.Count;i++)
                
{                    
                    
string strFileName = ((string[])arrImgList[i]).GetValue(0).ToString();
                    
string strAttchmentID = ((string[])arrImgList[i]).GetValue(1).ToString();
                    
                    ListItem LI 
= new ListItem(strFileName,strAttchmentID);
                    
                    lb_ImageList.Items.Add(LI);
                }

            }

        }

2.清除页面级缓存
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);

你可能感兴趣的:(asp.net)