블로그 이미지
Magic_kit
study 관련자료를 한곳으로 자기 개발 목적으로 재태크 재무 관리 목적으로 일상생활의 팁을 공유 하기 위하여 블로그를 개설 하였습니다.

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Category

Recent Post

Recent Comment

Archive

2009. 10. 28. 11:16 .Net Project/ASP.NET 3.5 Sp1
반응형


                                               UpdateProgress 컨트롤 사용  
FrmUpdateProgress.aspx

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrmUpdateProgress.aspx.cs"
         Inherits="FrmUpdateProgress" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Update Progress</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
       
        아래에 오래 걸리는 기능 구현          
       
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                <asp:Button ID="Button1" runat="server" Text="확인" onclick="Button1_Click" />
                    <br /> 
                    3초 걸리는 작업
            </ContentTemplate>
        </asp:UpdatePanel>
       
        <asp:UpdateProgress ID="UpdateProgress1" runat="server"
                AssociatedUpdatePanelID ="UpdatePanel1">
            <ProgressTemplate>
                <span style="color:Red;">
                로딩중....</span>
            </ProgressTemplate>
        </asp:UpdateProgress>
   
    </div>
    </form>
</body>
</html>



 FrmUpdateProgress.aspx.Cs

using System;
using System.Web.UI.WebControls;

public partial class FrmUpdateProgress : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
          //Empty
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //시간 지연
        System.Threading.Thread.Sleep(3000); //3초 지연

        this.Label1.Text = DateTime.Now.ToLongTimeString();
    }
}


반응형
posted by Magic_kit
2009. 10. 28. 10:43 .Net Project/ASP.NET 3.5 Sp1
반응형



TimerControl 이란 ??
 
FrmTimerControl.aspx

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrmTimer.aspx.cs"
         Inherits="FrmTimer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<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">
        </asp:ScriptManager>
    타이머 컨트롤 <br />
    <hr />
        
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
             현재시간 :
              <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
              <asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick">
              </asp:Timer>   
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>


FrmTimerControl.aspx.Cs

using System;
using System.Web.UI.WebControls;

public partial class FrmTimer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
          //Empty
    }
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        //지정된 시간마다 현재 이벤트 핸들러 실행
        this.Label1.Text = DateTime.Now.ToLongTimeString();
     }
}




반응형
posted by Magic_kit
2009. 10. 28. 10:17 .Net Project/ASP.NET 3.5 Sp1
반응형
 
 
1. FrmAjaxWebForm.aspx 윈폼 생성
 2. AJAX 확장 메뉴에서 ScriptManager 컨트롤러 추가
 3. 전체 페이지 포스트백 과 부분 페이지 포스트 백의 차이점 (AJAX컨트롤 사용하는방법)
 4. 자신이 원하는 부분에 적용하고자 할때 UpdatePanel 사용 하도록 한다.




 FrmAjaxWebForm.aspx

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrmAjaxWebForm.aspx.cs" Inherits="FrmAjaxWebForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<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">
       
        </asp:ScriptManager>
        전체 페이지 포스트 백(다시게시) : ASP.NET Ajax 컨트롤 적용전<br />
        <asp:Label ID="Label1" runat="server" Text="Label" ForeColor="Red"></asp:Label>
        <asp:Button ID="Button1" runat="server" Text="확인" onclick="Button1_Click" /> <br />
       
        부분 페이지 포스트 백(다시게시):ASP.NET AJAX -> Microsoft Ajax 컨트롤 사용
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                  <asp:Label ID="Label2" runat="server" Text="Label" 
                          ForeColor="Red"></asp:Label>
                  <asp:Button ID="Button2" runat="server" Text="적용" onclick="Button2_Click" /> 
            </ContentTemplate>
        </asp:UpdatePanel>         
        
        <asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
    </div>
    </form>
</body>
</html>


 FrmAjaxWebForm.aspx.Cs

using System;
using System.Web.UI.WebControls;

public partial class FrmAjaxWebForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
         //Empty
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //현재 시간을 ToLongTimeString()속성 사용하여 Label에 출력
        this.Label1.Text = DateTime.Now.ToLongTimeString();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        this.Label2.Text = DateTime.Now.ToLongTimeString();
    }
}







