Results 1 to 5 of 5

Thread: Custom DatePicker Control

  1. #1

    Thread Starter
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861

    Custom DatePicker Control

    I am creating a custom datepicker and everything is working fine except. I can't seem to access the textboxes clientID.

    In my custom control I have a textbox and an image, which is a link.
    I need to pass the textboxes ClientID with this link, but I can't seem to get it.

    Here's my code
    VB Code:
    1. Protected Overrides Sub CreateChildControls()
    2.         Controls.Clear()
    3.  
    4.         JHATextBox = New TextBox
    5.         JHATable = New Table
    6.         JHARow = New TableRow
    7.         JHATextCell = New TableCell
    8.         JHAEmptyCell = New TableCell
    9.         JHAImageCell = New TableCell
    10.  
    11.         JHATextCell.Controls.Add(JHATextBox)
    12.         [color=red]JHAImageCell.Text = "<a href=""javascript:LookupDate(Form1, " & Me.JHATextBox.ClientID & ", document.forms[0]." & Me.JHATextBox.ClientID & ".value)""><img alt=""Show Calendar"" src=""/Common/images/btn_calendar.gif"" border=""0"">"[/color]
    13.         JHARow.Cells.Add(JHATextCell)
    14.         JHARow.Cells.Add(JHAEmptyCell)
    15.         JHARow.Cells.Add(JHAImageCell)
    16.         JHATable.Rows.Add(JHARow)
    17.  
    18.         Controls.Add(JHATable)
    19.     End Sub
    I have tried JHATextBox.ClientID as well, but I still can't get the clientID of the textBox control.

    Any ideas?
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  2. #2

    Thread Starter
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    I got it fixed. I couldn't access the ClientID (UniqueID) until the control was added to the page, so I had to modify the code to this and replace ClientID with UniqueID.
    VB Code:
    1. Protected Overrides Sub CreateChildControls()
    2.         Controls.Clear()
    3.  
    4.         JHATextBox = New TextBox
    5.         JHATable = New Table
    6.         JHARow = New TableRow
    7.         JHATextCell = New TableCell
    8.         JHAEmptyCell = New TableCell
    9.         JHAImageCell = New TableCell
    10.  
    11.         JHARow.Cells.Add(JHATextCell)
    12.         JHARow.Cells.Add(JHAEmptyCell)
    13.         JHARow.Cells.Add(JHAImageCell)
    14.         JHATable.Rows.Add(JHARow)
    15.  
    16.         Controls.Add(JHATable)
    17.  
    18.         JHATextCell.Controls.Add(JHATextBox)
    19.         JHAImageCell.Text = "<a href=""java script:LookupDate(Form1, " & JHATextBox.UniqueID & ", document.forms[0]." & JHATextBox.UniqueID & ".value)""><img alt=""Show Calendar"" src=""/Common/images/btn_calendar.gif"" border=""0"">"
    20.  
    21. End Sub
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    lol, your calendar control is starting to look like mine... (patent pending )



  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    I posted a thread in here that I want people to look at our web app, use the supplied login, click event/shift logs, and you will be able to see the usability of our control..

    You can press space on an empty field and it will fill in the current date...etc

  5. #5

    Thread Starter
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    Close!
    Mine has a textbox with a calendar image next to it, that when clicked opens a new window with a .NET calendar control.

    Attached Images Attached Images  
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width