Help 'EditCommandColumn' Buttons Do NOTHING

liunx

Guest
I'm new to ASP.Net with DW so ANY HELP would be greatly APPRECIATED.

I'm using:

Win XP SP2
DW MX 2004
SQL 2005 Express
SQL 2005 Express Manager
.Net 2.0

I want to edit a row that is displayed in a datagrid with the 'EditCommandColumn' ASP.Net control. I have the database table displayed, and along side each row is a corresponding 'Edit' button. However, when I click on the edit button to post the page and return the page with the chosen column availilble to be edited, I am instead returned a page that looks exactly like the first page. In other words, each time I click the edit button, it post the page and nothing happens.

Can someone please tell me how to fix this???

For whatever reason, when I change the "EditCommanColumn" control to be a "text link" instead of a "pushbutton" when the table is posted back, the fields are availible for edit, however when I edit them, no changes are made in the resulting page when I click on the "Update" link.

Cheers, Here is my code:


<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" EnableEventValidation="false" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
id="dsParts"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_PartsAreUs"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_PartsAreUs"] %>'
CommandText='<%# "SELECT * FROM dbo.Parts" %>'
Debug="true"
>
<EditOps>
<EditOpsTable Name="dbo.Parts" />
<Parameter Name="Name" Type="VarChar" />
<Parameter Name="Description" Type="NVarChar" />
<Parameter Name="Price" Type="Money" />
<Parameter Name="PartID" Type="Int" IsPrimary="true" />
</EditOps>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form runat="server">
<asp:DataGrid id="dgParts"
runat="server"
AllowSorting="False"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0"
ShowFooter="false"
ShowHeader="true"
DataSource="<%# dsParts.DefaultView %>"
PagerStyle-Mode="NextPrev"
DataKeyField="PartID"
onCancelCommand="dsParts.OnDataGridCancel"
onEditCommand="dsParts.OnDataGridEdit"
onUpdateCommand="dsParts.OnDataGridUpdate"
onItemDataBound="dsParts.OnDataGridItemDataBound"
>
<HeaderStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD" ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Bold="true" Font-Size="smaller" />
<PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica, sans-serif" Font-Size="smaller" />
<Columns>
<asp:EditCommandColumn
ButtonType="PushButton"
CancelText="Cancel"
EditText="Edit"
HeaderText="Edit"
UpdateText="Update"
Visible="True"/>
<asp:BoundColumn DataField="PartID"
HeaderText="PartID"
ReadOnly="true"
Visible="True"/>
<asp:BoundColumn DataField="Name"
HeaderText="Name"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="Description"
HeaderText="Description"
ReadOnly="false"
Visible="True"/>
<asp:BoundColumn DataField="Price"
HeaderText="Price"
ReadOnly="false"
Visible="True"/>
</Columns>
</asp:DataGrid>
</form>
</body>
</html>
 
Back
Top