반응형
posted by Magic_kit
2009. 10. 28. 09:53 .Net Project/ASP.NET 3.5 Sp1
반응형

 
 
 1. WebPartManager 컨트롤을 가장 상단에 떨어 뜨려 놓는다 (필수)
 2. 3개의 영역에 각각 WebPartZone 컨트롤을 올려 놓도록 한다
 3. 각각의 영역에 Calendar 컨트롤을 떨어 뜨린다
 4. 각각의 영역에 Image 컨트롤을 떨어 뜨린다
 5. 각각의 영역에 Login 컨트롤을 떨어 뜨린다 
 6. 각각의 컨트롤에 Title="로그" 다음과 같이 속성 지정

 실행시 컨트롤을 닫았을 경우 다시 복원하기 위해서 사용
 7. 최상위 메뉴 옆에 드롭다운 리스트 추가 

<td colspan="3">메뉴<asp:DropDownList ID="DropDownList1" runat="server"

                    AutoPostBack="true"
                   onselectedindexchanged="DropDownList1_SelectedIndexChanged">

                    <asp:ListItem Value="0">Browse</asp:ListItem>

                    <asp:ListItem Value="1">Design</asp:ListItem>

                    <asp:ListItem Value="2">Catalog</asp:ListItem>

                </asp:DropDownList>

            </td>


 8. DropDownList 컨트롤에 Changed 이벤트 클릭을 잡는다. 

  protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (this.DropDownList1.SelectedValue == "0")
        {
            this.WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode; 
        }
        else if (this.DropDownList1.SelectedValue=="1")
        {
            this.WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;
        }
        else if (this.DropDownList1.SelectedValue=="2")
        {
            this.WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
        }
    }
 9. Catalog Zone 컨트롤 추가  후 컨트롤안데 Page Catalog Zone 컨트롤 추가 완료
     (CatalogZon 컨트롤은 다른 zon 영역안에 추가 불가능 하다)
<asp:CatalogZone ID="CatalogZone1" runat="server">
         <ZoneTemplate>
             <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
         </ZoneTemplate>              
     </asp:CatalogZone>
 

 WebPart.aspx

 <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs"
          Inherits="_Default"
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

    <title>웹 파트 컨트롤</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

   
        <asp:WebPartManager ID="WebPartManager1" runat="server">
        </asp:WebPartManager>
   
    <table border="1">
        <tr>
            <td colspan
="3">메뉴<asp:DropDownList ID="DropDownList1" runat="server"
                    AutoPostBack="true" 
                      onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                    <asp:ListItem Value="0">Browse</asp:ListItem>
                    <asp:ListItem Value="1">Design</asp:ListItem>
                    <asp:ListItem Value="2">Catalog</asp:ListItem>
               
</asp:DropDownList>
            </td>
        </tr>
       
         <tr>
            <td>
<asp:WebPartZone ID="WebPartZone1" runat="server">
                <ZoneTemplate>
                    <asp:Calendar ID="
Calendar1" runat="server"  Title="달력"></asp:Calendar>
                      
                </ZoneTemplate>
                </asp:WebPartZone>
                역1</td>
            <td>영<asp:WebPartZone ID="WebPartZone2" runat="server">
                <ZoneTemplate>
                    <asp:Image ID=
"Image1" runat="server" Title="로고" />
                </ZoneTemplate>
                </asp:WebPartZone>
                역2</td>
            <td><asp:WebPartZone ID="WebPartZone3" runat="server">
                <ZoneTemplate>
                    <asp:Login ID="
Login1" runat="server" Title="로그인">
                    </asp:Login>
                </ZoneTemplate>
                </asp:WebPartZone>

                역3</td>
               
        </tr>    
    </table>
     <asp:CatalogZone ID="
CatalogZone1" runat="server">
         <ZoneTemplate>
             <asp:PageCatalogPart ID
="PageCatalogPart1" runat="server" />
         </ZoneTemplate>
             
     </asp:CatalogZone>
   
    </div>
    </form>
</body>
</html>


 WebPart.aspx.Cs

using System;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (this.DropDownList1.SelectedValue == "0")
        {
            this.WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode; 
        }
        else if (this.DropDownList1.SelectedValue=="1")
        {
            this.WebPartManager1.DisplayMode = WebPartManager.DesignDisplayMode;
        }
        else if (this.DropDownList1.SelectedValue=="2")
        {
            this.WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
        }
    }
}









반응형
posted by Magic_kit