Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
120 views
Hi

We are using a RadEditor on one of our pages and within this page we have a RequiredFieldValidator that checks if this editor contains any text. If it does not a message is displayed to the user for them to enter text.

We are currently having a problem when a postback occurs. We have an add files link on the page, which popups a new dialog. Once the user has finished with this page we postback that file data to a grid on the page. This then causes a javascript error to appear:

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; InfoPath.3)
Timestamp: Tue, 6 Dec 2011 15:18:04 UTC

Message: Unable to set value of the property 'controltovalidate': object is null or undefined
Line: 197
Char: 1
Code: 0
URI: https://localhost/3G3/TasksAndDiscussions/Item/TaskOrDiscusionItemFormPage.aspx?HostWindow=POPUP&HostWindowContextContainerID=bc80ecd4-4957-43e5-8e7a-347480972599&HostWindowContextContainerType=TASKFOLDER&HostWindowContextContainerPath=SYSTEM+%2f+4p+Jonathan+Testing+%2f+Site+01+%2f+Project+01+%2f+Tasks&EditMode=NEW&LayoutMode=FILL&NextURL=&HeaderId=bc80ecd4-4957-43e5-8e7a-347480972599&HeaderType=TASK&SpecialAction=NONE&AttachmentsSessionID=00000000-0000-0000-0000-000000000000&mode=popup&openerid=

I believe this is relating to the RequiredFieldValidator checking if any text exists in the RadEditor and it is failing to find the RadEditor on the page.

Below is an example of the code:


<table border=0 width="100%">
	<tr>
		<td valign="top">
			<gen:Field id="cBodyText" runat="server" type="extended" name="Body Text" description="Thread body text" inputdescription="Thread body text"></gen:Field>
		</td>
	</tr>
	<tr>
		<td align="center">
			<radE:RadEditor id="cBodyTextRadEditor" Runat="server" 
				ToolsFile="~/Properties/Content/TasksAndDiscussions/Threaded/TextEditorToolsConfig.xml" 
				Editable="true" height="400px" width="500px" showsubmitcancelbuttons="false" 
				Scheme="~/RadControls/Editor/Schemes/Monochrome" OnClientLoad="OnClientLoad"
				EnableDocking="false" OnClientModeChange="OnClientModeChange"></radE:RadEditor>
		</td>
	</tr>
	<tr>
        <td align="center">
            <asp:label id="lblBodyTextValidation" runat="server" visible="false" style="colorred;" text="The message body is required, please complete your post before proceeding." />
		</td>
    </tr>
    <tr>
		<td align="center">
			<asp:RequiredFieldValidator id="ReqFieldValidator" runat="server" ErrorMessage="The message body is required, please complete your post before proceeding."></asp:RequiredFieldValidator>
		</td>
	</tr>
</table>

protected void Page_Load(object sender, System.EventArgs e)
		{
			if(!IsPostBack)
			{
				if(ReqFieldValidator!=null)ReqFieldValidator.ErrorMessage = resourceManager.GetString("themessagebodyi");
				if(cBodyText!=null)cBodyText.Description = resourceManager.GetString("threadbodytext");
				if(cBodyText!=null)cBodyText.InputDescription = resourceManager.GetString("threadbodytext");
				if(cBodyText!=null)cBodyText.Name = resourceManager.GetString("bodytext");
			}
 
			if (cBodyTextRadEditor.Text == "")
			{
				ReqFieldValidator.ControlToValidate = "cBodyTextRadEditor";
			}
}

Jonathan
Top achievements
Rank 1
 asked on 06 Dec 2011
1 answer
48 views
hello


i am using telerik version 2011.2.915.35 and the default skin for the editor.
when opening the image manager and selecting upload the textboxes of the file chose control have no borders.
i debugged with IE9 and when disabling one style attribute the boxes show up on the bottom, see attached screenshot.

it seems there is something wrong with the style, how can i fix this so the input boxes appear next to the select button as they are supposed to?

BR
Rumen
Telerik team
 answered on 06 Dec 2011
5 answers
283 views
Hi,

This doesn't happen with Firefox, and apparently not with IE7, but in IE8 when applying a css class from the 'apply css class' drop down list, the editor also adds FONT-SIZE="14" which slightly defeats the purpose of using classes to manage styles.

Is there a solution or work-around to this? This is using Sitecore 6.3

Rumen
Telerik team
 answered on 06 Dec 2011
1 answer
114 views
Hi there,

I'm trying to implement a scheduler with lazy loading from a WCF webservice. The webservice is almost ready while I can't find any way to load only the appointments of the current displayed month. 

I've already looked what was mentioned in this post http://www.telerik.com/community/forums/wpf/scheduler/scheduler-performance.aspx.
I can't find any of these options in the property list.


any help would be appreciated.


thanks in advanced,

Kevin
Peter
Telerik team
 answered on 06 Dec 2011
1 answer
263 views
Hello,

Is it possible to have the Transparency set for the page (update panel), but not around the spinner? When I set the Transparency for my loading panel, it is applied to my spinner image.

My Loading Panel:
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="50" HorizontalAlign="Center" BackgroundPosition="Center" ZIndex="99999">
        <div style="background-color:#fff; width:100%; height:100%;">
            <asp:Image ID="Image1" runat="server" style="z-index:999999;margin-top:50%;" ImageUrl="~/images/SpinIndicator.gif" AlternateText="loading" />
        </div>    
    </telerik:RadAjaxLoadingPanel> 

Thanks!
Kevin
Top achievements
Rank 2
 answered on 06 Dec 2011
1 answer
101 views
if I select files using a click or control click OnClientItemSelected is triggered like it should be. BUT if I use Shift-Click to select a group it is not being triggered. How do I trigger this event?
Dobromir
Telerik team
 answered on 06 Dec 2011
3 answers
212 views
Hi Telerik,

I've a radSiteMap which is coupled to a RadTree, based on where the path I select on the RadTree, the siteMap(BreadCrumbs) shows up. It works fine.. But unfortunately, the first time, the breadCrumbs load up, the text of the breadcrumbs is not visible, only the separators are there. As soon as I move some control around, it becomes visible.. 
Is there any way to bring it up the first time itself so that it doesnt leave an awkward gap in the breadcrumbs area?

Thanks and Regards,
toptorps
Dimitar Terziev
Telerik team
 answered on 06 Dec 2011
1 answer
126 views
r

Hello,

I’m trying to DataBind a RadPanelBar but with no success.

Everything works fine when the RadPanelBar is not bound to data and we get the expected rendering. The moment the RadPanel gets bound to data only the parent RadPanelItem is displayed and the HTML in the Child RadPanelItem are not displayed. The RadPanelBar is bound to a Generic List. And I have also verified the exactitude of the dynamic data coming fetched from the DataBase.

Can find the code behind & ASPX attached.
Awaiting your valudable inputs.

Thanks & regards
Clement

Kate
Telerik team
 answered on 06 Dec 2011
1 answer
74 views
Hey,

I can't edit a node after it is created (or copy).
My Treeview is in an ascx file...

For exemple :
protected void RadTreeView1_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
{
    RadTreeNode clickedNode = e.Node;
     switch (e.MenuItem.Value)
    {
        case "Copy":
            RadTreeNode clonedNode = clickedNode.Clone();
            clonedNode.Text = string.Format("Copy of {0}", clickedNode.Text);
            clickedNode.InsertAfter(clonedNode);
            //set node's value so we can find it in startNodeInEditMode
            clonedNode.Value = clonedNode.GetFullPath("/");
            clonedNode.Selected = true;
            startNodeInEditMode(clonedNode.Text);
            break;
    }
}

and :
private void startNodeInEditMode(string nodeValue)
        {
            //find the node by its Value and edit it when page loads
            string js = "Sys.Application.add_load(editNode); function editNode(){ ";
            js += "var tree = $find(\"" + RadTreeView1.ClientID + "\"); ";
            js += "var node = tree.findNodeByValue('" + nodeValue + "');";
            js += "if (node) node.startEdit();";
            js += "Sys.Application.remove_load(editNode);};";
 
            RadScriptManager.RegisterClientScriptBlock(this, this.GetType(), "nodeEdit", js, true);
        }

(in debug nodeValue = "ADVANTECH/Automation Controllers")

I don't know what to try to edit the new node :-(
Enclosed : just after copy a node
Kevin
Top achievements
Rank 2
 answered on 06 Dec 2011
5 answers
110 views
I have a grid with this line
<EditFormSettings UserControlName="editform.ascx" EditFormType="WebUserControl">

</EditFormSettings>
I hit the edit button and it displays like it should but I can't get to the data when I hit update. below are the ascx and ascx.cs files and the update function

 

