fomatting in dropdownlist box


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: fomatting in dropdownlist box

Hybrid View

  1. #1
    Hari Reddy Guest

    fomatting in dropdownlist box

    Here is my code for binding the data to dropdownlist box: Everything works
    fine

    but my date from sql returns as "4/1/1999 12:00:00 AM", I could not format
    this in my sql but having trouble in sorting order

    So I saw DataTextFormatString property: But I don't know how to use this to
    display my data as "4/1/1999" Can anybody help me.

    sqlString = "exec usp_pdflistreportsdatelist 'Reddy' "
    sqlClass.sqlExecute(sqlString, sqlreader) ' This is my sql class
    doing all the sql connections and stuff and returns datareader


    cmbReportDate.DataTextField = "reportdate"
    cmbReportDate.DataValueField = "reportdate"


    'cmbReportDate.DataTextFormatString() ????????????


    sqlClass.sqlExecute(sqlString, sqlreader)
    cmbReportDate.DataSource = sqlreader
    cmbReportDate.DataBind()

    Thanks

    Hari.




  2. #2
    DT Guest

    Re: fomatting in dropdownlist box


    Hari,

    Set the formatting for Short Date format by using {0:d}.

    cmbReportDate.DataTextFormatString = "{0:d}"

    DT

    "Hari Reddy" <reddy@uif.uillinois.edu> wrote:
    >Here is my code for binding the data to dropdownlist box: Everything works
    >fine
    >
    >but my date from sql returns as "4/1/1999 12:00:00 AM", I could not format
    >this in my sql but having trouble in sorting order
    >
    >So I saw DataTextFormatString property: But I don't know how to use this

    to
    >display my data as "4/1/1999" Can anybody help me.
    >
    >sqlString = "exec usp_pdflistreportsdatelist 'Reddy' "
    >sqlClass.sqlExecute(sqlString, sqlreader) ' This is my sql class
    >doing all the sql connections and stuff and returns datareader
    >
    >
    >cmbReportDate.DataTextField = "reportdate"
    >cmbReportDate.DataValueField = "reportdate"
    >
    >
    >'cmbReportDate.DataTextFormatString() ????????????
    >
    >
    >sqlClass.sqlExecute(sqlString, sqlreader)
    >cmbReportDate.DataSource = sqlreader
    >cmbReportDate.DataBind()
    >
    >Thanks
    >
    >Hari.
    >
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center