先PO出來,以後再慢慢整理
1.
Response.Write(”alert(’你已經成功刪除資料’);”);
2.
Repeater 與 DataList
後台
3.
protected string GetDate(string dtDate)
{
return dtDate.ToString(”MM/dd”);
}
DateTime.Now.ToString(”yyyyMMdd”)
4.
Creating DataGrid’s hyperlink columns with multiple parameters in the Url
The DataGrid’s HyperLinkColumn column is great to have a column with an hyperlink that points to an Url with a parameter whose value is taken from the data source, but what if you need to build the target Url with more than one parameter taken from the data source? In this case you can use a template column as follows:
‘ />
Instead of doing the string concatenation yourself you can use the BuildUrlWithQueryString function, which must be declared with Public/Protected visibility in the code-behind, as follows:
‘ />
DataList
#region 擷取字串
///
/// 擷取字串
///
///
///
protected string GetFitString(string strWord)
{
if(strWord.Length>8)
{
return strWord.Substring(0,8)+”…”;
}
else
{
return strWord;
}
}
#endregion
5.
btnSubmit.Attributes.Add(”onclick”,”javascript:return confirm(’您確定新增分類嗎?’); “);
6.Cache
DataSet ds=new DataSet();
if (Cache["Continent"] == null)
{
string strXml=Server.MapPath(”xml\\”+ConfigurationSettings.AppSettings["Continent"].ToString());
ds.ReadXml(strXml);
string strCatchTime=ConfigurationSettings.AppSettings["PageCacheTime"].ToString();
Cache.Insert (”Continent”, ds,null,DateTime.Now.AddMinutes(Convert.ToDouble(strCatchTime)),TimeSpan.Zero);
}
ds=(DataSet) Cache["Continent"];
Cache.Remove(”NewsPreview”);
=======================================
##DataSet新增一欄位方法
ds1.Tables[0].Columns.Add(”Nid”);
=======================================
##DropDownList取得日期簡易方法
private void Binddata()
{
string now_year = DateTime.Now.Year.ToString();
string now_Month = DateTime.Now.Month.ToString(”00″);
string now_Day = DateTime.Now.Day.ToString(”00″);
SetListItem(2006,2007,FromOrderYear,now_year);
SetListItem(1,12,FromOrderMonth,now_Month);
SetListItem(1,31,FromOrderDay,now_Day);
SetListItem(2006,2007,ToOrderYear,now_year);
SetListItem(1,12,ToOrderMonth,now_Month);
SetListItem(1,31,ToOrderDay,now_Day);
}
private void SetListItem(int StartIndex , int EndIndex,DropDownList DL,string SelectValue)
{
int len = EndIndex.ToString().Length;
string str = null;
for (int i =0 ;i
留言列表