Aspx小记

关闭按钮

 protected void Close_Click(object sender, EventArgs e)
    {
        //Page.RegisterStartupScript("close ", " <script> window.opener=null;window.top.close() </script> ");
        ClientScript.RegisterStartupScript(Page.GetType(), "close", " <script> window.opener=null;window.top.close() </script> ");
    }

  

在后台里看到这样的一段代码

 Guid PK_Complaint = new Guid(dr["PK_Complaint"].ToString());//开始的时候不明白为什么还要加个new,可能是从string类型转成Guid的标准格式吧。

 主要是看这个out

 static void Main(string[] args)
      {
         decimal res=1;
         string str="0.1";//string str="asn";(这个是false,因为asn转不成decimal的类型
         bool convertible= decimal.TryParse(str,out res);//把str的类型,转换成res的类型
         Console.WriteLine(convertible);
         Console.ReadKey();
      }

  

string[] IMEI_SN = info.Split(new char[] { ' ', ' ' }, StringSplitOptions.RemoveEmptyEntries);//算是以数组中的东西分割开来

string test = "程$晓$";

  使用:string[] temp = test.Split(new string[] { "$" }, StringSplitOptions.RemoveEmptyEntries);
  输出结果:数组长度为2 temp[0]="程" temp[1]="晓";
 

  使用:string[] temp = test.Split(new string[] { "$" }, StringSplitOptions.None);或string[] temp = test.Split('$');


  输出结果:数组长度为3 temp[0]="程" temp[1]="晓" temp[2]="";
  

在前台有个RadioButtonlist的按钮,在加载 的时候,从后台添加数据

 string[] ary = System.Configuration.ConfigurationManager.AppSettings["xxx"].Split(',');
   foreach (string i in ary)
      {
        RadioButtonList1.Items.Add(new ListItem(i));//这里的ListItem,因为Items是ListItemCollection
      } 

在后台获取list选择的那个值:RadioButtonList1.SelectedValue.ToString() == ""
原文地址:https://www.cnblogs.com/ZkbFighting/p/9453135.html