Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Date type

Date type

Scheduled Pinned Locked Moved ASP.NET
question
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MrRhodos
    wrote on last edited by
    #1

    How can I change the date type of a textbox in a Formview? Thanks.

    S C A 3 Replies Last reply
    0
    • M MrRhodos

      How can I change the date type of a textbox in a Formview? Thanks.

      S Offline
      S Offline
      sashidhar
      wrote on last edited by
      #2

      MrRhodos wrote:

      How can I change the date type of a textbox

      Plz Can You Explain In Brief..!

      MyFirstArticle MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.

      1 Reply Last reply
      0
      • M MrRhodos

        How can I change the date type of a textbox in a Formview? Thanks.

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        What do you mean ? A text box contains text. You can put a date in there, but only by rendering it as text. Your question makes no sense.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        M 1 Reply Last reply
        0
        • C Christian Graus

          What do you mean ? A text box contains text. You can put a date in there, but only by rendering it as text. Your question makes no sense.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          M Offline
          M Offline
          MrRhodos
          wrote on last edited by
          #4

          I know. At the moment the text box contains a date rendered as text, but it is a date field in SQL DB. At the moment the format is "date time" and I want to change it to only "date".

          S 1 Reply Last reply
          0
          • M MrRhodos

            I know. At the moment the text box contains a date rendered as text, but it is a date field in SQL DB. At the moment the format is "date time" and I want to change it to only "date".

            S Offline
            S Offline
            sashidhar
            wrote on last edited by
            #5

            MrRhodos wrote:

            and I want to change it to only "date".

            CG Is Correct .! Please try To ask the Question In Brief..! It Is Nothing to do with TextBox .In PageLoad.You Have to change the value of Date From Db and convert it into Your Fomat and Display it in TextBox

            MyFirstArticle MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.

            M 1 Reply Last reply
            0
            • S sashidhar

              MrRhodos wrote:

              and I want to change it to only "date".

              CG Is Correct .! Please try To ask the Question In Brief..! It Is Nothing to do with TextBox .In PageLoad.You Have to change the value of Date From Db and convert it into Your Fomat and Display it in TextBox

              MyFirstArticle MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.

              M Offline
              M Offline
              MrRhodos
              wrote on last edited by
              #6

              Now we are getting somewhere.. You understood my question. :-) I am a beginner, so you could please tell what kind of code I need and where I have to put it? I guees it is to be placed under scripts and look a bit like:

              Protected Sub ProjektstartdatoTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)

              ::code::

              End Sub

              Thanks for your help.

              S 1 Reply Last reply
              0
              • M MrRhodos

                Now we are getting somewhere.. You understood my question. :-) I am a beginner, so you could please tell what kind of code I need and where I have to put it? I guees it is to be placed under scripts and look a bit like:

                Protected Sub ProjektstartdatoTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)

                ::code::

                End Sub

                Thanks for your help.

                S Offline
                S Offline
                sashidhar
                wrote on last edited by
                #7

                Use The Database query for retriving the data Fron DataBase as a date format

                CONVERT (VARCHAR,u.[dob] ,101) AS dob

                And Bind the Data to the Textbox in the FormView Like

                <asp:TextBox ID="DateOfBirth" runat="server" Text='<%# Bind("dob") %>'></asp:TextBox>

                and in pageload Bind the Source

                MrRhodos wrote:

                I am a beginner

                Please try To Read a Good Book For FormView Control

                MyFirstArticle MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.

                M 1 Reply Last reply
                0
                • M MrRhodos

                  How can I change the date type of a textbox in a Formview? Thanks.

                  A Offline
                  A Offline
                  Abhishek Sur
                  wrote on last edited by
                  #8

                  Convert your date to proper format which is understood by sql server. use DateTime.Parse I think it would be better to understand your requirement if you could make more clear sentence. :rose:

                  Abhishek Sur


                  My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

                  **Don't forget to click "Good Answer" if you like to.

                  1 Reply Last reply
                  0
                  • S sashidhar

                    Use The Database query for retriving the data Fron DataBase as a date format

                    CONVERT (VARCHAR,u.[dob] ,101) AS dob

                    And Bind the Data to the Textbox in the FormView Like

                    <asp:TextBox ID="DateOfBirth" runat="server" Text='<%# Bind("dob") %>'></asp:TextBox>

                    and in pageload Bind the Source

                    MrRhodos wrote:

                    I am a beginner

                    Please try To Read a Good Book For FormView Control

                    MyFirstArticle MenuControlSelectedItem Why Do Some People Forget To Mark as Answer .If It Helps.

                    M Offline
                    M Offline
                    MrRhodos
                    wrote on last edited by
                    #9

                    It was much easier than that, but thanks for your help. <%# Bind("dob","{0:d}") %> And you are right about the book, it would probably help a lot.

                    C 1 Reply Last reply
                    0
                    • M MrRhodos

                      It was much easier than that, but thanks for your help. <%# Bind("dob","{0:d}") %> And you are right about the book, it would probably help a lot.

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #10

                      MrRhodos wrote:

                      And you are right about the book, it would probably help a lot.

                      But, you get to keep your job either way, so you're not going to bother learning ASP.NET, right ?

                      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups