View Single Post
  #7 (permalink)  
Old September 3rd, 2009, 02:28 PM
skhan skhan is offline
Authorized User
 
Join Date: Jun 2009
Posts: 66
Thanks: 22
Thanked 0 Times in 0 Posts
Default

Now I could change the data format into how I wanted it to be but I don't understand how to insert that into the Datagrid to display as such??

Code:
[ds is my dataset]
foreach (DataRow r in ds.Tables[0].Rows)
{
     string dateString1 = r["First_Resurvey_Date"].ToString(); 
    DateTime dateTime=Convert.ToDateTime(dateString1);
    string [] dateStringArray= dateTime.GetDateTimeFormats();

    r["First_Resurvey_Date"]= dateStringArray[6]; [This doesn't work, I cannot just assign the specific value to a datagrid row/cell......I need help on how to do that] [dateStringArray[6], gives the date format as dd-MMM-YY, which is how I want to display my date in the application]
                       
    NotesLabel.Text= dateStringArray[6];
    NotesLabel.Visible=true;
 }
DataView view = ds.Tables[0].DefaultView;
resultsDatagrid.DataSource = view;
resultsDatagrid.DataBind();
resultsDatagrid.Visible = true;
Thank you .
Reply With Quote