Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
258 views
Hello,
 I have a dynamically built grid with in-place editing and insert row. The insert row is always available at top and I have the following code to do so.

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

 

Veli
Telerik team
 answered on 27 Oct 2009
1 answer
113 views
Hi,

I have a user control that contains a details view control (DV) among other things.  Within the DV I have a template field with an Editor as the edit template.  I am trying to enforce image size constraints when a user tries to resize an image by dragging the corners etc. 

The issue is that the oncontrolselect event handler that is attached in the ClientLoad does not appear to fire.

By default the DV is in read only mode, although changing the default mode to edit doesn't appear to resolve the issue.

When the details view goes into edit mode this script appears to run.  I get the first two alerts (start and editor).  However, when I click an image and resize it by dragging the corners none of the other alerts appear and the constraints are not enforced.  On a page with the editor in a details view but NOT in a user control the code appears to be fine.

Am I missing something to get the editor oncontrolselect event to fire?

Here's the edit template code from the DV
<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>  

Here's the javascript that is below the editor on the page.  There are some server code tags in the js to pull values in from the code behind & web config.

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);         
            });     
        }         

Thanks for any help offered,

Regards,

Matt

Rumen
Telerik team
 answered on 27 Oct 2009
3 answers
159 views
Is there radInfo -dialog? Just to tell user that everything was ok.
Georgi Tunev
Telerik team
 answered on 27 Oct 2009
1 answer
212 views
hi in javascript we can have "oWnd.setSize(800, 600);
oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Maximize + Telerik.Web.UI.WindowBehaviors.Close)
" to add the size and multiple behaviors.

Is it possible to do all these in code behind?  Here is my code to open the window from code behind

RadWindow rw = radwindowmanager1.Windows[0];        
        rw.OpenerElementID = label1.ClientID;
        rw.NavigateUrl = "page1.aspx?abc=" + strID;

thanks in advance!
Georgi Tunev
Telerik team
 answered on 27 Oct 2009
1 answer
180 views
Hi friends

I want to validate the below control, how to do that.


and also this one, if we dont select any event , some msg shld come like "Please select an event" , but without choosing the event its is saving, inorder to bind i use the usercontrol AdvancedForm, the radcombox  is placed in resourcecontrol usercontrol , i used the
emptyMessage option in radcombobox but nothing is displaying and not validating

Please help
Peter
Telerik team
 answered on 27 Oct 2009
2 answers
128 views
Need som help.
I am using Telerik RAD Controls Q2 2007 in our AJAX enabled web application. In one of the user controls I am using the a RadToolbar, which contains some  RadToolbarTemplateButtons. These RadToolbarTemplateButtons wrapping around other web controls (asp:DropDownList, rad:RadDatePicker), but these web controls are not accessible from code behind. As I found out none of the web controls inside the RadToolbarTemplateButton are added to the designer.cs files in Visual Studio. The layout in teh markup looks as below:
<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> 

As you can see all the necessary attributes are present (IDs and such), but none of the content in RadToolbarTemplateButton3 is present in the designer.cs file, thus making it impossible to use the user control and acess the RadToolbarTemplateButton  content.
I already reinstalled VS 2005 and added all the controls to the user controls page from scratch.
If I try to add any controls outside of the rad:RadToolbar they are fine and auto generated in designer.cs correctly. Frankly this is very very annoying as I am not able to use the user control.
thanks for any suggestion and help.
Benjamin
Top achievements
Rank 1
 answered on 27 Oct 2009
2 answers
246 views

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

 

 

Dharmendra Baghel
Top achievements
Rank 1
 answered on 27 Oct 2009
3 answers
82 views
I am handling appointment updates server-side with OnAppointmentUpdate.

I have run into a situation where I need to programatically handle the update differently whether the user drag and moved/extended the appointment vs updating it from the advanced form. Is there a mechnism in the control to tell where the update was initiated, possibly keying off of the button, etc...?

Thanks,

Jim
James Legan
Top achievements
Rank 1
 answered on 27 Oct 2009
1 answer
106 views
Hi,

I'm not sure why but I just don't seem to be getting grouping by Resource.

I want to have a Scheduler show Staff down the left hand side, time horizontally, and based on the examples this looks like grouping by Staff, but all the examples seem to use either a direct connection or session datasources.

I am populating my Scheduler by assigning a datasource in code (RadScheduler1.datasource = myDataSource) and all OK.

Do you have any help or examples that might show me how to do the same with my Resources as well, and then how to Group these, all within code rather than declaratively?

David Penny
Peter
Telerik team
 answered on 27 Oct 2009
5 answers
258 views


                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

Nikolay Rusev
Telerik team
 answered on 27 Oct 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?