2
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, but I want to search my data through the information informed 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 is giving the error: String was not recognized as valid Datetime.
Can’t get the idea of your example and implement in my code.
– user2254936
Do so:
DateTime dataa; DateTime.TryParse(TextBoxDataInicio.Text + " " + TextBoxHoraInicio.Text, out dataa);
, when executing the values will be concatenated and played to the variabledataa
.– Bruno Casali
In your example wheel cool, now in my code that is bone to implement.
– user2254936
take a look there... D
– Bruno Casali
In the code passed beauty, but when I click the search button of my screen displays the question error. Would you have any more suggestions than I can make? Or would you like me to edit my question with more information
– user2254936
Dude, I think in my example I missed one more space that I forgot to put. Test again please!
– Bruno Casali
So, I implemented the code and no longer presents the error. However, it is not filtering through the filter informed in the textbox.
– user2254936
It worked now, I had a wrong deal on my property Itemtemplate. It was worth too !!!
– user2254936