1、 全球化设置
强行指定浏览网站的页面的编码
中文:
<globalization
requestEncoding="gb2312"
responseEncoding="gb2312"
culture="zh-CN"
uiCulture="zh-CN"
/>
日文:
<globalization
requestEncoding="Shift-JIS"
responseEncoding="Shift-JIS"
culture="ja-JP"
uiCulture="ja-JP"
/>
2、 获取物理绝对路径this.Request.PhysicalApplicationPath
3、 弹出javascript
alert
public
void JavaScriptAlert(string
sErr)
{
string sError = @"
<SCRIPT
language = 'JavaScript' >
alert('"+sErr+@"');
</SCRIPT>";
this.RegisterClientScriptBlock("ErrorMesseage",sError);
}
4、 C#中执行SQL的access的通配符 %%
例:SELECT * FROM * WHERE CREATE_DATE LIKE '"+sDate+"%%'
时间数据的匹配
例: WHERE CLOSE_DATE=#"+this.TextBox_Set.Text+"#
5、
private
void Datalist_ReMessage_ItemDataBound(object sender,
System.Web.UI.WebControls.DataListItemEventArgs e)
{
System.Web.UI.WebControls.Image
im =(System.Web.UI.WebControls.Image)
e.Item.FindControl("Image_Message");
if(im != null)
{
im.Attributes.Add("onload","javascript:if(this.width>screen.width-500)this.style.width=screen.width-500;");
}
}
6、System.Configuration.ConfigurationSettings.AppSettings["xxx"].ToString();获取web.config中的配置<appSettings><add key="xxx" value="1048576" /></appSettings>的值。