2017年3月31日 星期五

FileUpload 上傳檔案

FileUpload 控件練習,筆記重點為
判斷是否為允許上傳的檔案附檔名
限制檔案大小,限制為 2MB
判斷 Server 上檔案名稱是否有重覆情況,有的話必須進行更名
---
[C#] FileUpload 上傳檔案

2017年3月30日 星期四

藍禮白子 (母魚)


















asp.net UpdatePanel textbox datetimepicker (有效)

jquery ui datepicker inside asp.net UpdatePanel  (參考來源)
---
必須底下寫法:

asp:ScriptManager ID="ScriptManager1" runat="server">
/asp:ScriptManager>

<script type="text/javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function(evt, args) {
        $(".datepicker").datepicker();
    });
</script>

---
中文化用法:
jQuery UI DatePicker中文化

//設定中文語系, 取自http://blog.e-happy.com.tw/?p=5011
$.datepicker.regional['zh-TW'] = {
   dayNames: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
   dayNamesMin: ["日", "一", "二", "三", "四", "五", "六"],
   monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
   monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
   prevText: "上月",
   nextText: "次月",
   weekHeader: "週"
};
//將預設語系設定為中文
$.datepicker.setDefaults($.datepicker.regional["zh-TW"]);

ASP.NET 中 UpdatePanel與jQuery同時使用所遇問題解決

ASP.NET中UpdatePanel与jQuery同时使用所遇问题解决
---
現也是遇到這問題...
還看不懂...要慢慢看

2017年3月28日 星期二

modal hide bootstrap no work

How to hide Bootstrap modal from javascript?
---
請參考來源內的一段用法:
-
$('.modal-backdrop').hide(); // for black background
$('body').removeClass('modal-open'); // For scroll run
$('#modal').modal('hide');


這樣就能將背景色清除.隱藏

2017年3月26日 星期日

how to use multiple datakeys in gridview in asp.net

Using Multiple DataKeyNames (DataKeys) in ASP.Net GridView with examples
---
使用:
DataKeyNames="Id, Group"

取值:
Protected Sub GridView_Button_Click(sender As Object, e As EventArgs)
    'Determine the RowIndex of the Row whose Button was clicked.
    Dim rowIndex As Integer = TryCast(TryCast(sender, Button).NamingContainer, GridViewRow).RowIndex

    'Get the value of column from the DataKeys using the RowIndex.
    Dim id As Integer = Convert.ToInt32(GridView1.DataKeys(rowIndex).Values(0))
    Dim group As String = GridView1.DataKeys(rowIndex).Values(1).ToString()
End Sub

藍白緞公

欣賞價值...











藍白燕尾(幼母)






2017年3月23日 星期四

Editable Grid View System using BootStrap in ASP.Net

Editable Grid View System using BootStrap in ASP.Net
---
很不錯的完整範例教學


---
其他範例:

Add Edit Update Records in GridView using Modal Popup in ASP.Net

aspnet 在 MasterPage 的框架問題

[範例]ASP.NET使用Session驗證練習範例  (請參考此篇)
---
在 aspx 檔內, 開啟 .vb 程式碼 如下:

Partial Class About
    Inherits Page

End Class

看了都暈了,怎跟webform 長得完全不同! 也沒 page_load 等!
依照上面的連結 , 我們必須去增加 page_load

 Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
 End Sub

這樣就可以處理一些頁面載入的判斷式了!

asp.net webmethod session

Using ASP.NET Session State in a Web Service
---
How can I access session in a webmethod?
---
重點底下寫法:
EnableSession:=True
---
  _
    Public Function IncrementSessionCounterX() As Integer
        Dim counter As Integer
        If Context.Session("Counter") Is Nothing Then
            counter = 1
        Else
            counter = Context.Session("Counter") + 1
        End If
        Context.Session("Counter") = counter
        Return counter
    End Function

Web Services in C#

Web Services in C#
---
有一些觀念很重要! 在新的工具裡,一些webform 是不一樣的用法!

Four real world uses of Partial classes and Partial methods
---
VB.Net Partial Classes (Partial)
---

利用jQuery -Ajax 叫用 ASP.NET 的幾種方式

利用jQuery -Ajax 叫用 ASP.NET 的幾種方式
--
這些範例很不錯,實用

2017年3月21日 星期二

