Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > can't update a GridView asp.net 2.0

Reply
Thread Tools

can't update a GridView asp.net 2.0

 
 
rob merritt
Guest
Posts: n/a
 
      03-04-2005
Hi

I am trying to update via an datagrid only nothing seems to happen
how would I diplay what the update query looks like msgbox
reponse.write? where do I put em?

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">
void DetailsView1_ItemUpdated(Object sender,
DetailsViewUpdatedEventArgs e)
{
GridView1.DataBind();
}
void DetailsView1_ItemInserted(Object sender,
DetailsViewInsertedEventArgs e)
{
GridView1.DataBind();
}
void DetailsView1_ItemDeleted(Object sender,
DetailsViewDeletedEventArgs e)
{
GridView1.DataBind();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Editing Access Database</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AccessDataSource ID="AccessDataSource1" Runat="server"
DataFile="data\pubs.mdb"
SelectCommand="select * from [authors],[books] where au_id
= author_key" >
</asp:AccessDataSource>
<asp:GridView ID="GridView1" Runat="server" AllowPaging="True"
AllowSorting="True" DataSourceID="AccessDataSource1"
DataKeyNames="au_id" AutoGenerateSelectButton="True">
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource2" Runat="server"
DataFile="data\pubs.mdb"
SelectCommand="select * from [authors],[books] where au_id
= author_key"
DeleteCommand="DELETE FROM [authors] WHERE [au_id] = ?"
UpdateCommand="UPDATE [books] SET [book_title] = ? WHERE
[author_key] = ?"
InsertCommand="INSERT INTO [authors] ([au_id], [au_lname],
[au_fname], [phone], [address], [city], [state], [zip], [contract],
[author_key], [book_title]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
FilterExpression="au_id='@au_id'">
<FilterParameters>
<asp:ControlParameter Name="au_id"
ControlID="GridView1"
PropertyName="SelectedValue"></asp:ControlParameter>
</FilterParameters>
</asp:AccessDataSource>
<aspetailsView ID="DetailsView1" Runat="server"
AutoGenerateDeleteButton="True"
AutoGenerateEditButton="True"
DataSourceID="AccessDataSource2" DataKeyNames="au_id"
AutoGenerateInsertButton="True"
onitemupdated="DetailsView1_ItemUpdated"
oniteminserted="DetailsView1_ItemInserted"
onitemdeleted="DetailsView1_ItemDeleted">
</aspetailsView>
</div>
</form>
</body>
</html>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update On The Windows Phone 7 Update Update Lawrence D'Oliveiro NZ Computing 2 02-25-2011 08:03 AM
GridView Update doesn't update on first postback Evan M. ASP .Net 1 04-18-2007 03:32 PM
1 global update button to update all rows in Gridview mesut ASP .Net 0 02-19-2007 02:00 PM
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
GridView in a GridView Nalaka ASP .Net 6 12-05-2005 05:48 PM



Advertisments