| <h1>Test template</h1> |
| Content starts here: <br /> |
| <placeholder name="Content" /> |
| <br /> |
| Content ends here! |
| <h1>Test template</h1> |
| Content starts here: <br /> |
| <p name="Content">Content ends here!</p> |
| <h1>Test template</h1> |
| Content starts here: <br /> |
| <div><placeholder name="Content" /></div> |
| <br /> |
| Content ends here! |
Hi,
I have develop 2 screen which is quite similiar.
These screen allow user to enter some value in the textboxes given and and a RadInputManager to validate the data inputed.
1 screen is working fine but 1 screen are not.
The screen which is not working, is because of the javascript not able to get the RadInputManager instance.
This screen has 1 textbox only, this textbox will have different validation depends on the different parameter passed in.
Each parameter will use different validation for the textbox.
Below are my codes, please advice.
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="~/Transaction/TransactionUpdate.aspx.cs" |
| Inherits="Transaction.TransactionUpdate" %> |
| <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head id="Head1" runat="server"> |
| <title></title> |
| <style type="text/css" media="all"> |
| @import "/css/standard.css"; |
| </style> |
| <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /><meta http-equiv="PRAGMA" content="NO-CACHE" /><meta http-equiv="CACHE-CONTROL" content="NO-CACHE" /><meta http-equiv="EXPIRES" content="-1" /> |
| <script src="/js/jquery-1.2.6.min.js" type="text/javascript"></script> |
| <script src="/js/common.js" type="text/javascript"></script> |
| </head> |
| <body> |
| <form id="form1" runat="server" autocomplete="off"> |
| <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="Default, Label" /> |
| <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"> |
| </telerik:RadAjaxLoadingPanel> |
| <telerik:RadWindowManager ID="radWindowManager" runat="server"> |
| </telerik:RadWindowManager> |
| <asp:ScriptManager ID="ScriptManager1" runat="server"> |
| </asp:ScriptManager> |
| <script language="javascript" type="text/javascript"> |
| Telerik.Web.UI.RadWindowUtils.Localization = |
| { |
| "Close": '<asp:Literal ID="radClose" runat="server" Text="<%$Resources:Button, btnClose%>" />', |
| "OK": '<asp:Literal ID="radOk" runat="server" Text="<%$Resources:Button, btnOk%>" />', |
| "Cancel": '<asp:Literal ID="radCancel" runat="server" Text="<%$Resources:Button, btnCancel%>" />', |
| "Yes": '<asp:Literal ID="radYes" runat="server" Text="<%$Resources:Common, rbtnYes%>" />', |
| "No": '<asp:Literal ID="radNo" runat="server" Text="<%$Resources:Common, rbtnNo%>" />' |
| }; |
| </script> |
| <telerik:RadInputManager ID="radMgr" runat="server"> |
| <telerik:TextBoxSetting BehaviorID="text"> |
| <Validation IsRequired="true" /> |
| <TargetControls> |
| <telerik:TargetInput ControlID="txtNewValue" /> |
| </TargetControls> |
| </telerik:TextBoxSetting> |
| <telerik:NumericTextBoxSetting BehaviorID="numeric" MinValue="0" MaxValue="999999"> |
| <Validation IsRequired="true" /> |
| <TargetControls> |
| <telerik:TargetInput ControlID="txtNewValue" /> |
| </TargetControls> |
| </telerik:NumericTextBoxSetting> |
| </telerik:RadInputManager> |
| <telerik:RadScriptBlock ID="scriptBlock1" runat="server"> |
| <script language="javascript" type="text/javascript"> |
| function GetRadWindow() |
| { |
| var oWindow = null; |
| if (window.radWindow) oWindow = window.radWindow; |
| else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; |
| return oWindow; |
| } |
| function PopulateData() |
| { |
| var oObject = GetRadWindow().argument; |
| document.getElementById('hdnTransactionId').value = oObject.TransactionId; |
| document.getElementById('hdnValueType').value = oObject.ValueType; |
| document.getElementById('hdnOldValue').value = oObject.OldValue; |
| document.getElementById('hdnOriginalValue').value = oObject.OriginalValue; |
| $("#spanOriginalValue").text(oObject.OldValue); |
| $("#spanTitle").text('<asp:Literal ID="ltrlUpdateTransaction" runat="server" Text="<%$ Resources:ltrlUpdateTransaction%>"></asp:Literal>'); |
| $("#spanOriginal").text('<asp:Literal ID="ltrlOriginal" runat="server" Text="<%$ Resources:ltrlOriginal%>"></asp:Literal>'); |
| $("#spanNewVaue").text('<asp:Literal ID="ltrlUpdated" runat="server" Text="<%$ Resources:ltrlUpdated%>"></asp:Literal>'); |
| if (oObject.ValueType == 'ValueType1') |
| { |
| document.getElementById('txtNewValue').setAttribute('maxLength', "6"); |
| } |
| else if (oObject.ValueType == 'ValueType2') |
| { |
| document.getElementById('txtNewValue').setAttribute('maxLength', "10"); |
| } |
| SetMandatory(oObject.ValueType); |
| } |
| function Close(valueType, newValue) |
| { |
| var arg = new Object(); |
| arg.ValueType = valueType; |
| arg.NewValue = newValue; |
| var oWnd = GetRadWindow(); |
| oWnd.close(arg); |
| } |
| function SetMandatory(valueType) |
| { |
| if (IsInputManagerValid("<%=radMgr.ClientID %>")) |
| { |
| var im = $find("<%=radMgr.ClientID %>"); |
| var text = im.get_inputSettings('text'); |
| var numeric = im.get_inputSettings('numeric'); |
| if (valueType == 'ValueType1') |
| { |
| text.set_isRequired(false); |
| numeric.set_isRequired(true); |
| } |
| else if (valueType == 'ValueType2') |
| { |
| text.set_isRequired(true); |
| numeric.set_isRequired(false); |
| } |
| } |
| } |
| $(document).ready(function() |
| { |
| PopulateData(); |
| }); |
| </script> |
| </telerik:RadScriptBlock> |
| <telerik:RadAjaxPanel ID="ajaxPnlTransactionUpdate" runat="server" EnableEmbeddedScripts="true" LoadingPanelID="RadAjaxLoadingPanel1"> |
| <div id="divUpdateTransaction" runat="server"> |
| <table width="98%" cellpadding="5px"> |
| <tr> |
| <td> |
| <div> |
| <h2> |
| <span id="spanTitle"><asp:Literal ID="ltrlTitle" runat="server" Text="Update Transaction"></asp:Literal></span> |
| </h2> |
| <div> |
| <table width="98%"> |
| <tr> |
| <td style="width: 70%"> |
| <span id="spanOriginal"><asp:Literal ID="ltrlOriginal" runat="server"></asp:Literal></span> |
| </td> |
| <td style="width: 30%"> |
| <span id="spanOriginalValue"><asp:Literal ID="ltrlOriginalValue" runat="server" Text=""></asp:Literal></span> |
| </td> |
| </tr> |
| <tr> |
| <td style="width: 70%"> |
| <span id="spanNewVaue"><asp:Literal ID="ltrlNewVaue" runat="server"></asp:Literal></span> |
| </td> |
| <td style="width: 30%"> |
| <asp:TextBox ID="txtNewValue" runat="server" Width="80px" MaxLength="10"></asp:TextBox> |
| </td> |
| </tr> |
| </table> |
| </div> |
| <div class="clear"> |
| |
| </div> |
| <div id="divButton" runat="server" style="width:90%"> |
| <p class="buttons"> |
| <asp:Button ID="btnSave" runat="server" Text="<%$ Resources:Button, btnSave %>" OnClick="btnSave_OnClick" /> |
| <asp:Button ID="btnCancel" runat="server" Text="<%$ Resources:Button, btnCancel %>" OnClientClick="GetRadWindow().close()" /> |
| </p> |
| </div> |
| <div id="hdnHidden"> |
| <asp:HiddenField ID="hdnTransactionId" runat="server" /> |
| <asp:HiddenField ID="hdnValueType" runat="server" /> |
| <asp:HiddenField ID="hdnOldValue" runat="server" /> |
| <asp:HiddenField ID="hdnOriginalValue" runat="server" /> |
| <asp:HiddenField ID="hdnTimeStampId" runat="server" /> |
| </div> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </div> |
| </telerik:RadAjaxPanel> |
| </form> |
| </body> |
| </html> |
| using System; |
| using System.Collections; |
| using System.Collections.Generic; |
| using System.Configuration; |
| using System.Data; |
| using System.Web; |
| using System.Web.Security; |
| using System.Web.UI; |
| using System.Web.UI.HtmlControls; |
| using System.Web.UI.WebControls; |
| using System.Web.UI.WebControls.WebParts; |
| using System.Xml.Linq; |
| using Telerik.Web.UI; |
| namespace Transaction |
| { |
| public partial class TransactionUpdate : BasePage |
| { |
| #region Variables |
| string TransactionDetailsLastUserId = "TransactionDetailsLastUserId"; |
| string TransactionDetailsTimeStampId = "TransactionDetailsTimeStampId"; |
| #endregion |
| #region Event Handlers |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| } |
| protected void btnSave_OnClick(object sender, EventArgs e) |
| { |
| try |
| { |
| string transactionID = hdnTransactionId.Value.ToString().Trim(); |
| long? customerId = SessionManager.UserSettings.DataContext.CustomerID; |
| string valueType = hdnValueType.Value.ToString().Trim(); |
| string oldValue = hdnOldValue.Value.ToString().Trim(); |
| string newValue = txtNewValue.Text.ToString().Trim(); |
| long userId = SessionManager.UserSettings.AppUserID; |
| //call to DB to fetch the corresponding TimestampId and Last User ID |
| CommonFacade commonFacade = new CommonFacade(); |
| DataSet dsValues = (DataSet)commonFacade.GetTimestampFromTransactionId(transactionID); |
| long lastUserId = string.IsNullOrEmpty(dsValues.Tables[0].Rows[0]["Last_UserId"].ToString()) ? 0 : Convert.ToInt64(dsValues.Tables[0].Rows[0]["Last_UserId"]); |
| byte[] oldTimeStampId = (byte[])dsValues.Tables[0].Rows[0]["Timestamp_Id"]; |
| byte[] newTimeStampId = null; |
| if (!object.Equals(oldValue.ToString().Trim(), newValue.ToString().Trim())) |
| { |
| ReportBiz report = new ReportBiz(); |
| newTimeStampId = report.TransactionValueUpdate(transactionID, valueType, newValue, userId, oldTimeStampId); |
| Session[TransactionDetailsTimeStampId] = newTimeStampId; |
| if (string.IsNullOrEmpty(newValue)) newValue = hdnOriginalValue.Value; |
| } |
| ScriptManager.RegisterStartupScript(Page, typeof(Page), "CloseWindow", "<script type=\"text/javascript\">Close('" + valueType + "', '" + newValue + "');</script>", false); |
| } |
| catch (BusinessException ex) |
| { |
| this.ShowRadErrorAlert(ex.Key); |
| } |
| } |
| #endregion |
| } |
| } |
sender.transferItem(item, e.get_sourceListBox(), e.get_destinationListBox());
Basically, the aspx page has a source and destination listbox. The source listbox is pre-populated in the code behind with a list of approximately 10 items. The error occurs when a transfer is performed from the source to the destination listbox or from the destination to the source listbox.
The code for the JavaScript function that is called by the source listbox for the OnCLientTransferring event is as follows:
| function RadListBoxColumnSource_OnClientTransferring(sender, e) | |
| { | |
| // Cancel the transfer so that can validate which items can be transferred. | |
| e.set_cancel(true); | |
| // Manually transfer items that are not formula items. | |
| var items = e.get_items(); | |
| for (var i = 0; i < items.length; i++) | |
| { | |
| var item = items[i]; | |
| // If the tooltip information is available then the item is a formula. | |
| var toolTip = item.get_toolTip(); | |
| if ((toolTip == null) || (toolTip.length() == 0)) | |
| { | |
| sender.transferItem(item, e.get_sourceListBox(), e.get_destinationListBox()); | |
| } | |
| } | |
| return; | |
| } |
The code snippet for the listboxes in the aspx page is as follows:
| <table style="font-size: 0.7em; font-family: Verdana" width="500px"> | |
| <tr> | |
| <td> | |
| <asp:Panel ID="PanelSource" runat="server" GroupingText="Data Columns" Width="100%"> | |
| <telerik:RadListBox ID="RadListBoxColumnSource" runat="server" AllowReorder="false" AllowTransfer="true" EnableDragAndDrop="true" SelectionMode="Multiple" TransferToID="RadListBoxColumnTarget" Width="220px" Height="400px" OnClientTransferring="RadListBoxColumnSource_OnClientTransferring" > | |
| <ButtonSettings ShowTransferAll="true" /> | |
| </telerik:RadListBox> | |
| </asp:Panel> | |
| </td> | |
| <td> | |
| <asp:Panel ID="PanelTarget" runat="server" GroupingText="Selected Data Columns" Width="100%"> | |
| <telerik:RadListBox ID="RadListBoxColumnTarget" runat="server" AllowReorder="true" EnableDragAndDrop="true" SelectionMode="Multiple" Width="220px" Height="400px" > | |
| <ButtonSettings ShowReorder="true" /> | |
| </telerik:RadListBox> | |
| </asp:Panel> | |
| </td> | |
| </tr> | |
| </table> |
The browser version is Internet Explorer 8.0.6001.18702 and the version of the Telerik controls are 2009.2.826.
Any help in resolving this issue is appreciated.
Thanks,
Tony
| <abc:TreeView ID="tvEmner" runat="server" /><!-- User control containing a telerik:RadTreeView control --> |
| <asp:Panel ID="pnlEmner" runat="server"> |
| <tel:RadTreeView ID="tvEmner" EnableDragAndDrop="true" Width="300px" Height="250px" |
| OnNodeDrop="OnEmneDropped" OnNodeClick="OnEmneClicked" OnNodeExpand="OnEmneExpanded" |
| OnClientNodeClicking="onEmneNodeClicking" |
| OnClientContextMenuItemClicking="onEmneContextMenuItemClicking" OnClientContextMenuShowing="onEmneContextMenuShowing" |
| runat="server"> |
| <ContextMenus> |
| <tel:RadTreeViewContextMenu ID="cmRoot" runat="server"> |
| <Items> |
| <tel:RadMenuItem Value="Create" PostBack="false" Text="Opret emne"> |
| </tel:RadMenuItem> |
| </Items> |
| <CollapseAnimation Type="none" /> |
| </tel:RadTreeViewContextMenu> |
| </ContextMenus> |
| <DataBindings> |
| <tel:RadTreeNodeBinding Expanded="True" /> |
| </DataBindings> |
| </tel:RadTreeView> |
| </asp:Panel> |
| var node = Al.EmneTreeView.getSelectedNode(); // function that gets the selected node |
| node.collapse(); |
| node.get_treeView().trackChanges(); |
| node.get_nodes().clear(); |
| node.set_expandMode(Telerik.Web.UI.TreeNodeExpandMode.ServerSideCallBack); |
| node.get_treeView().commitChanges(); |
| node.expand(); |
| <tel:RadAjaxManagerProxy ID="PageAjaxManager" runat="server"> |
| <AjaxSettings> |
| <tel:AjaxSetting AjaxControlID="tbButtons"> |
| <UpdatedControls> |
| <tel:AjaxUpdatedControl ControlID="tbButtons" /> |
| <tel:AjaxUpdatedControl ControlID="tvEmner" LoadingPanelID="AjaxLoadingPanel" /> |
| </UpdatedControls> |
| </tel:AjaxSetting> |
| </AjaxSettings> |
| </tel:RadAjaxManagerProxy> |