1.如何把一个javascript 中的数组 从客户端传到服务器端! 2005-09-13
向skytear() 又学一招,嘿嘿.  
<form +str);
   }

  }
2.求正则表达式(汉字,字母,数字 混合验证) 2005-09-13
首位汉字,
2-4位为字母,
第5位汉字,
6-14位为数字,
最后一位为汉字
^[\u4e00-\u9fa5][a-zA-Z]{3}[\u4e00-\u9fa5]\d{9}[\u4e00-\u9fa5]$

3.如何动态在datagrid中加入列标题和列内容? 2005-09-13

使用动态生成DataTable后,把DataTable绑定到DataGrid
<asp:datagrid ></param>
  private void DataBind(string strSql)
  {

   DataTable dt = new DataTable();
   dt.Columns.Add(new DataColumn("字段0标题", typeof(string)));
   dt.Columns.Add(new DataColumn("字段1标题", typeof(string)));
   dt.Columns.Add(new DataColumn("字段2标题", typeof(string))); 
   dt.Columns.Add(new DataColumn("字段3标题", typeof(string)));
   dt.Columns.Add(new DataColumn("字段4标题", typeof(string)));

   SqlCommand cmd2 = new SqlCommand(strSql,db.conn);
   cmd2.Connection.Open();
   SqlDataReader dr1 = cmd2.ExecuteReader();
    
   while(dr1.Read())
   {
    DataRow dd;
    dd = dt.NewRow();
    dd[0] = "<INPUT type=\"checkbox\" name=\"mobilelist\" value="+dr1["txtemmobile"].ToString()+">";
    dd[1] = "<a href=\"employeemodify.aspx?employee_>5.c#中的日期差额:DateDiff在VB中有.

using System.TimeSpan:


DateTime dt = ...
DateTime d2 = ...
TimeSpan ts = dt - dt2;
n = ts.Hours;
6.文件下载
/// <summary>
/// 文件下载
/// </summary>
/// <param name="FullFileName"></param>
private void FileDownload(string FullFileName)
{
FileInfo DownloadFile = new FileInfo(FullFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
Response.ContentType="application/octet-stream";
Response.AppendHeader("Content-Disposition","attachment;filename=" +HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
}
7.固定状态栏,打开的窗口在同一个窗口中
<head>
<base onmouseover="window.status='★-- >>═→ D113音乐网 WWW.D113.COM 祝各位网友〖天天快乐〗!~ ⊙_⌒γ  --★';return true">
<base target="play">
</head>

8http://crtvu.edu.cn/readddsx.html?id=1946 这种readddsx.html?id=1946是怎么做的? 2005-09-17

打开IIS,在你要设置的站点的属性页的虚拟目录标签上,点击“应用程序设置(Application Settings)”下的“配置(Configuration..)”按钮,在打开的“应用程序配置(Application Configuration)”窗口中的“应用程序映射(App Mappings)”标签页中,点击下面的“添加(Add..)”按钮,在弹出的“添加/编辑应用程序后缀映射(Add/Edit Application Extension Mapping)”窗口中,在“可执行程序(Executable)”右边的文本框框中输入 C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll (文件路径会因.net框架版本的不同而不同,为安全起见,你可以在“应用程序映射(App Mappings)”标签页下的映射列表中双击“.aspx”,在弹出的窗口中选中它的“可执行程序(Executable)”文本框中的文本然后复制出来),在“后缀名(Extension)”文本框中输入你要添加的后缀名“.html”,然后点击确定保存所有打开的属性窗口即完成IIS中的设置;
第二步:打开你要配置的站点或虚拟目录的根目录下的web.config文件,在<system.web>配置节下加入如下配置节:
<add verb="*" path="*.html" type="System.Web.UI.PageHandlerFactory"/>
保存web.config文件,然后将所有的aspx文件的后缀改为html,在浏览器中打开看看是不是和aspx文件一样的效果!

http://www.ssite.cn/forums/104/ShowPost.aspx
adandelion
study English http://forums.devshed.com/  adandelion

我有一个datagrid绑定了记录,
在每条记录的右边有一个imagebutton
当用户点击imagebutton时,就执行一个程序。
但此时如果我用F5刷新页面时,为什么又执行了一次imagebutton事件呀


你要设置页面的 smartnavigation=true 才不会让地址栏累计历史纪录

UTF-8转换成中文      2005-09-24
http://xmaspx.com/blogs/hackate/
  private void Button2_Click(object sender, System.EventArgs e)
  {
   string utfinfo = "欢迎使用";
   string gb2312info = string.Empty;

   Encoding utf8 = Encoding.UTF8;
   Encoding gb2312 = Encoding.GetEncoding("gb2312");

   // Convert the string into a byte[].
   byte[] unicodeBytes = utf8.GetBytes(utfinfo);
   // Perform the conversion from one encoding to the other.
   byte[] asciiBytes = Encoding.Convert(utf8, gb2312, unicodeBytes);
           
   // Convert the new byte[] into a char[] and then into a string.
   // This is a slightly different approach to converting to illustrate
   // the use of GetCharCount/GetChars.
   char[] asciiChars = new char[gb2312.GetCharCount(asciiBytes, 0, asciiBytes.Length)];
   gb2312.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0);
   gb2312info = new string(asciiChars);
   Response.Write(gb2312info);//欢迎使用
  }

#########怎样将字符串转换成可以执行的代码???   2005-10-03
http://community.csdn.net/Expert/topic/3985/3985223.xml?temp=.2579767

下面的把字符串中的数字表达式求值:
double a = (double)Eval("1+1*2");
string s = a.ToString();

public static object Eval(string expression)
{
System.Data.DataTable table=new System.Data.DataTable();
System.Data.DataColumn Col=new System.Data.DataColumn("AAA",typeof(string),expression);
table.Columns.Add(Col);

table.Rows.Add(new object[] {""});
return table.Rows[0][0];
}

----------------------

Microsoft.JScript.Vsa.VsaEngine ve=Microsoft.JScript.Vsa.VsaEngine.CreateEngine();
object qswhEval3(string Expression){
 return Microsoft.JScript.Eval.JScriptEvaluate(Expression,ve);
}

只需要添加Microsoft.JScript和Microsoft.Vsa两个引用就OK,超简洁....呵呵,多谢楼上朋友们的帮助.......

按照时间命名
string fileName = System.DateTime.Now.ToString("yyyyMdHms");
DateTime.Now.ToString("yyyyMMddhhmmss") + DateTime.Now.Millisecond.ToString()
+IP地址.

密钥加密

#region 密钥加密
  /// <summary>
  /// 得到加密字符串
  /// </summary>
  /// <param name="strText">要加密字符串</param>
  /// <param name="strEncrKey">密钥</param>
  /// <returns>加密后字符串</returns>
   public string DesEncrypt(string strText, string strEncrKey)//加密函数
   {
    byte[] byKey=null;
    byte[] IV= {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};
    try
    {
     byKey = System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(0,strEncrKey.Length));
     DESCryptoServiceProvider des = new DESCryptoServiceProvider();
     byte[] inputByteArray = Encoding.UTF8.GetBytes(strText);
     MemoryStream ms = new MemoryStream();
     CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write) ;
     cs.Write(inputByteArray, 0, inputByteArray.Length);
     cs.FlushFinalBlock();
     return Convert.ToBase64String(ms.ToArray());


    }
    catch(System.Exception error)
    {
     return "error:" +error.Message+"\r";
    }
   }
  /// <summary>
  /// 得到解密后字符串
  /// </summary>
  /// <param name="strText">解密字符串</param>
  /// <param name="sDecrKey">密钥</param>
  /// <returns>解密后字符串</returns>
   public string DesDecrypt(string strText,string sDecrKey)//解密函数
   {
    byte[] byKey = null;
    byte[] IV= {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};
    byte[] inputByteArray = new Byte[strText.Length];
    try
    {
     byKey = System.Text.Encoding.UTF8.GetBytes(sDecrKey.Substring(0,8));
     DESCryptoServiceProvider des = new DESCryptoServiceProvider();
     inputByteArray = Convert.FromBase64String(strText);   
     MemoryStream ms = new MemoryStream();
     CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write);
     cs.Write(inputByteArray, 0, inputByteArray.Length);
     cs.FlushFinalBlock();
     System.Text.Encoding encoding = new System.Text.UTF8Encoding();
     return encoding.GetString(ms.ToArray());
    }
    catch(System.Exception error)
    {
     return "error:"+error.Message+"\r";
    }

   }
   #endregion
