if
(!grid.MasterTableView.IsItemInserted)
{
grid.MasterTableView.IsItemInserted =
true;
grid.Rebind();
}
I have hooked up the OnCommand client event for a confirmation from user when they hit cancel on the row.
grid.ClientSettings.ClientEvents.OnCommand = "RaiseCommand";
<script type="text/javascript">
function RaiseCommand(sender, args) {
if ( (args.get_commandName() == "CancelUpdate") || (args.get_commandName() == "CancelInsert")) {
if (confirm('Are you sure you want to clear all of the answers for this row?')) {
args.set_cancel(
false);
}
else {
args.set_cancel(
true);
}
}
}
</script>
The problem is if the user confirms the cancel, the CancelCommand never gets fired for the Insert Row. It fires correctly for the Edit Row. I want to trap the CanceCommand to clear the insert row from any contents. Please help
| <EditItemTemplate> |
| <telerik:RadEditor ID="reTest" runat="server" |
| ContentAreaCssFile="http://path/to/cc.css" |
| StripFormattingOnPaste="MSWordRemoveAll" |
| ToolsFile="~/App_Data/RadEditor/Tools.xml" |
| OnClientPasteHtml="PasteFormatting" |
| OnClientCommandExecuting="ChangeImageManager" |
| OnClientLoad="OnClientLoad" |
| Content='<%# Eval("Object.HTML") %>'> |
| <ImageManager MaxUploadFileSize="2097152" /> |
| <Content><p></p></Content> |
| </telerik:RadEditor> |
| </EditItemTemplate> |
| function OnClientLoad(editor, args) |
| { |
| alert("start"); |
| alert(editor); |
| editor.attachEventHandler("oncontrolselect", function() |
| { |
| alert("attachEventHandler"); |
| //Check if image |
| window.setTimeout(function() |
| { |
| alert("setTimeout"); |
| var selElem = editor.getSelection().getParentElement(); |
| if (selElem.tagName == "IMG") |
| { |
| //Store current width and height |
| curWidth = selElem.offsetWidth; |
| curHeight = selElem.offsetHeight; |
| //Possible to resize, so attach eventhandler |
| selElem.onresizeend = function(e) |
| { |
| var resized = false; |
| alert("onresizeend"); |
| if(selElem.style.pixelWidth > <%=System.Configuration.ConfigurationManager.AppSettings["editorMaxWidth"] %>) |
| { |
| selElem.style.pixelWidth = <%=System.Configuration.ConfigurationManager.AppSettings["editorMaxWidth"] %> |
| resized = true; |
| } |
| if(selElem.style.pixelHeight > <%=System.Configuration.ConfigurationManager.AppSettings["editorMaxHeight"] %>) |
| { |
| selElem.style.pixelHeight = <%=System.Configuration.ConfigurationManager.AppSettings["editorMaxHeight"] %> |
| resized = true; |
| } |
| if(resized) |
| { |
| alert('Your image cannot be larger than <%=System.Configuration.ConfigurationManager.AppSettings["editorMaxHeight"] %> x <%=System.Configuration.ConfigurationManager.AppSettings["editorMaxHeight"] %>'); |
| } |
| // selElem.onresizeend = null;//remove handler |
| }; |
| } |
| }, 0); |
| }); |
| } |

