Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Willie Howell   on Oct 19 In Asp.net Category.

  
Question Answered By: Michael Evans   on Oct 19

Yes,
it´s c#
i have to compare the value of a textbox with the day in a datetime field.

this.DIA_RETIRADA.Text == this.ObjReserva.AgRetirada.DtRetirada.ToString("dd")

but in some cases, i need to know if the "DtRetirada" exists otherwise i get an
error:

reference set to a non object  , in that line.

so, i tryed this:


if( this.ObjReserva.AgDevolucao.DtDevolucao != null &&
this.ObjReserva.AgDevolucao.DtDevolucao.ToString("dd/MM/yyyy HH:mm") != ""){

this.DATA_HORA_DEVOLUCAO.Text =
this.ObjReserva.AgDevolucao.DtDevolucao.ToString("dd/MM/yyyy HH:mm");

this.DATA_HORA_DEVOLUCAO.Visible = true;

}

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 


Tagged: