Update Error when submitting edit changes in DataGrid (Dreamweaver MX 2004)

  •  10-04-2004, 2:43 PM

    Update Error when submitting edit changes in DataGrid (Dreamweaver MX 2004)

    Okay, first, sorry for the long subject title.

     
    I was able to implement the editor on a page, but I'm receiving an error in the post:
     
    System.Exception: Control not found in DataGrid column: CommonSenseID
    at DreamweaverCtrls.DataSet.OnDataGridUpdate(Object Src, DataGridCommandEventArgs E)
     
     
    What's weird is that CommonSenseID shouldn't have anything to do with anything...
     
     
     
    And now for the Source Code:
     
    <%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" validateRequest="false" %>
    <%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <MM:DataSet
    id="ds_common_sense_edit"
    runat="Server"
    IsStoredProcedure="false"
    ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_alg"] %>'
    DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_alg"] %>'
    CommandText='<%# "SELECT * FROM dbo.CommonSense" %>'
    PageSize="10"
    Debug="true"
    ><EditOps>
      <EditOpsTable Name="dbo.CommonSense" />
      <Parameter Name="" Type="BigInt" /> 
      <Parameter Name="CommonSenseID" Type="Integer" 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>ADMIN | edit COMMON SENSE </title>
    <link href="../style_sheets/bg.css" rel="stylesheet" type="text/css">
    <link href="../style.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <p class="text">&nbsp;</p>
    <form runat="server">
      <asp:DataGrid
      AllowCustomPaging="true"
      AllowPaging="true"
      AllowSorting="False"
      AutoGenerateColumns="false"
      CellPadding="3"
      CellSpacing="0" DataKeyField="CommonSenseID"
      DataSource="<%# ds_common_sense_edit.DefaultView %>" ID="dg_common_sense_edit"
      PagerStyle-Mode="NextPrev"
      PageSize="<%# ds_common_sense_edit.PageSize %>"
      runat="server"
      ShowFooter="false"
      ShowHeader="true" OnUpdateCommand="ds_common_sense_edit.OnDataGridUpdate" OnEditCommand="ds_common_sense_edit.OnDataGridEdit"
      OnPageIndexChanged="ds_common_sense_edit.OnDataGridPageIndexChanged" OnCancelCommand="ds_common_sense_edit.OnDataGridCancel" OnItemDataBound="ds_common_sense_edit.OnDataGridItemDataBound"
      virtualitemcount="<%# ds_common_sense_edit.RecordCount %>"
    >
        <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:HyperLinkColumn
            headertext="Title"
            Visible="True"
            DataTextField="Title"
            DataNavigateUrlField="Title"
            DataNavigateUrlFormatString="edit_detail.aspx?Title={0}"/>   
    <asp:TemplateColumn HeaderText="Body"
            Visible="True">
          <ItemTemplate><%# ds_common_sense_edit.FieldValue("Body", Container) %></ItemTemplate>
          <EditItemTemplate><CE:Editor id = "Edit" Template="Bold,Italic,Underline" Height=80 Width=200 ShowBottomBar="false" Text = '<%# ds_common_sense_edit.FieldValue("Body", Container) %>' runat = "Server" ></CE:Editor></EditItemTemplate>
        </asp:TemplateColumn>
        <asp:EditCommandColumn
            ButtonType="LinkButton"
            CancelText="Cancel"
            EditText="Edit"
            HeaderText="Edit"
            UpdateText="Update"
            visible="True"/>   
    <asp:BoundColumn DataField="CommonSenseID"
            HeaderText="CommonSenseID"
            ReadOnly="true"
            Visible="True"/>   
    </columns>
      </asp:DataGrid>
    </form>
    </body>
    </html>
     
     
View Complete Thread