| <radTlb:RadToolbarTemplateButton ID="RadToolbarTemplateButton3" runat="server"> |
| <ButtonTemplate> |
| <radCln:RadDatePicker ID="dpDatePicker" runat="server" Width="105px" DateInput-ReadOnly="true" |
| DateInput-Skin="None" Calendar-Skin="Web20" |
| Calendar-SkinsPath="/" DateInput-SkinsPath="/"> |
| <ClientEvents OnDateSelected="BroadcastDateChange" /> |
| </radCln:RadDatePicker> |
| </ButtonTemplate> |
| </radTlb:RadToolbarTemplateButton> |
Hello,
I have recently migrated our website to ASP.Net 3.5 with RadControls for ASP.Net AJAX Q1 2008 (the last release we had access to). Our site also is integrated to Community Server.
In one portion of the site, there is an error in the interaction of the two packages, resulting in the error "Script controls may not be registered before PreRender". The full trace follows at the end of this post. The problem occurs when a radMenu is placed in a template as part of the community server skinning/templating system.
The reproduction shows that the error does not occur when the menu is used outside of the template, and also does not occur when a ScriptManager element is used in the template without a menu. The error occurs when the menu is used within the template.
I have isolated the required Community Server components needed to reproduce the problem, and have created a small project that demonstrates the issue. Please let me know where I can send the zip file of the solution.
Thank you,
Lisa Hakesley
------------------------
Script controls may not be registered before PreRender.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Script controls may not be registered before PreRender.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Script controls may not be registered before PreRender.]
System.Web.UI.ScriptControlManager.RegisterScriptControl(TScriptControl scriptControl) +347825
System.Web.UI.ScriptManager.RegisterScriptControl(TScriptControl scriptControl) +66
Telerik.Web.UI.RadDataBoundControl.RegisterScriptControl() +29
Telerik.Web.UI.RadDataBoundControl.OnPreRender(EventArgs e) +22
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
I have an problem in Binding Image in the GridBinaryImageColumn . The image comes in form of byte[] fromWebservices then serialize the data and same data deserilaize in the Javascriptnad bind to grid . The normal Bound column is working fine Let me show you howits work
<head id="Head1" runat="server">
<telerik:RadCodeBlock ID="RadCodeBlock1"runat="server">
<script type="text/javascript">
function pageLoad(sender, args) {
WebService.JsonRecord(updateGrid);
}
function updateGrid(result) {
//alert(result);
var test =Sys.Serialization.JavaScriptSerializer.deserialize(result);
var gridObject=$find("<%=RadGrid1.ClientID %>");
var tableView = gridObject.get_masterTableView();
tableView.set_dataSource(test);
tableView.dataBind();
}
function OnRowDataBound(sender, args) {
//alert(args.get_item().get_cell("txtModel"));
varspanControl = args.get_item().get_cell("test").getElementsByTagName('img ')[0];
}
</script>
</telerik:RadCodeBlock>
</head>
<body >
<form runat="server"id="mainForm"method="post"style="width:100%;">
<asp:ScriptManager ID="RadScriptManager" runat="server">
<Services>
<asp:ServiceReference Path="~/WebService.asmx" />
</Services>
</asp:ScriptManager>
<telerik:RadGrid ID="RadGrid1"AutoGenerateColumns="false"runat="server"AllowPaging="true"PageSize="10">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn HeaderText="Model" DataField="txtModel">
</telerik:GridBoundColumn>
<telerik:GridBinaryImageColumnHeaderText="Images"DataField="binPicture"UniqueName ="test" ></telerik:GridBinaryImageColumn>
<telerik:GridBoundColumn HeaderText="OEMPartNumber" DataField="txtOEMPartNumber">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<ClientEvents OnCommand="function(){}" />
</ClientSettings>
</telerik:RadGrid>
</form>
</body>
This isa HTML and let me show you how its come from we services
public objectJsonRecord()
{
JavaScriptSerializer javaSerializer = new JavaScriptSerializer();
//List<string[]> lstEquipment = select();
//List<string[]> lstEquipment = Test();
List<Test>lstTest = foo();
return javaSerializer.Serialize(lstTest);
}
[WebMethod]
[ScriptMethod]
public List<Test> foo()
{
List<Test>lstTest = new List<Test>();
Test objTest = newTest();
lstTest=objTest.GetItems();
return lstTest;
}
Everytime I do thisits show the Error
“DataBinding: 'System.Data.DataRowView' does not containa property with the name 'binPicture'.”
Please any one Help me regarding this