Morning,
I'm currently working on a web app that utilizes the datagrid data component. So, first I created a table, inserted a few textboxes, labels and one datagrid. I then edited the columns for the datagrid using the propoerties manager. Lastly, I added the following code to bind the data to the datagrid:
Private Sub Page_Load
connstr = ConfigurationSettings.AppSettings("DBBASE")
myConn = New OleDbConnection(connstr)
ODA = New OleDbDataAdapter("Select * From LifeTable", myConn)
ODA.Fill(ds, "Life Offer")
dgQuote.Datasource = ds
dgQuote.DataBind()
End Sub
As you can see dgQuote is my datagrid but I wish to know two things:
1. When the page loads, the datagrid displays but the textboxes and labels are not visible (yes, I've checked their properties). But when I take the dgQuote.DataBind() statement out, the textboxes and labels appear but the datagrid does not appear (I would think because it has no data in it). My first question is why is this happening?? Is there a setting I'm missing??
2. When the statement dgQuote.DataBind() is left in, the datagrid appears filled with data but the datagrid contains columns for every field in the database table. How can I edit which columns to show and which ones not to, I know in my windows apps I could use the DataGridTableStyle but apparently, it is not available in the web app.
Appreciate any help anyone can provide.