title: How can my GridView Refresh using two Textbox and a Button Using VB ,Asp and ORACLE
body: <p>I've been trying to refresh a GridView when two textbox set me the range then click Search, and returns me the columns in that range.</p>
  <p>But the thing is, in first load the GridView fills up with all the columns, that works fine but when I click search button doesn't refresh at all, it just stays the same.</p>
  <pre><code>                        &lt;asp:UpdatePanel runat=&quot;server&quot; UpdateMode=&quot;Conditional&quot;&gt;
                          &lt;ContentTemplate&gt;
                              &lt;asp:GridView CssClass=&quot;table&quot; AllowSorting=&quot;true&quot; HeaderStyle-HorizontalAlign=&quot;Center&quot; EmptyDataText=&quot;No hay pendientes.&quot; CellPadding=&quot;10&quot; HeaderStyle-CssClass=&quot;bg-primary p-2 text-dark bg-opacity-25&quot; runat=&quot;server&quot; ID=&quot;gvBitacora&quot; AutoGenerateColumns=&quot;false&quot;&gt;
                                  &lt;Columns&gt;
                                      &lt;asp:BoundField DataField=&quot;cvebitacora&quot; HeaderText=&quot;No&quot; ItemStyle-Font-Bold=&quot;true&quot; ItemStyle-Width=&quot;3%&quot; ItemStyle-HorizontalAlign=&quot;Center&quot; /&gt;
                                      &lt;asp:TemplateField HeaderText=&quot;Formulario No.&quot; ItemStyle-Width=&quot;10%&quot; ItemStyle-HorizontalAlign=&quot;Center&quot;&gt;
                                          &lt;ItemTemplate&gt;
                                              &lt;%# String.Format(&quot;{0}-{1}&quot;, Eval(&quot;cveano&quot;), Eval(&quot;cvenumero&quot;))%&gt;
                                          &lt;/ItemTemplate&gt;
                                      &lt;/asp:TemplateField&gt;
  
                                      &lt;asp:BoundField DataField=&quot;cveusuario&quot; HeaderText=&quot;Usuario&quot; ItemStyle-Width=&quot;10%&quot; ItemStyle-HorizontalAlign=&quot;Center&quot; /&gt;
                                      &lt;asp:BoundField DataField=&quot;cveestado&quot; HeaderText=&quot;Estado&quot; ItemStyle-Width=&quot;10%&quot; ItemStyle-HorizontalAlign=&quot;Center&quot; /&gt;
                                      &lt;asp:BoundField DataField=&quot;observacion&quot; HeaderText=&quot;Observación&quot; ItemStyle-Width=&quot;10%&quot; ItemStyle-HorizontalAlign=&quot;Center&quot; /&gt;
                                      &lt;asp:BoundField DataField=&quot;fechaaccion&quot; HeaderText=&quot;Fecha&quot; DataFormatString=&quot;{0:dd/ MM/ yyyy}&quot; ItemStyle-Width=&quot;10%&quot; ItemStyle-HorizontalAlign=&quot;Center&quot; /&gt;
                                      &lt;asp:TemplateField HeaderText=&quot;Revisión&quot; ItemStyle-Width=&quot;10%&quot; ItemStyle-HorizontalAlign=&quot;Center&quot;&gt;
                                          &lt;ItemTemplate&gt;
                                              &lt;asp:LinkButton ID=&quot;btnVer&quot; CssClass=&quot;btn btn-primary&quot; runat=&quot;server&quot; CommandName=&quot;btnVer&quot; CommandArgument=&quot;&lt;%# Container.DataItemIndex %&gt;&quot;&gt;Ver &lt;i class='far fa-eye'&gt;&lt;/i&gt;&lt;/asp:LinkButton&gt;
                                          &lt;/ItemTemplate&gt;
                                      &lt;/asp:TemplateField&gt;
                                  &lt;/Columns&gt;
                              &lt;/asp:GridView&gt;
                          &lt;/ContentTemplate&gt;
                      &lt;/asp:UpdatePanel&gt;
  </code></pre>
  <p>And here the Button Click in VB</p>
  <pre><code>    Private Sub btnBuscar_Click(sender As Object, e As EventArgs) Handles btnBuscar.Click
      Dim user As User = CType(Session.Item(&quot;user&quot;), User)
      Dim oBLBitacora As New BLBitacora
      Dim lBitacora, lBitacora2 As New List(Of Bitacora)
      If user.cverol = 2 Then
          If panelsStayOpen_headingOne.Checked = True Then
              lBitacora = oBLBitacora.BitacorasGetDate(dateFechaInicio.Text, dateFechaFinal.Text)
              gvBitacora.DataSource = lBitacora
              gvBitacora.DataBind()
          End If
  
      ElseIf user.cverol = 3 Then
          lBitacora = oBLBitacora.BitacorasGet(2)
          gvBitacora.DataSource = lBitacora
          gvBitacora.DataBind()
      End If
      End Sub
  </code></pre>
  <p><a href="https://i.stack.imgur.com/YhAIk.png" rel="nofollow noreferrer">GridView on first load</a></p>
  <p>PAGE LOAD</p>
  <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      Dim user As User = CType(Session.Item(&quot;user&quot;), User)
      Dim oBLBitacora As New BLBitacora
      Dim lBitacora, lBitacora2 As New List(Of Bitacora)
  
      If Not IsPostBack Then
          If user.cverol = 2 Then
              lBitacora = oBLBitacora.BitacorasGet(1)
              gvBitacora.DataSource = lBitacora
              gvBitacora.DataBind()
          ElseIf user.cverol = 3 Then
              lBitacora = oBLBitacora.BitacorasGet(2)
              gvBitacora.DataSource = lBitacora
              gvBitacora.DataBind()
          End If
      Else
          If panelsStayOpen_headingOne.Checked = True Then
              panelsStayOpen_headingOne.Attributes(&quot;class&quot;) = &quot;form-check-input&quot;
              panelsStayOpen_headingOne.Attributes(&quot;aria-expanded&quot;) = &quot;true&quot;
              panelsStayOpen_collapseOne.Attributes(&quot;class&quot;) = &quot;accordion-collapse collapse show&quot;
          Else
              panelsStayOpen_headingOne.Attributes(&quot;class&quot;) = &quot;collapsed form-check-input&quot;
              panelsStayOpen_headingOne.Attributes(&quot;aria-expanded&quot;) = &quot;false&quot;
              panelsStayOpen_collapseOne.Attributes(&quot;class&quot;) = &quot;accordion-collapse collapse&quot;
          End If
      End If
  </code></pre>