Modifying Data in a GridView Web Server Control

Modifying Data in a GridView Web Server Control

am 31.03.2008 02:52:31 von GaryDean

The title of this post is the subject of an MSDN article at:
http://msdn2.microsoft.com/en-us/library/c4245bb4(VS.80).asp x

The article describes generating a sqldatasource that has select, update,
delete, and insert statments and basically accomplishing maintenance through
a datagrid with no coding. The problem is that, like earlier 1.1 articles,
it doesn't work. The edit button opens up a textbox and allows a new entry
but no update occurs.

Back in 1.1 we had to execute the stored procedures ourselves in code in the
rowcommand event.

Do we still have to do it the old fashioned way or does the gridview
actually somehow have this advertised updating capability?
Thanks,
Gary

RE: Modifying Data in a GridView Web Server Control

am 31.03.2008 06:45:45 von stcheng

Hi Gary,

As for .NET 2.0 GridView (or DataGrid) that associate with DataSource
control, it does support AD hoc data access such as query, update, delete
without writing code. Actually, it is easy to perform such a task through
a simple database table. e.g.

** drag a data source control onto the page and configure it, make sure you
choose generate update/insert/delete query together with select query

** drag a gridview on to page and bind to the datasource control added
previously

** in the Gridview action list, choose to enable "Editing", "Deleting"

then, run the page, you should be able to select, edit, delete records.
This is just for very simple AD HOC scenarios. Are you encoutering any
particular error when running the page?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/de fault.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx .
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "GaryDean"
>Subject: Modifying Data in a GridView Web Server Control
>Date: Sun, 30 Mar 2008 17:52:31 -0700

>The title of this post is the subject of an MSDN article at:
>http://msdn2.microsoft.com/en-us/library/c4245bb4(VS.80).as px
>
>The article describes generating a sqldatasource that has select, update,
>delete, and insert statments and basically accomplishing maintenance
through
>a datagrid with no coding. The problem is that, like earlier 1.1
articles,
>it doesn't work. The edit button opens up a textbox and allows a new
entry
>but no update occurs.
>
>Back in 1.1 we had to execute the stored procedures ourselves in code in
the
>rowcommand event.
>
>Do we still have to do it the old fashioned way or does the gridview
>actually somehow have this advertised updating capability?
>Thanks,
>Gary
>
>
>
>