Unsupported control type in DataGrid column

  •  10-05-2004, 4:17 PM

    Unsupported control type in DataGrid column

    Hello again,
     
    I'm receiving the following error when I attempt to update an entry from a datagrid (developed in Dreamweaver MX 2004):
     
    System.Exception: Unsupported control type in DataGrid column: CuteEditor.Editor
    at DreamweaverCtrls.DataSet.OnDataGridUpdate(Object Src, DataGridCommandEventArgs E)
     
    Any thoughts/comments/suggestions would be greatly appreciated!  If you can solve the problem I'll give you a cookie!
     
     
    Here is the source from the page:
     

    <%@ 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" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb" %>
    <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="Title" Type="VarChar" /> 
      <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"><strong><a href="../default.aspx">ADMIN</a></strong>&nbsp; |&nbsp; <a href="http://dev.bungetech.com/alg_app/sites/lg/default.aspx">jump to live site</a> <br>
      <br>
        <a href="add.aspx">ADD A COMMON SENSE ARTICLE</a></p>
    <p class="text"><strong>EDIT A COMMON SENSE ARTICLE</strong></p>
    <p class="text"><a href="delete.aspx">DELETE A COMMON SENSE ARTICLE</a><br>
    _____________________________________________</p>
    <p>&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:TemplateColumn HeaderText="Title"
            Visible="True">
          <ItemTemplate><%# ds_common_sense_edit.FieldValue("Title", Container) %></ItemTemplate>
          <EditItemTemplate><CE:Editor id = "Title" Template="Bold,Italic,Underline" Height=80 Width=200 ShowBottomBar="false" Text = '<%# ds_common_sense_edit.FieldValue("Title", Container) %>' runat = "Server" ></CE:Editor></EditItemTemplate>
        </asp:TemplateColumn>   
        <asp:TemplateColumn HeaderText="Body"
            Visible="True">
          <ItemTemplate><%# ds_common_sense_edit.FieldValue("Body", Container) %></ItemTemplate>
          <EditItemTemplate><CE:Editor id = "Body" 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="False"/>   
    </columns>
      </asp:DataGrid>
    </form>
    </body>
    </html>


    <script runat="server">
     void Page_Load(object sender, System.EventArgs e)
      {
         if (!IsPostBack)
      {
       BindData();
         }   
     }
     
     void BindData()
     {
       string myConnection,sql;
       myConnection = System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_alg"] ;
       sql = "Select Title, Body, CommonSenseID from CommonSense";
       
       OleDbConnection conn = new OleDbConnection(myConnection);
                OleDbCommand myCommand = new OleDbCommand(sql, conn);

       // Execute the command
       conn.Open();
       OleDbDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
       
       dg_common_sense_edit.DataSource = result ;
       dg_common_sense_edit.DataBind();
     }
     
     void dg_common_sense_edit_EditCommand(Object sender, DataGridCommandEventArgs e)
     {
      dg_common_sense_edit.EditItemIndex = e.Item.ItemIndex;
      BindData();
     }
     void dg_common_sense_edit_Cancel(Object sender, DataGridCommandEventArgs e)
     {
      dg_common_sense_edit.EditItemIndex = -1;
      BindData();
     }
     void dg_common_sense_edit_UpdateCommand(Object sender, DataGridCommandEventArgs e)
     {
      string myConnection,sql;
      myConnection = System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_alg"] ;
      sql = "Select Title, Body, CommonSenseID from CommonSense";
      
      CuteEditor.Editor txtTitle;
      CuteEditor.Editor txtBody;
      
      txtTitle = (CuteEditor.Editor)e.Item.FindControl("Title");
      txtBody = (CuteEditor.Editor)e.Item.FindControl("Body");
      
      string strUpdateStmt;
            strUpdateStmt =" UPDATE dg_common_sense_edit SET Title =@Title, Body =@Body WHERE CommonSenseID = @CommonSenseID";
      OleDbConnection conn = new OleDbConnection(myConnection);
            OleDbCommand myCommand = new OleDbCommand(strUpdateStmt, conn);
            myCommand.Parameters.Add(new OleDbParameter("@Title", txtTitle.Text));
      myCommand.Parameters.Add(new OleDbParameter("@Body", txtBody.Text));
      myCommand.Parameters.Add(new OleDbParameter("@CommonSenseID",  e.Item.Cells[3].Text ));
      conn.Open();
      myCommand.ExecuteNonQuery();
            dg_common_sense_edit.EditItemIndex = -1;
      BindData(); 
     }
    </script>
     
     
    Thanks!
     
    George
View Complete Thread