Link to home
Start Free TrialLog in
Avatar of javagair
javagairFlag for United States of America

asked on

how do I get gridview to only show up when I click a button

right now I have a asp:gridview in my html code and the datsource also in the html code.
the gridview calls the datasource and the grid shows up when the page loads.
but I need to fill the gridview with only a particular information connected with a textbox that has a soc. sec. number.  So the connection string would have to be in the on_click of a submit button.
example: web page opens with instructions to type in your soc. sec. number
                  click the submit button and the gridview will pop up with every day of the month for entering hours worked.
so if the gridview is a html tag how do I get it to delay till the textbox has been successfully filled?

thanks
gary
Avatar of javagair
javagair
Flag of United States of America image

ASKER

attached is my code
gridview  no longer shows up on load.

added a parameter to the asp:datasource----not sure it is right

table is filled with the correct info, but the grid does not show up.
when I click the fill table button it goes to the databind statement at the bottom of filltable function but no table.

datasource is at the bottom of html code.

It is like even though there is data in table I'm not calling the right query info.

thanks
gary
would be nice to actually attach file
C--Users-garys-Downloads-ParameterProble
ASKER CERTIFIED SOLUTION
Avatar of Deja Anbu
Deja Anbu
Flag of Oman image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
first I abandoned the connection to sql that I made through the studio and created my own.  This code fills the gridview.

dejaanbu

I have never liked letting the studio connect to a database.  Your comments lead to some thought about how this works.

thanks

gary
 sqldateinfo = "Select WorkDate, Startday, StartTime, Endtime, StartLunch, EndLunch, PtoDetail, PtoPaid, PtoUnPaid, CompanyPto, CompanyPtoPAID, SymitarCode from EmployeeAccuminfo where (WORKDATE >=  '" & dateString & "' AND WORKDATE <= '" & datestring2 & "') and EMPLOYEEID = '" & Dst.Tables("Dsthireinfo").Rows(0).Item(0).ToString() & "'   ORDER BY ID ASC "
       
        Dim adapter5 As SqlDataAdapter = New SqlDataAdapter(sqldateinfo, Connection)
        Connection.Open()
        adapter5.Fill(Dst, "Dstdateinfo")
        Connection.Close()
        If Dst.Tables("Dstdateinfo") Is Nothing OrElse Dst.Tables("Dstdateinfo").Rows.Count = 0 Then
        Else
           
            CustomersGridView.DataSource = Dst.Tables("DstDateinfo")
            CustomersGridView.DataBind()
           
        End If