2008年11月19日 星期三

SQL 數字 三位一撇

一般來說,如果在GridView要顯示三位一撇,只要設定就可以達到
參考:http://paladinprogram.blogspot.com/2008/07/gridview.html

或者在程式中,可以用 string.Format("{0:#,##0}",數值) 就可以達成(一定要轉成數值喔

若希望在SQL所產生的資料就有三位一撇的效果,可以參考
http://blog.blueshop.com.tw/soway/archive/2008/01/08/53987.aspx

2008年11月18日 星期二

2008年10月9日 星期四

開啟子頁時,要有bar~~~~~

window.open(url,winTitle,option)

option的內容加「scrollbars=yes」

2008年10月2日 星期四

在cs中,導到別頁時,以另開新頁的方式開啟

直接導到別頁的方式:Response.Redirect("網址");

以另開新頁的導頁方式:
public static void OpenWindowToNewPage(Page page, string destUrl)
{
//開一新視窗
string scriptString = string.Format("< language="'JavaScript'">window.open(\"{0}\",'NewPage');<", destUrl);
scriptString += "/";
scriptString += "script >";
Type cstype = page.GetType();
if (!page.ClientScript.IsStartupScriptRegistered("Startup"))
{
page.ClientScript.RegisterStartupScript(cstype, "Startup", scriptString);
}
}
使用方式: OpenWindowToNewPage(this.Page, "網址");


感謝Darren提供

在cs中直接呼叫javascript,不用在click事件

aspx
function Open()
{
var question="";
var question = confirm("Message?")
if (question)
{
window.open("http://","","width=600,height=400,toolbar=0,status=0,menubar=0,resize=0");
//開啟視窗
//window.open("http://");整個視窗
}
}

cs
string script = "< language="'javascript'">Open()< /script>";
ClientScript.RegisterStartupScript(this.GetType(), "n1", script);

立即取得CheckBoxList目前勾選的選項

一般都是用foreach來取得勾選了哪些選項,但如有筆數限定時,要馬上告知user已超出可勾選的筆數,此方式就不適用了!

可改用:

SelectedIndexChanged事件
string args = Request["__EVENTTARGET"];
char[] delimiterChars = { '$' };
string[] words = args.Split(delimiterChars);
int ix = Convert.ToInt16(words[words.Length - 1]);

foreach (ListItem item in CheckBoxList.Items)
{
if (item.Selected)
{
if (!判斷目前所勾選的筆數)
CheckBoxList.Items[ix].Selected = false;
}
}


參考網址:http://phone.idv.tw/cs2/forums/thread/510.aspx

感謝協助我的人^^