1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

If text control value is date then make the image visible

Discussion in 'C#' started by techie2013, Aug 8, 2013.

  1. #1
    I posted a thread in the javascript forum requesting a solution for this issue but now I am thinking it would be easier to resolve this with C# code.

    The application I am trying to fix allows users to build report queries by selecting report criteria fields from drop downs. These fields are a mix of date values and other values. There are 5 text box controls (IDs- txtBox0, txtBox1,...txtBox5) and there are 5 datepicker controls (cal0.. cal5).Datepicker controls are hidden. When the Retrieve Query button is clicked, FillSavedReportQueryFields method is fired and it populates the criteria fields with values. If the criteria field value populated by the method is date, then I want to make the datepicker control visible. Otherwise, hidden.

    I am guessing that I need to add a few lines of code to the FillSavedReportQueryFields method so that after the values are populated in those fields, the new C# code will check if those values are dates. If yes, then it will make calendar icon (datepicker control) visible else hidden.

    I can provide further details or answer question. Hope there is a quick and easy solution for this.
    SEMrush
    I would like to thank you for reading this and if you have some ideas that you would like to share then I would very much appreciate that. I am just learning the programming. So making this happen is a big deal : )
     
    techie2013, Aug 8, 2013 IP
    SEMrush
  2. jamieellis

    jamieellis Active Member

    Messages:
    427
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Would this not do it?

    Datepicker.Visible = SomeTextBox.Text.Length > 0
     
    jamieellis, Aug 23, 2013 IP
  3. SHASHI BHUSHAN

    SHASHI BHUSHAN Greenhorn

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #3
    Use following code.. I believe it will help you
    DateTime dateValue;
    if (DateTime.TryParse(SomeTextBox.Text, out dateValue))
    {
    SomeCal.Visible= true;
    }
     
    SHASHI BHUSHAN, Sep 12, 2013 IP