開JQuery UI Dialog Modal視窗時,出現捲軸水平的和垂直的捲軸的修正方法
找了很久就只有下面的方法最好用
如果用隱藏的方式像是overflow:hidden的話,如果把視窗調小查詢的話,會出現一堆奇奇怪怪的問題
最後用的是position:fixed那個比較好用,雖然不支援舊的IE像IE6啦

welkingunther 發表在 痞客邦 留言(0) 人氣()

研究ㄌ很多方法,發現還是只有這個最好用...
 
因為我程式都會用到asp.net的Response.Redirect,這個會讓很多東西失效,像是location.replace那些...
 

welkingunther 發表在 痞客邦 留言(2) 人氣()

這是跟SSL有關的問題
先寫一個Class
 internal class AcceptAllCertificatePolicy : ICertificatePolicy
 {
     public AcceptAllCertificatePolicy()
    {
     }

welkingunther 發表在 痞客邦 留言(0) 人氣()

Visual Studio 2010
◎輔助外掛--好用耶~
https://viml.nchc.org.tw/blog/paper_info.php?CLASS_ID=1&SUB_ID=1&PAPER_ID=189
https://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef?SRC=Home

welkingunther 發表在 痞客邦 留言(0) 人氣()


之前有寫了一篇JavaScript的產生日曆
這篇是改成用ASP.NET寫的
private void CreateCalendar(int Year, int Month, DataTable DT)
{
DateTime whichDate = new DateTime(Year,Month,1);
string strCalendar = "";
// 每月日數陣列
int[] monthDays = new int[]{31,28,31,30,31,30,31,31,30,31,30,31};
// 閏年判斷
int myYear = whichDate.Year;
int myMonth = whichDate.Month;
if ( ( (myYear % 4 == 0) && (myYear % 100 != 0) )
|| (myYear % 400 == 0) )
monthDays[1] = 29;
string [] myArray =
new string [7] {"Sunday","Monday","Tuesday","Wednesday"
,"Thursday","Friday","Saturday"};
string [] myArray2 = new string [7] {"0","1","2","3","4","5","6"};
// 該月第一天的星期
int day =
Convert.ToInt32(myArray2[Array.IndexOf(myArray, whichDate.DayOfWeek.ToString())]);
// 計算秀出時需要的格數
int total = monthDays[myMonth-1] + day;
int totalCells = total + ( (total%7 != 0) ? 7 - total%7 : 0  ); 
// 標題列
strCalendar ="<TABLE id=\"myCalendarTable\" class=\"myGrid\" style=\"border-collapse:
collapse\" cellSpacing=\"0\" cellPadding=\"4\" align=\"center\" width=\"100%\" border=\"0\">";
strCalendar += "<TR>";
strCalendar += "<TD class=\"GridHeading\" width=\"14%\">星期日</TD>";
strCalendar += "<TD class=\"GridHeading\" width=\"14%\">星期一</TD>";
strCalendar += "<TD class=\"GridHeading\" width=\"14%\">星期二</TD>";
strCalendar += "<TD class=\"GridHeading\" width=\"14%\">星期三</TD>";
strCalendar += "<TD class=\"GridHeading\" width=\"14%\">星期四</TD>";
strCalendar += "<TD class=\"GridHeading\" width=\"14%\">星期五</TD>";
strCalendar += "<TD class=\"GridHeading\" width=\"14%\">星期六</TD>";
strCalendar += "</TR>";
for (int i=0;i<totalCells;i++)
{
if ( i%7 == 0 )
{
strCalendar+="</TR><TR height=\"70px\">";
}
if ( i >= day && i < total )
{
int myDay = ((i-day)+1);
string myDateStr = whichDate.ToString("yyyy/MM/")  + myDay.ToString("D2");
if ( !DT.Rows.Contains(new DateTime(myYear,myMonth,myDay)) )
{
strCalendar += "<TD class=\"myItem\" onclick=\"addClass(this);\" >"+
myMonth.ToString("D2") + "/" + myDay.ToString("D2");
}
else
{
string myContentStr = "0";
DataRow rowFound;
// 設定DataTable的PrimaryKey,這樣之後才可以對這個DataTable作尋找內容的動作
DataColumn[] ColumnPrimaryKey = new DataColumn[1];
ColumnPrimaryKey[0] = DT.Columns["myDate"];
DT.PrimaryKey = ColumnPrimaryKey;
// 因為已經設定myDate為主鍵,他是DateTime型別的,故這邊用DateTime搜尋
rowFound = DT.Rows.Find(new DateTime(myYear,myMonth,myDay));
if( rowFound != null )
{
myContentStr = rowFound["whichNumber"].ToString();
}
strCalendar += "<TD class=\"myItem\" onclick=\"addClass(this);\">"+
myMonth.ToString("D2") + "/" + myDay.ToString("D2");
}
}
else
{
strCalendar += "<TD class=\"myItem\">&nbsp;";
}
strCalendar += "</TD>";
}
calendarDiv.InnerHtml = strCalendar;
}

welkingunther 發表在 痞客邦 留言(0) 人氣()


如果以Html產生Word,然後在Word2007 或Word2010 修改後按儲存的話
會出現多餘的資料夾和檔案(但是Word2003不會)
所以我就把產生的Word檔變成MHT格式的就好了
但是Word 2000會完全不能用=.="
雖然我不知道104人力銀行是怎麼做的
但做起來跟104人力銀行產生Word履歷表的功能很像~.~"
// Word
Response.AddHeader("content-disposition", "attachment;filename=WORD檔名.doc");
Response.ContentType = "application/msword
Response.Write("MIME-Version: 1.0" + Environment.NewLine);
Response.Write("Content-Type: multipart/mixed; boundary=\"myRegion\"" + Environment.NewLine);
Response.Write("--myRegion" + Environment.NewLine);
Response.Write("Content-Type: text/html" + Environment.NewLine + Environment.NewLine);
Response.Write("<html><body>");
Response.Flush();
StringWriter mySWriter = new StringWriter();
HtmlTextWriter myHWriter = new HtmlTextWriter(mySWriter);
某個控制項.RenderControl(myHWriter);
Response.Write("<meta http-equiv=Content-Type content=text/html;charset=big5>");
Response.Write(mySWriter.ToString().Trim());
Response.Write("</body></html>");
Response.Write(Environment.NewLine + Environment.NewLine + "--myRegion--");
Response.Flush();
Response.End();

welkingunther 發表在 痞客邦 留言(0) 人氣()


最近.NET Reflector宣佈他們的免費產品將改為收費產品後
就不能用免費的摟
所以就找了另一個免費的開放原始碼的.NET反組譯工具
這個社群的成立也是因為.NET Reflector要變收費,才成立的
https://www.ilspy.net
要裝.NET FrameWork 4.0才能跑喔
網頁裡都有~~

welkingunther 發表在 痞客邦 留言(1) 人氣()


// 先準備一些CSS
.mySelected { BACKGROUND: #D4D4FF }
.myHeaderSelected { BACKGROUND: #2AAAFF } 
// 設定Class
function addClass(Obj)
{
if ( hasClass(Obj) )
{
inpuObj.setAttribute('className','');
}
else
{
inpuObj.setAttribute('className','mySelected');
}
}
// 判斷是否有Class
function hasClass(Obj)
{
if ( Obj.getAttribute('className') != '' )
{
return true;
}
else
{
return false;
}
}
// 取得某Class的全部值
function getElementsByClassName(whichClass)  
{
var node = document.getElementsByTagName("body")[0];
var returnStr = "";
var re = new RegExp('\\b' + whichClass + '\\b');
var els = node.getElementsByTagName("*");
for(var i=0; i<els.length; i++)
{
// 假設els[i]的childNode[1]是存放著某個值的input標籤
if(re.test(els[i].getAttribute('className')))
returnStr += els[i].childNodes[1].value + ",";
}
return returnStr;
}
// 把所選取的TD的那一整行都變顏色
// 使用方法像是在TD上寫onclick='setColumnColor(this);'
// cellIndex只有TD有,TR沒有
function setColumnColor(Obj)
{
if ( !hasClass(Obj) )
{
Obj.setAttribute('className','myHeaderSelected');
}
else
{
Obj.setAttribute('className','');
}
var td = Obj.parentElement.parentElement.getElementsByTagName("td");
for(var i=0; i<td.length; i++)
{
if(td[i].cellIndex==Obj.cellIndex)
{
if ( !hasClass(Obj) )
{
td[i].setAttribute('className','');
}
else
{
td[i].setAttribute('className','mySelected');
}
}
}
}
// 把所選取的TD的那一整列都變顏色
// rowIndex只有TR有,TD沒有
function setRowColor(Obj)
{
if ( !hasClass(Obj) )
{
Obj.setAttribute('className','myHeaderSelected');
}
else
{
Obj.setAttribute('className','');
}
var td = Obj.parentElement.parentElement.getElementsByTagName("td");
for(var i=0; i<td.length; i++)
{
if(td[i].parentElement.rowIndex==Obj.parentElement.rowIndex)
{
if ( !hasClass(Obj) )
{
td[i].setAttribute('className','');
}
else
{
td[i].setAttribute('className','mySelected');
}
}
}
}

welkingunther 發表在 痞客邦 留言(0) 人氣()


var date = new Date();
function createCalendar(whichDiv)
{
  var strCalendar = "";
  
  // 每月日數陣列
  var monthDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
  
  // 閏年判斷
  mYear = date.getFullYear();
  if ( ( (mYear % 4 == 0) && (mYear % 100 != 0) ) || (mYear % 400 == 0) ) monthDays[1] = 29;
  
  // 設定日期為該月第一天
  date.setDate(1);
  
  // 該月第一天的星期
  var day = date.getDay();
  
  // 計算秀出時需要的格數
  var total = monthDays[date.getMonth()] + day;
  var totalCells = total + ( total%7 ? 7 - total%7 : 0  ); 
  strCalendar ='<TABLE cellSpacing="1" cellPadding="0" align="center" width="400" bgcolor="#888888">';
  strCalendar += '<TR>';
  strCalendar += '<TH></TH>';
  strCalendar += "<TH>日</TH>";
  strCalendar += '<TH>一</TH>';
  strCalendar += '<TH>二</TH>';
  strCalendar += '<TH>三</TH>';
  strCalendar += '<TH>四</TH>';
  strCalendar += '<TH>五</TH>';
  strCalendar += '<TH>六</TH>';
  strCalendar += '</TR>';
  for (i=0;i<totalCells;i++)
  {
if ( i%7 == 0 )
strCalendar+="<TR><TD>&nbsp;</TD>";
if ( i >= day && i < total )
{
if ( i >= day )
{
var whichDate = date.getFullYear() + "/" + (date.getMonth()+1) + "/" + ((i-day)+1);
strCalendar += "<TD>"+((i-day)+1);
strCalendar += "<input id='Identity' type='hidden' value='" + whichDate + "'>";
}
}
else
{
strCalendar += "<TD>&nbsp;";
}
strCalendar += "</TD>";
if ( i%7 == 6 )
strCalendar += "</TR>";
   }
   document.getElementById(whichDiv).innerHTML = strCalendar;
}
呼叫的話就用,像以下就會產生2011年1月的日曆
date.setFullYear('2011');
date.setMonth(0);
createCalendar('myDiv');

welkingunther 發表在 痞客邦 留言(0) 人氣()


// 轉換半形成全形(可轉英文或數字)
public static string CharForHalfToFull(string sourceChar)
{
string myReturnValue = "";
char [] myValue = sourceChar.ToCharArray(); 
for ( int i = 0; i < myValue.Length; i++ ) 

myReturnValue += (Convert.ToChar(Convert.ToInt32(myValue[i]) + 65248)).ToString(); 

return myReturnValue; 
}
像是welkingunther0122就會變成
welkingunther0122

welkingunther 發表在 痞客邦 留言(0) 人氣()

一般的QueryString就直接在網址加參數就好
但如果是用Post的話則要用下面方法
public Stream GetWebData(string Url, string PostData)
{
 byte[] myData = Encoding.Default.GetBytes(PostData);

welkingunther 發表在 痞客邦 留言(0) 人氣()

//用RegularExpress取代或移除Html標籤
宣告using System.Text.RegularExpressions;

// 把myOriginalStr裡面的相關font元素都移除掉
Regex myRegex  = new Regex("<font(.)*?>|</font>");
string myNoFontStr = myRegex.Replace(myOriginalStr, "");

welkingunther 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。