protected void ButtonPesquisar_Click(object sender, EventArgs e)
{
var _macro = new LFSistemas.VLI.ACTWeb.Entities.Macro();
var macroController = new MacroController();
var itens = macroController.ObterTodos(new Entities.FiltroMacro()
{
//DataInicio = Convert.ToDateTime(TextBoxDataInicio.Text + "" + TextBoxHoraInicio.Text),
//DataFim = Convert.ToDateTime(TextBoxHoraFim.Text + "" + TextBoxHoraFim.Text),
DataInicio = new DateTime(2013, 08, 12, 20, 10, 00),
//DateTime.Now.AddSeconds(10)
DataFim = new DateTime(2013, 08, 12, 20, 30, 00)
});
Today my code is running this way, however I am looking to search my data through the information entered in the textBox.
<div class="row">
<div class="form-group col-lg-2 col-md-5 col-sm-5 col-xs-12">
<label for="data_inicio">Data Inicio</label>
<asp:TextBox ID="TextBoxDataInicio" runat="server" CssClass="form-control"></asp:TextBox>
</div>
<div class="form-group col-lg-2 col-md-5 col-sm-5 col-xs-12">
<label for="hora_inicio">Hora Inicio</label>
<asp:TextBox ID="TextBoxHoraInicio" runat="server" CssClass="form-control"></asp:TextBox>
</div>
<div class="form-group col-lg-2 col-md-5 col-sm-5 col-xs-12">
<label for="data_fim">Data Fim</label>
<asp:TextBox ID="TextBoxDataFim" runat="server" CssClass="form-control"></asp:TextBox>
</div>
<div class="form-group col-lg-2 col-md-5 col-sm-5 col-xs-12">
<label for="hora_fim">Hora Fim</label>
<asp:TextBox ID="TextBoxHoraFim" runat="server" CssClass="form-control"></asp:TextBox>
</div>
<div class="form-group col-lg-4 col-md-12 col-sm-12 col-xs-12 text-align-right">
<asp:LinkButton ID="LinkButton1" runat="server" class="btn btn-link pro-btn inline-button ajustar-lg" OnClick="LinkButton1_Click">Limpar</asp:LinkButton>
<asp:Button ID="ButtonPesquisar" CssClass="btn btn-primary pro-btn inline-button ajustar-lg" runat="server" Text="Pesquisar" OnClick="ButtonPesquisar_Click" />
</div>
</div>
I tried to implement the way you are commenting but you are giving the error: String was not recognized as a valid DateTime.