DataGrid Won't come back

T

Tina

(please ignore my earlier post - it apparently had nothing to do with it
being in an ascx control)

I have, dozens of times, displayed datagrids, datasourced by an .xsd
dataset, with textboxes in template columns and always been able to spin
through those grids on, say a button click event.

In a new project I am dynamicaly populating the datagrid columns, after
which I retrieve data and do the following...

da.fill(DataSet1) 'this is an untyped dataset
dg.datasource = DataSet1
dg.Databind()

At this point my datagrid displays exactly like I want it to.

BUT, on the button click event (which occurs after the user might changes
some fields) my datagrid is empty!!!!

This brings up a question: How was it that I am able to get the grid back in
my other dozen programs where the grid is datasourced by a .xsd dataset?
Why doesn't the grid contents (as changed by the user) exist in the click
event?
Thanks,
T
 
T

Tina

Do you mean in the Page_Load event if isPostBack is true?
I have never done that before in any of my successful program but I tried it
anyway in this one but nothing was changed. Everything that was built in
the grid is gone.

T
 
S

Scott M.

No, not in the Postback. In the event handler that caused the postback.
What button is being clicked that causes the grid to postback to the server
(Edit, Delete, Update, Cancel)? That's where you need it.
 
S

Scott M.

....And, is the grid's data source property being set in Page_Load (but
outside of the If Not IsPostBack statement?
 
T

Tina

Scott:
Thanks for the help but I have now found that if I check the "Create columns
automatically at run time" checkbox in the datagrid property builder, the
data grid is there on the click event without having to do anything else.

So, I've made progress on my problem and made a new post about the Columns
collection not being there in this case.

Thanks,
T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top