一些整理

1.HttpContext对象:
  eg:return (String)HttpContext.GetGlobalResourceObject("ErrorMessage", MessageID);
2.PopUp
  eg:<head runat="server">
     <base target="_self">
     <title>Add Supplementary Collaborator</title>
     </head>
3.//分割txtUserName为两个字符串
   eg:  string strUserName = txtUserName.Text.ToString();
        string[] strArray = System.Text.RegularExpressions.Regex.Split(strUserName, @"[   ]+");
4.UpdatePanel对象
  eg:
 <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
       <asp:Panel ID="plResult" runat="server" Visible="true" Width="100%">
    <asp:GridView ID="gvResult" runat="server" AutoGenerateColumns="False" SkinID="Orange" Width="100%">
     </asp:GridView>
   </asp:Panel>
                </ContentTemplate>
             <Triggers>
  <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
      </Triggers>
        </asp:UpdatePanel>
5.SAVE参考
   http://www.cnblogs.com/qingyun/archive/2006/11/30/577319.aspx

6.格式化字符串,databind
   eg:<%# DataBinder.Eval(Container,"DataItem.ST_MOD_DATE",@"{0:MM\/dd\/yyyy}")%>'
7.在ASP.NET 2.0中操作数据:在DetailsView控件中使用TemplateField
  自定义字段的信息http://reeezak.cnblogs.com/archive/2006/07/06/444700.html

8.验证输入仅是只有数字和字母.
  eg:System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^[a-zA-z0-9]+$");
           
  ///下面的方法还没测试过
  private void Valiate(string str)  

     {            char[] arrChar = str.ToCharArray(0, str.Trim().Length);    

       foreach(char char1 in arrChar)       

    {             

  if(!char.IsLetterOrDigit(char1))          

     {            

       MessageBox.Show("含有除数字和字母外的其他符号!");    

               break;             

  }         

  }     

  }

//////////////
9.html页面参数的读取
  eg:1).URL参数的传值 NavigateUrl= '<%# DataBinder.Eval(Container,"DataItem.CaCallNo","Default.aspx?CallNO={0}")%>'
     2).数据绑定,获取相应的字符 '<%# GetDateTimeToNull((string) DataBinder.Eval(Container,"DataItem.CaDateTo",@"{0:dd\/MM\/yyyy}"))%>'
     3).confirm读取值:OnClientClick='<%#"return confirm(\"Deleting the call entry (Call No.:" + DataBinder.Eval(Container,"DataItem.CaCallNo")+ ") Are you sure?\");"%>' />
    
10.GridView中RowDataBound RowCommand事件相关
  eg:1).在RowDataBound中((ImageButton)e.Row.FindControl("ibDelete")).CommandArgument = e.Row.RowIndex.ToString();那么可在RowCommand中用GridViewCommandEventArgs
    
11.常用正则表达式
   eg:http://hi.baidu.com/boyliupan/blog/item/998d693b1d19caec15cecbad.html
12.

posted on 2008-08-25 13:17  leenshan  阅读(64)  评论(0编辑  收藏  举报