Solved

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

Posted on 2014-09-24
4
129 Views
Last Modified: 2014-09-26
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
0
Comment
Question by:javagair
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:javagair
ID: 40342707
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
0
 

Author Comment

by:javagair
ID: 40342711
would be nice to actually attach file
C--Users-garys-Downloads-ParameterProble
0
 
LVL 14

Accepted Solution

by:
dejaanbu earned 500 total points
ID: 40343311
I didnt check your full code. though, my suggestion is:

to pass ID parameter to SqlDatasource2, you have to do that in SQDatasource_Selecting event, just like
Protected Sub SqlDataSource2_Selecting(sender As Object, e As SqlDataSourceSelectingEventArgs)
    e.Command.Parameters("@IDs").Value = HERE GIVE YOUR IDs 
End Sub

Open in new window

AND, in your button click, just call CustomersGridView.DataBind()
no need for this line: CustomersGridView.DataSource = SqlDataSource2
0
 

Author Comment

by:javagair
ID: 40346504
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
0

Featured Post

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question