Walter, again, thanks for responding.
Looks like my binding failue was due to some previous state of the GridView.
after I dropped a fresh GridView your code worked fine.
BUT, that's not really what I am getting at....
I not only want to bind in code but I want to set all the Enable Editing,
Deleting, Selection, Paging, Sorting features in code but I can't see how to
EnableEditing at run time.
I tried to drop a new GridView on the page and then, at design time, added
the Edit and Delete buttons. then bound it at run time but when I hit an
Edit button I got an exception saying "GridView1 fired event RowEditing
which was not handled.
The answer to WHY do I want to do this is because I would like to have one
GridView on the form that will update a number of datasources depending upon
selections by the user.
--
Regards,
Gary Blakely
"Walter Wang [MSFT]" <wa****@online.microsoft.comwrote in message
news:g%******************@TK2MSFTNGXA01.phx.gbl...
Hi Gary,
Thank you for your post.
This behavior is by design. Normally when you are using declarative
databinding, you set datasource using DataSourceID; when you are setting
datasource at runtime, you set it using DataSource and call DataBind:
GridView1.DataSource = ObjectDataSource1;
GridView1.DataBind();
Hope this helps. Please feel free to post here if anything is unclear.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.