把这个写的类里调用就 行了


禁止键盘输入内容,禁止拷贝内容到某一输入域(如用户注册中的确认输入可以禁止拷贝前一个.).后一个是关闭输入法的 2005-10-23
http://community.csdn.net/Expert/topic/4186/4186163.xml?temp=.1564295

<INPUT onmousedown="return false" onkeydown="return false" onpaste="return false" type="file" size="50" name="File"  >
<INPUT ContentEditable="false" type="file" size="50" name="File"  >
<INPUT readonly type="input" size="50" name="File"  >

<INPUT style="ime-mode:disabled" type="file" size="50" name="File"  > 关闭中文输入法

只能输入中文信息
<asp:RegularExpressionValidator ];
    dt.Rows.Add(dr3);
   }
   cmd1.Connection.Close();  
   DataView dv = new DataView(dt);   
   DataGrid1.DataSource =dv;
   DataGrid1.DataBind(); 
   DataGrid1.RenderControl(output);
  }

相关文章:

  • 2022-12-23
  • 2021-12-27
  • 2021-08-05
  • 2021-06-01
  • 2022-03-01
猜你喜欢
  • 2021-12-04
  • 2021-12-06
  • 2021-11-30
  • 2022-12-23
  • 2021-07-26
  • 2021-09-09
相关资源
相似解决方案