'프로그래밍'에 해당되는 글 35건

  1. 2007.11.11 | 초보자에게 요긴한 팁

초보자에게 요긴한 팁

프로그래밍/ASP.NET | 2007. 11. 11. 22:52
Posted by 손반장님

1. 파일 다운

foreach (ListItem li in this.ListBox1.Items)
{
 if (li.Selected)
 {
  string fullfilename = Server.MapPath(".") + @"\excelfiles\" + this.RadioButtonList1.SelectedItem.Text + @"\";
  string fName = li.Value;
  Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(fName).Replace("+","%20"));
  Response.ContentType = "multipart/form-data";
  Response.WriteFile(fullfilename + fName);
 }
}


2. confirm 확인창 뛰우기

this.btnDelete.Attributes.Add("OnClick", "return confirm('삭제하시겠습니까?')");


3. 함수 호출

Page.RegisterClientScriptBlock("down", "<script>down();</script>");


4. 새창띄우기

Response.Write("<script>window.open('ViewExcel.aspx', 'register', 'width=500, height=500, resizable=yes,left=200,top=100');</script>");


5. 배열받기

string[] list = Request.Params.GetValues("checkID");


6. 세션 쿠키값 전부 가져오기

HttpCookieCollection cookie = new HttpCookieCollection();


7. 숫자 표현형식...소수점 첫째자리

DataFormatString = "{0:N1}";


8. 쿠키값 출력

cookie = Request.Cookies;
Response.Write("<script>alert('쿠키')</script>");
string[] cookiesname = cookie.AllKeys;
for (int i = 0; i < cookiesname.Length; i++)
{
 Response.Write("<script>alert('" + Request.Cookies[cookiesname[i]].Name + "')</script>");
 Response.Write("<script>alert('" + Request.Cookies[cookiesname[i]].Value + "')</script>");
}


9. 세션값 출력

IEnumerator dic = Session.GetEnumerator();
Response.Write("<script>alert('세션')</script>");
while (dic.MoveNext())
{
 Response.Write("<script>alert('" + dic.Current.ToString() + "')</script>");
}

 
블로그 이미지

손반장님

카테고리

분류 전체보기 (68)
잡담 (15)
stuff (6)
Mountain (11)
프로그래밍 (35)