Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

HTML Editor Update in Database

$
0
0

I am using html editor to insert data into the database and its working fine , as im able to retrieve data from the database into the editor, but when i change the data in the editor and click on the update button , the data is not changed , the page refreshed and the old data (before i modify it) is displayed again , below is the code for getting the data and updating it ...

help please !!!

protected void Page_Load(object sender, EventArgs e)
    {
        con.Open();
        cmd = new SqlCommand("select Subject from dbo.Table2 where sid=" + Request.QueryString["sid"], con);
        read = cmd.ExecuteReader();

        if (!read.Read())
        {

            Response.Write("Can not read from the Data Source !!!");

        }

        else

        {

         
            Editor1.Content = (string)read["Subject"];
        }
        read.Close();
        cmd.Dispose();
    }
    protected void upd_Click(object sender, EventArgs e)
    {
        cmdupdate = new SqlCommand("UPDATE Table2 set Subject='"+Editor1.Content+"' WHERE sid="+Request.QueryString["sid"], con);
        cmdupdate.ExecuteNonQuery();
        cmdupdate.Dispose();
        con.Close();

    }


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>