protected void RadGridCabFolders_UpdateCommand(object source, GridCommandEventArgs e)
{
    //GridEditManager editMan = (e.Item as GridEditableItem).EditManager;
    GridEditableItem editedItem = e.Item as GridEditableItem;
    UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
    string commandText = "UPDATE " + Page_Cab.CabRealName + " SET ";
    List<SqlParameter> paras = new List<SqlParameter>();
    int doc_id = (int)((GridEditableItem)e.Item).GetDataKeyValue(DOC_ID);
    varRadGridCabFoldersIndex = Convert.ToInt16(doc_id);
    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
    {
        if (column is IGridEditableColumn && column.UniqueName != LOC && column.UniqueName != DELETED)
        {
            IGridEditableColumn editableCol = (column as IGridEditableColumn);
            if (editableCol.IsEditable)
            {
                //IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
 
                if (column.UniqueName != DOC_ID && column.UniqueName.ToLower() != TIME_STAMP)
                {
                    commandText += " " + column.UniqueName + "=@" + column.UniqueName + ",";
                    Control editFormControl = ((userControl)).FindControl(column.UniqueName);
                    Type editformType = editFormControl.GetType();
                    object editorValue =
                        (editformType.Name == "TextBox") ? ((TextBox)editFormControl).Text :
                        (editformType.Name == "DropDownList") ? ((DropDownList)editFormControl).Text :
                        (editformType.Name == "RadMaskedTextBox") ? ((RadMaskedTextBox)editFormControl).Text :
                        (editformType.Name == "RadDatePicker") ? ((RadDatePicker)editFormControl).ToString() : (object)null;
                     
                    paras.Add(new SqlParameter(column.UniqueName, editorValue));
                }
            }
        }
    }
    commandText = commandText.Substring(0, commandText.Length - 1) + " where doc_id=" + doc_id;
    DbHelper.ExecuteDbNonQuery(Page_Dept.DeptRealName, commandText, paras.ToArrayNullIsEmpty());
    setDT();
    ViewState["GridData"] = folder_dt;
 
    if (ViewState["GridData"] != null)
    {
        RadGridCabFolders.DataSource = ViewState["GridData"];
    }
}

 

