Posts

Showing posts from March, 2015

BackgroundWorker Control

ตัวอย่างนี้ เป็นคอนโทรลที่ใช้ในการทำงานแบบอยู่เบื้องหลัง ไม่กระทบกับการทำงานเบื้องหน้า หรือที่เรียกกันว่า Asynchronous นั่นเองครับ     Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork         For i As Integer = 0 To 100 Step +1             If BackgroundWorker1.CancellationPending = True Then                 e.Cancel = True                 Exit For             Else                 BackgroundWorker1.ReportProgress(i)                 System.Threading.Thread.Sleep(100)             End If         Next     End Sub     Private Sub BackgroundWorker1_ProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged         ProcessBar.Value = e.ProgressPercentage         lbl_percent.Text = e.ProgressPercentage & "%"     End Sub     Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As System.Component

AutoComplete Extension

Image
1. Add Connection String to web.config <connectionStrings>     <add name="conn" connectionString="Data Source=SERVER;Initial Catalog=DB; User ID=USER;Password=PASSWORD" providerName="System.Data.SqlClient"/> </connectionStrings> 2. Insert Control ScriptManager, Textbox and add AutoComplete Extension <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="form1" runat="server">     <div>              <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageM

Problem :: Windows cannot log you on because your profile cannot be loaded.

    ปัญหาเมื่อทำการ Login เข้า Windows แล้วพบข้อความขึ้นว่า Windows cannot log you on because your profile cannot be loaded. อันดับแรกให้ทำการตรวจสอบ Network ก่อนว่าสามารถใช้งานได้ตามปกติไหม ถ้าใช้งานได้ตามปกติแล้วแต่ยังไม่สามารถ login ได้ ตามนี้เลยครับ 1. Login to Local Administrator or Domain Administrator 2. Go to Start > Run > Regedit 3. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21[xxxx] 4. ให้ทำการเลือกหา User Profile ของ User ที่มีปัญหา โดยดูที่ ProfileImagePath หลังจากที่พบแล้ว 5. ให้ทำการแก้ไข RefCount ให้เป็น 0 และ State ให้เป็น 0  6. ทำการ Restart Computer แล้วทำการ Login เข้าใช้งานได้ตามปกติ

AJAX ModalPopup Extension + JavaScript

Image
Instruction Step. 1. Insert CSS for ModalPopup extension. 2. Insert ScriptManager. 3. Insert GridView. 4. Insert Panel1 and Control. 5. Config LinkButton by Add modalpopup extension and set PopupControlID = Panel1. 6. Code-Behind :: Load data to gridview on Page_Load event. 7. Code-Behind :: Insert javascript to linkbutton. 8. Code-Behind :: Update data by update button. modalpopup.aspx <%@ Page Language="VB" AutoEventWireup="false" CodeFile="T1.aspx.vb" Inherits="T1" Trace="false" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>     <style type="text/css">         .modalPopup          {             background-color:yellow;             border-width:1px;