MSSQL 匯入匯出

匯入匯出
---
BCP 指令  匯出 / 匯入


底下採用BCP 條件匯出:
How to Export records from SQL Server to Text File using BCP
bcp query out format


JQuery AJAX Example Code in Asp.net to Insert or Save Data into SQL Server Database without Postback in C#.Net VB.Net

JQuery AJAX Example Code in Asp.net to Insert or Save Data into SQL Server Database without Postback in C#.Net VB.Net
--

www.codedisplay.com | Help to Code [Free Asp.net, C#, VB.Net, JQuery, Ajax, Javascript, SQL Server Articles]   (好站 )

--

有很多可以學習


---
Ajax and jQuery in ASP.NET MVC
Inserting Data Using jQuery Ajax POST Method In ASP.NET MVC 5
--

iis7 HTTP 錯誤 404.0 - Not Found

HTTP Error 404.0 - Not Found in MVC  (請參考內文的 web.config)

若IIS 找不到 aspx 檔, 出現錯誤訊息:
HTTP 錯誤 404.0 - Not Found
您尋找的資源已移除、名稱已變更,或暫時無法使用。
---

要改成:



  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
      <modules runAllManagedModulesForAllRequests="true" >
          <remove name="UrlRoutingModule"/>
          <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </modules>
      <handlers>
          <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
          <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </handlers>
  </system.webServer>

aspnet site img src

HTML img and ASP.NET Image and relative paths
---
若切換到不同路徑 , 會造成無法對應到圖檔位置
明碼的寫法 : 
<img src="~/App_Themes/Default/images/two.gif" runat="server" />

但若採用了 ajax 又不可以加 ~/   ,不然又對應不到圖檔  (動態式) 

就這2個差異

ASP.NET MongoDB 基本新增、讀取、更新、刪除 (CRUD) 操作 with C# Driver

[MongDB] MongoDB 基本新增、讀取、更新、刪除 (CRUD) 操作 with C# Driver
---

微軟MSDN : Getting started with MongoDB   (C# , VB 範例 )

--
官網 : MongoDB Drivers
--

mongodb 教學

MongoDB介紹
--
MongoDB 基礎入門教學:MongoDB Shell 篇
--
mongodb 官網

2017年3月17日 星期五

aspnet site.master add js

參考1:ASP.Net Master Page and File path issues
參考2:How do you include JavaScript in MasterPage?
---
方法有2 :
1.
<asp:ScriptManager ID="ScriptManager1" runat="server">
    <Scripts>
        <asp:ScriptReference Path="~/jquery.js" />
    </Scripts>
</asp:ScriptManager>

2.
<body>

    <!-- Scripts at bottom of page for faster loading. -->

    <script src='<%= ResolveUrl("~/js/jquery-1.7.1.min.js") %>'></script>
    <script src='<%= ResolveUrl("~/js/script.js") %>'></script>

</body>

---
Bootstrap 3.0.0 with ASP.NET Web Forms – Step by Step – Without NuGet Package

2017年3月8日 星期三

製作浮動式的回到網頁頂部按鈕

jQuery制作go to top按钮
如何製作浮動式的回到網頁頂部按鈕?(JQUERY 動態效果)
---

bootstrap html editor

Tiny, opensource, Bootstrap WYSIWYG rich text editor from MindMup
微型、开源的Bootstrap所见即所得(WYSIWYG)富文本编辑器 -- 由MindMup贡献
同一個
--
Bootstrap Snippet Bootstrap Html Editor using HTML CSS Javascript | Bootsnipp.com
--
10 Best jQuery and HTML5 WYSIWYG Plugins
--
Summernote - Super Simple WYSIWYG editor
--

bootstrap 中文教學網

首頁 - Bootstrap 2中文教學 - KKBruce
Bootstrap 3 中文手冊 · 世界最受歡迎的行動優先和自適應前端框架。 - KKBruce
---
如何利用Bootstrap的標籤(Tabs)和導覽列(Navigation Bar)

blog bootstrap template

Flat UI - Free Bootstrap Framework and Theme
The ASP.NET Developer’s guide to Bootstrap
--
Top 25 Best Free Bootstrap Blog Templates Coded Using HTML5 and CSS3 - 2016 - Colorlib
35+ Bootstrap Blog Themes & Templates | Free & Premium Templates
---
45+ Best Blog Bootstrap Website Templates - Web Resources Free
Bootstrap blog themes on BootstrapZero
---
MVCBlog (Blog engine based on ASP.NET MVC 5 and Twitter Bootstrap 3)  ***

--
w3schools bootstrap
Bootstrap 教程 | 菜鸟教程
--

Start Bootstrap - Free Bootstrap Themes and Templates  ***




2017年3月7日 星期二

jQuery Gallery & Image Sliders

The Top 50 jQuery Gallery & Image Sliders for 2017
40+ Brilliant Free jQuery Image Gallery/Slider Plugins
--
Image gallery and Slideshows | Webdesigner Depot
90+ Impressive jQuery Image Gallery, Lightbox, Tabs, Menu and Text Effects
--
g : jquery picture gallery with text


--
30 Text Captions Overlay Image Plugins

g : jquery image gallery with thumbnails and captions


jCapSlide: A jQuery Image Caption Plugin  *
blueimp Gallery *


Free jQuery plugins (官網) /  來這找較快
Free jQuery Plugins and Tutorials - jQuery Script


--
20 個免費好用的響應式 jQuery 輪播幻燈片插件
10款很好用的 jQuery 图片滚动插件-前端里
Slick - 左右輪播效果〈另將文字和文字背景放在圖片上〉
相片輪播
JQUERY-支援RWD廣告輪播套件-BXSLIDER
30款jQuery常用網頁焦點圖banner圖片切換
圖片輪播jQuery套件




asp.net blog 系統

Orchard
BlogEngine.NET | An open source ASP.NET powered blogging engine

How to create a simple blog using ASP.NET MVC

How to create a simple blog using ASP.NET MVC - Part I
HOW TO CREATE A SIMPLE BLOG USING ASP.NET MVC - PART II
HOW TO CREATE A SIMPLE BLOG USING ASP.NET MVC - PART III
---

2017年3月1日 星期三

使用jQuery AJAX 傳遞JSON 給Web Service處理,處理後再拋回JSON資料

參考引用:使用jQuery AJAX 傳遞JSON 給Web Service處理,處理後再拋回JSON資料
---
SuncolorFBLogin.aspx

javascript :

FB.api('/me', function (response) {

var member = {member: {

"uid": response.id,

"cname": response.name,

"email": response.email,

"birthday": response.birthday,

"gender": response.gender

}};

$.ajax({

url: "SuncolorFBLogin.aspx/FBMemberCheck",

type: "POST",

contentType: "application/json; charset=utf-8",

data: JSON.stringify(member),

dateType: "json",

success: function (res) {

document.write(res.d.uid);

}, error: function (err) {

alert(err.responseText);

}

});

});

SuncolorFBLogin.aspx.vb

ASP.Net (因為是老專案所以用VB.Net,用C#自己轉應該也還好)

Imports System.Web.Services

Imports System.Web.Script.Services

Imports Newtonsoft.Json

Imports Newtonsoft.Json.Linq

Imports System.Web.Script.Serialization


_

Public Shared Function FBMemberCheck(ByVal member As member) As member

'可以直接 member.uid 取值

'如果要還原成JSON字串就用下面這樣

Dim objSerializer As JavaScriptSerializer = New JavaScriptSerializer()

Dim json As String = objSerializer.Serialize(member)

'如果要把JSON字串反序列化再傳出去就用下面這樣

Dim obj As JavaScriptSerializer = New JavaScriptSerializer()

Return obj.Deserialize(Of member)(json)

End Function



Public Class member

Dim _uid As String = ""

Dim _cname As String = ""

Dim _email As String = ""

Dim _birthday As String = ""

Dim _gender As String = ""

Public Property uid() As String

Get

Return _uid

End Get

Set(ByVal value As String)

_uid = value

End Set

End Property

Public Property cname() As String

Get

Return _cname

End Get

Set(ByVal value As String)

_cname = value

End Set

End Property

Public Property email() As String

Get

Return _email

End Get

Set(ByVal value As String)

_email = value

End Set

End Property

Public Property birthday() As String

Get

Return _birthday

End Get

Set(ByVal value As String)

_birthday = value

End Set

End Property

Public Property gender() As String

Get

Return _gender

End Get

Set(ByVal value As String)

_gender = value

End Set

End Property

End Class