Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have written code on ButtonClick event of the btnAdd but it's not working. its giving an exception as:


Input string was not in a correct format.Couldn't store <<span style="font-size: 22px;">asdfghjkl> in Description Column. Expected type is Single.


My Code is:

C#
protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtModuleName.Text == "")
            {
                ScriptManager.RegisterStartupScript(UpdatePanel8, typeof(string), "alertscript", "alert('Please Enter the Module Name')", true);
            }
            else if (RadEditor2.Content == "")
            {
                ScriptManager.RegisterStartupScript(UpdatePanel6, typeof(string), "alertscript", "alert('Please Enter the Description')", true);
            }
            else
            {
                string modulename = txtModuleName.Text;
                string description = RadEditor2.Content;

                
                DataTable dt1 = (DataTable)Session["Project"];
                DataRow row1 = dt1.NewRow();
                row1["ModuleName"] = txtModuleName.Text;
                row1["Description"] = RadEditor2.Content;
                
                dt1.Rows.Add(row1);
                GridView1.DataSource = dt1;
                GridView1.DataBind();
                txtModuleName.Text = "";
                RadEditor2.Content = "";
            }
        }
Posted
Updated 1-Nov-14 3:36am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900