Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with. 
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         osirisa 
                                        Constraint Violating Yak Guru 
                                         
                                        
                                        289 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2008-03-13 : 11:48:40
                                            
  | 
                                             
                                            
                                            | Hi Group:The Below is the code for the User Control that contains a Calendar. The Calendar has a textbox  at the top.  Right Now the Textbox is set to show mm/dd/yyyy.  I need to find a way to set this textbox to the current day same as the day selected automatically in the calendar. Any help-----It's deeply appreciate it....Thank you all...<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Test.ascx.vb" Inherits="Test" %><asp:textbox id="txtDate" runat="server" Width="84px" Enabled="False">mm/dd/yyyy</asp:textbox><asp:ImageButton id="ibCalendar" runat="server" ImageUrl="~/App_Themes/SWN/images/IconCalendar.gif"></asp:ImageButton><asp:Panel ID="panel1" Visible="False" Width="16px" Runat="server" Height="120px">	<asp:calendar id="Calendar1" Width="168px" runat="server" Height="72px" BackColor="White" DayNameFormat="FirstLetter"		ForeColor="Black" Font-Size="8pt" Font-Names="Verdana" BorderColor="#999999" CellPadding="4">		<TodayDayStyle ForeColor="Black" BackColor="#CCCCCC"></TodayDayStyle>		<SelectorStyle BackColor="#CCCCCC"></SelectorStyle>		<DayStyle BorderColor="Red"></DayStyle>		<NextPrevStyle VerticalAlign="Bottom"></NextPrevStyle>		<DayHeaderStyle Font-Size="7pt" Font-Bold="True" BackColor="#CCCCCC"></DayHeaderStyle>		<SelectedDayStyle Font-Bold="True" ForeColor="White" BackColor="#666666"></SelectedDayStyle>		<TitleStyle Font-Bold="True" BorderColor="Black" BackColor="#999999"></TitleStyle>		<WeekendDayStyle BackColor="Desktop"></WeekendDayStyle>		<OtherMonthDayStyle ForeColor="Gray"></OtherMonthDayStyle>	</asp:calendar></asp:Panel> | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     jsmith8858 
                                    Dr. Cross Join 
                                     
                                    
                                    7423 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-03-13 : 12:05:41
                                          
  | 
                                         
                                        
                                          | The calendar has a SelectedDate property.   When the calendar's selection changes (you need to create an event handler for this) simple set the txtDate's Text property to a nicely formatted string using the calendar's SelectedDate.If you have trouble with this, then you really should be brushing up on the basics of ASP.NET -- handling events, setting control properties, handling postbacks, and so on.Also, see this:http://www.startvbdotnet.com/aspsite/controls/calendar.aspxGoogle has tons of examples if you search.- Jeffhttp://weblogs.sqlteam.com/JeffS  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     osirisa 
                                    Constraint Violating Yak Guru 
                                     
                                    
                                    289 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-03-13 : 13:17:28
                                          
  | 
                                         
                                        
                                          | Thank you jsmith8858  --- I got it....I will post it for future users.artial Class Test    Inherits System.Web.UI.UserControl    Private m_enabled As Boolean = True    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        'Put user code to initialize the page here        Me.txtDate.Text = Now.Date()    End Sub    Public Property SelectedDate() As String        Get            Return Me.txtDate.Text        End Get        Set(ByVal Value As String)            Me.txtDate.Text = Value        End Set    End Property    Public Property Enabled() As Boolean        Get            Return m_enabled        End Get        Set(ByVal Value As Boolean)            Me.txtDate.Enabled = Value            Me.ibCalendar.Enabled = Value            m_enabled = Value        End Set    End Property    Private Sub Calendar1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged        Me.txtDate.Text = Calendar1.SelectedDate.ToShortDateString        Me.panel1.Visible = False    End Sub    Private Sub ibCalendar_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibCalendar.Click        If Me.panel1.Visible = False Then            Me.panel1.Visible = True        Else            Me.panel1.Visible = False            'Me.txtDate.Text = Calendar1.SelectedDate.ToShortDateString        End If    End Sub    Private Sub txtDate_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDate.TextChanged        Me.txtDate.Text = Calendar1.SelectedDate.ToShortDateString    End SubEnd ClassThank You all ---- Enjoy  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     jsmith8858 
                                    Dr. Cross Join 
                                     
                                    
                                    7423 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2008-03-13 : 13:27:30
                                          
  | 
                                         
                                        
                                          | Why is your SelectedDate property a string???? Always use the correct data types, whether it is SQL or .NET ... That is the #1 most basic, simple and important rule when designing a database or an application.- Jeffhttp://weblogs.sqlteam.com/JeffS  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |   
     
     
            
              
	     |  
		
			
     
          
		 |