Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 22nd, 2004, 01:58 PM
Authorized User
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default datatable/datagrid

I have a datagrid bound to a datatable...

i want to delete the selected row from the datagrid from the datatable and bind it again...

please show an eg of how to do that...

is there a way to construct a datatable from a dataset.

thank you

 
Old September 23rd, 2004, 10:59 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

A DataSet contains DataTables. That's where the data in the DataSet lives.
 
Old September 23rd, 2004, 11:12 AM
Authorized User
 
Join Date: Sep 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

say i bind a datatable to a datagrid....
I want to know

if i can construct the datatable back from the datagrid..

like Datatable dt=(DataTable)datagrid1.DataSource;

i know this is not possible something like this...
i know i can store it in session variable...but is there anyother way so that i don't have to store it in session variable..


 
Old September 23rd, 2004, 11:18 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Usually, the way I approach this with a web application is to construct a SQL call to my database with the details needed for the delete. You can store a key field in the datagrid when you bind it. This way, when the user choose and row and clicks the delete button, you retrieve the key value from the datagrid (datagrid.DataKeys[rowindex]) and use that in your delete SQL statement. Then you execute the delete statement and requery the data to display in the grid. This is how most of the examples and demos I have found work as well. Do some searching for some ASP.NET database tutorials and you should be able to find all of these details with example code.
 
Old September 23rd, 2004, 11:51 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,
Take a look at this,
http://p2p.wrox.com/topic.asp?TOPIC_ID=16854
it could help you in more detail.

--------------------------------------------
Mehdi.:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Datatable Limno .NET Framework 1.x 0 May 28th, 2008 02:37 PM
Problem with DataTable ayazhoda ASP.NET 1.x and 2.0 Application Design 1 April 8th, 2007 10:12 PM
Datagrid + datatable edukulla C# 2005 2 September 11th, 2006 04:53 PM
DataTable from DataGrid.DataSource Jamal Junior ASP.NET 2.0 Basics 1 March 24th, 2006 01:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.