This is a migrated thread and some comments may be shown as answers.

New row will not render with RadEditor HTML formatting

2 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rengo
Top achievements
Rank 1
Rengo asked on 09 Jun 2013, 06:55 PM
Hello,

I have the following RadGrid with a RadEditor embedded in it.  Everything works as expected, except when I change the color of the text in a RadEditor row, I am not able to add another row.  I don' receive any errors and I am able to  step through the btnAddInstruction_Click and grdInstructions_ItemDataBound events without any issues.  It just will not render another row.



btnAddInstruction_Click Code:
public static void AddInstructionGridRow(RadGrid gridName)
            {
                bool instructionIsNull = false;
                ProjectInstruction projectInstruction;
                List<ProjectInstruction> projectInstructions = new List<ProjectInstruction>();
                RadEditor txtInstruction;

                //  Iterate through the grid rows and retain all previously entered data.
                foreach (GridDataItem gridRow in gridName.Items)
                {
                    //  Create new Project Instruction object.
                    projectInstruction = new ProjectInstruction();

                    // Project ID (Hidden)
                    HiddenField hdnProjectID = gridRow.FindControl("hdnProjectID") as HiddenField;
                    if (hdnProjectID != null)
                    {
                        projectInstruction.ProjectID = Convert.ToInt32(hdnProjectID.Value);
                    }
                    else
                    {
                        projectInstruction.ProjectID = 0;
                    }

                    // Project Instruction ID (Hidden)
                    HiddenField hdnProjectInstructionID = gridRow.FindControl("hdnProjectInstructionID") as HiddenField;
                    if (hdnProjectInstructionID != null)
                    {
                        projectInstruction.ID = Convert.ToInt32(hdnProjectInstructionID.Value);
                    }
                    else
                    {
                        projectInstruction.ID = 0;
                    }

                    //  Project Instruction
                    txtInstruction = gridRow.FindControl("txtInstruction") as RadEditor;
                    if (txtInstruction.Content.Trim().Length == 0)
                    {
                        instructionIsNull = true;
                    }
                    projectInstruction.Instruction = txtInstruction.Content;

                    //  Add Project Instruction to Project Instructions object.
                    projectInstructions.Add(projectInstruction);
                }

                //  Create new Project Instruction object.
                if (!instructionIsNull)
                {
                    projectInstructions.Add(AddProjectInstruction());
                }

                //  Update Project Instructions grid.
                gridName.DataSource = projectInstructions;
                gridName.Rebind();
            }

grdInstructions_ItemDataBound
 protected void grdInstructions_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                //  Current row object.
                ProjectInstruction projectInstruction = (ProjectInstruction)e.Item.DataItem;
                string referenceNumber = string.Empty;

                //  Row Number
                GridDataItem dataItem = (GridDataItem)e.Item;
                referenceNumber = Convert.ToString(e.Item.ItemIndex + 1);
                dataItem["ReferenceNumber"].Text = referenceNumber;

                //  Project Instruction
                RadEditor txtInstruction = e.Item.FindControl("txtInstruction") as RadEditor;
                txtInstruction.Content = projectInstruction.Instruction;
                //txtInstruction.Languages.Add(new SpellCheckerLanguage("en-US", "English"));

                //  Delete Column               
                GridDataItem item = e.Item as GridDataItem;
                //  Display Delete option when adding new record and if there is more then one row.
                if (grdInstructions.MasterTableView.Items.Count > 0)
                {
                    //  Show Delete column during Add.
                    item["btnDeleteInstructionRow"].Controls[0].Visible = true;
                    item["btnDeleteInstructionRow"].Attributes["onclick"] = "return confirm('Delete Instruction# " +  referenceNumber + "?')";
                }
                else
                {
                    //  Hide Delete option if there is only one row.
                    item["btnDeleteInstructionRow"].Controls[0].Visible = false;
                }
            }
        }

Can you please tell  me what is causing another row not to be rendered when HTML color formatting is applied to the text in a RadEditor row?

Thank Very Much in Advance!

2 Answers, 1 is accepted

Sort by
0
Rengo
Top achievements
Rank 1
answered on 11 Jun 2013, 07:56 PM
Hello Telerik....., any ideas what is causing this behavior?  Thank You!
0
Pavlina
Telerik team
answered on 13 Jun 2013, 08:06 AM
Hi,

As the provided information is not enough to isolate the root cause of the issue you are facing, please prepare a simple, fully runnable reproduction demo, open a new support ticket and send it to us along with very detailed reproduction steps and explanations and we will debug it locally and we will do our best to help.

Regards,
Pavlina
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Rengo
Top achievements
Rank 1
Answers by
Rengo
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or