DayRenderEventArgs.SelectUrl 속성

정의

Calendar 컨트롤에서 렌더링될 날짜가 선택될 때 서버에 페이지를 다시 게시하는 데 사용되는 스크립트를 가져옵니다.

public:
 property System::String ^ SelectUrl { System::String ^ get(); };
public string SelectUrl { get; }
member this.SelectUrl : string
Public ReadOnly Property SelectUrl As String

속성 값

String

렌더링될 날짜가 선택될 때 서버에 페이지를 다시 게시하는 데 사용되는 스크립트입니다.

예제

다음 코드 예제에서는 오늘 날짜에 대해 렌더링된 콘텐츠를 사용자 지정하는 방법을 보여 줍니다. 속성 값 SelectUrl 이 렌더링된 콘텐츠에 삽입되므로 Calendar 사용자가 오늘 날짜를 선택하면 컨트롤이 서버에 다시 게시됩니다.

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

  void ScheduleCalendar_DayRender(object sender, DayRenderEventArgs e)
  {
    // Customize the caption for today's date.
    if(e.Day.IsToday)
    {
      // Create the content to render for today's date. Use the 
      // SelectUrl property to retrieve the script used to post
      // the page back to the server when the user selects the
      // date.
      string dayContent = "<a href=\"" + e.SelectUrl +
        "\"><img border=\"0\" alt=\"Today\" src=\"today.jpg\"/></a>";
      
      // Display the custom content in the date cell. 
      e.Cell.Text = dayContent;
    }
    
  }
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <asp:calendar id="ScheduleCalendar"
        ondayrender="ScheduleCalendar_DayRender" 
        runat="server"/> 
    
    </form>
  </body>
</html>

<%@ Page Language="VB" %>

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

  Sub ScheduleCalendar_DayRender(ByVal sender As Object, ByVal e As DayRenderEventArgs) Handles ScheduleCalendar.DayRender
  
    ' Customize the caption for today's date.
    If e.Day.IsToday Then
    
      ' Create the content to render for today's date. Use the 
      ' SelectUrl property to retrieve the script used to post
      ' the page back to the server when the user selects the
      ' date.
      Dim dayContent As String = "<a href=""" & e.SelectUrl & _
        """><img border=""0"" alt=""Today"" src=""today.jpg""/></a>"
      
      ' Display the custom content in the date cell. 
      e.Cell.Text = dayContent
      
    End If
    
  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <asp:calendar id="ScheduleCalendar"
        runat="server"/> 
    
    </form>
  </body>
</html>

설명

렌더링되는 날짜가 SelectUrl 컨트롤에서 선택 Calendar 될 때 페이지를 서버에 다시 게시하는 데 사용되는 스크립트를 검색하려면 이 속성을 사용합니다. 이 속성은 일반적으로 날짜에 대해 렌더링된 콘텐츠를 사용자 지정하지만 포스트백 동작을 유지하려는 경우에 사용됩니다.

적용 대상

추가 정보