using System;
using System.Data;
using System.Collections;
using System.Web.UI;
using Telerik.Web.UI;
using System.Data;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Text.RegularExpressions;
using TreenoCsLib;
 
 
    public partial class editform : System.Web.UI.UserControl
    {
 
        private object _dataItem = null;
        public CabItem Page_Cab { get { return (CabItem)Session[SessionKeys.SelCab]; } set { Session[TreenoCsLib.SessionKeys.SelCab] = value; } }
        public DeptItem Page_Dept { get { return (DeptItem)Session[SessionKeys.SelDept]; } set { Session[SessionKeys.SelDept] = value; } }
 
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (DataItem != null)
            {
                string ConnString = (string)Session[TreenoCsLib.SessionKeys.SelDeptDbConnString];
                SqlConnection conn = new SqlConnection(ConnString);
                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = new SqlCommand("select departmentid from departments where real_name='" + Page_Cab.CabRealName + "'", conn);
                conn.Open();
                SqlDataReader myReader = null;
                myReader = adapter.SelectCommand.ExecuteReader();
                myReader.Read();
                string departmentid = myReader["departmentid"].ToString();
                conn.Close();
                Control EditTable = FindControl("Table4");
                object[] editFormVals = ((System.Data.DataRowView)(DataItem)).Row.ItemArray;
                int i = 0;
                foreach (DataColumn colObj in ((DataRowView)(DataItem)).Row.Table.Columns)
                {
                    TableRow r = new TableRow();
                    string colName = colObj.ColumnName;
                    if (colName == "file_id" ||
                      colName == "document_id" ||
                      colName == "cabinet_id" ||
                      colName == "doc_id" ||
                      colName == "location" ||
                      colName == "deleted" ||
                      colName == "timestamp" ||
                      colName == "TimeStamp" ||
                      colName == "fsearch_id")
                    {
                    }
                    else
                    {
                        //need to look up required and regex
                        string ConnStringDoc = ConfigurationManager.ConnectionStrings["docutron"].ConnectionString;
                        SqlConnection connDoc = new SqlConnection(ConnStringDoc);
                        SqlDataAdapter adapterDoc = new SqlDataAdapter();
                        SqlDataReader myReaderDoc = null;
                        adapter.SelectCommand = new SqlCommand("SELECT required,regex FROM field_format where cabinet_id=" + departmentid + " and field_name='" + colName + "'", conn);
                        conn.Open();
                        myReader = adapter.SelectCommand.ExecuteReader();
                        string requiredField = "0";
                        string regExField = "";
                        if (myReader.HasRows)
                        {
                            myReader.Read();
                            requiredField = myReader["required"].ToString();
                            regExField = myReader["regex"].ToString();
                        }
                        conn.Close();
                        //need to look up dropdown list (
                        adapterDoc.SelectCommand = new SqlCommand("SELECT value FROM settings where k='dt," + Page_Dept.DeptRealName + "," + departmentid + "," + colName + "'", connDoc);
                        connDoc.Open();
                        myReaderDoc = adapterDoc.SelectCommand.ExecuteReader();
                        if (myReaderDoc.HasRows) //need dropdown
                        {
                            myReaderDoc.Read();
                            string pattern = ",,,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))";
                            Regex rg = new Regex(pattern);
                            string[] dropdownlistArr = rg.Split(myReaderDoc["value"].ToString());
                            TableCell c = new TableCell();
                            DropDownList tb = new DropDownList();
 
                            ArrayList tocs = new ArrayList(dropdownlistArr);
                            tb.DataSource = tocs;
                            tb.DataBind();
 
 
 
                            if (editFormVals[i].ToString() == null)
                            {
                                tb.SelectedIndex = 0;
                            }
                            else
                            {
                                tb.SelectedIndex = tocs.IndexOf(editFormVals[i].ToString());
                            }
                            tb.DataSource = null;
 
 
                            tb.ID = colName;
                            //tb.Text = editFormVals[i].ToString();
                            c.Controls.Add(new LiteralControl(colName + ": "));
                            c.Controls.Add(tb);
                            r.Cells.Add(c);
                            ((Table)EditTable).Rows.Add(r);
                        }
                        else if (colName.Contains("date"))
                        {
                            TableCell c = new TableCell();
                            RadDatePicker tb = new RadDatePicker();
                            tb.ID = colName;
                            tb.DbSelectedDate = editFormVals[i].ToString();
                            c.Controls.Add(new LiteralControl(colName + ": "));
                            c.Controls.Add(tb);
                            r.Cells.Add(c);
                            ((Table)EditTable).Rows.Add(r);
                        }
                        else
                        {
                            TableCell c = new TableCell();
                            TextBox tb = new TextBox();
                            tb.ID = colName;
                            tb.Text = editFormVals[i].ToString();
                            c.Controls.Add(new LiteralControl(colName + ": "));
                            c.Controls.Add(tb);
                            r.Cells.Add(c);
                            ((Table)EditTable).Rows.Add(r);
                        }
                    }
                    ++i;
                }
            }
             //((System.Data.DataRowView)(DataItem)).Row.ItemArray
            //((System.Data.DataColumn)((new System.Collections.ArrayList.ArrayListDebugView(((System.Data.InternalDataCollectionBase)(((System.Data.DataRowView)(DataItem)).Row.Table.Columns)).List)).Items[0])).ColumnName
            // Put user code to initialize the page here
        }
 
        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }
         
        /// <summary>
        ///        Required method for Designer support - do not modify
        ///        the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.DataBinding += new System.EventHandler(this.EmployeeDetails_DataBinding);
 
        }
        #endregion
 
        public object DataItem
        {
            get
            {
                return this._dataItem;
            }
            set
            {
                this._dataItem = value;
            }
        }
 
        protected void EmployeeDetails_DataBinding(object sender, System.EventArgs e)
        {
            //ArrayList tocs = new ArrayList(new string[] { "Dr.", "Mr.", "Mrs.", "Ms." });
            //Control temp = FindControl("vendor");
            //((DropDownList)temp).DataSource = tocs;
            //((DropDownList)temp).DataBind();
 
            //object tocValue = DataBinder.Eval(DataItem, "vendor");
 
            //if (tocValue == DBNull.Value)
            //{
            //    tocValue = "Mrs.";
            //}
            //((DropDownList)temp).SelectedIndex = tocs.IndexOf((string)tocValue);
            //((DropDownList)temp).DataSource = null;
        }
 
    }

 

<%@ Control Language="c#" Inherits="editform" CodeFile="editform.ascx.cs" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:table id="Table2" cellspacing="2" cellpadding="1" width="100%" style="border-collapse: collapse" runat="server">
    <asp:TableRow CssClass="EditFormHeader">
        <asp:TableCell ColumnSpan="2">
            <b>Edit Form</b>
        </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
        <asp:TableCell ColumnSpan="2">
            <b>Test:</b>
        </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
        <asp:TableCell>
            <asp:Table id="Table4" runat="server">
            </asp:Table>
        </asp:TableCell>
    </asp:TableRow>
     <asp:TableRow>
        <asp:TableCell HorizontalAlign="Right" ColumnSpan="2">
            <asp:Button ID="btnUpdate" Text="Update" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'>
            </asp:Button>
            <asp:Button ID="btnInsert" Text="Insert" runat="server" CommandName="PerformInsert" Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>'>
            </asp:Button>
              
            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
            </asp:Button>
        </asp:TableCell>
    </asp:TableRow>
</asp:table>

Andrey
Telerik team
 answered on 06 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?