Forums

ASP

This topic is locked

New and NEED HELP with ASP.Net

Posted 22 Feb 2006 00:31:17
1
has voted
22 Feb 2006 00:31:17 j stark posted:
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???

Cheers, Here is my code (I hope it shows correctly since in the preview all the HTML code was gone even though I have it wrapped in 'CODE' tags):

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.

<pre id=code><font face=courier size=2 id=code>

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



</font id=code></pre id=code>

Reply to this topic