Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
102 views
I'm trying to move a RadAjaxPanel to another element via JavaScript and while I'm able to move it around, I've noticed that once you move the RadAjaxPanel using its ClientID property (RadAjaxPanel1.ClientID) the CallBack functionality disappears and anything within it causes a PostBack.

I tooled around with the sourcecode of a rendered page and I noticed that the RadAjaxPanel wraps itself in another div, so if I get the parentNode and move it the CallBack functionality is retained. The issue here is that as soon as I select something, everything within the panel resets back to default.

Here is the relevant part of the JavaScript I'm using:
var ModalBox = new function() 
    this._PreviousParentID = null
    this._PreviousContentID = null
 
    this.DisplayAjaxContents = function(id) 
    { 
        this.TakeContent(document.getElementById(id).parentNode.id); 
    }; // DisplayAjaxContents(id) 
    this.TakeContent = function(id) 
    { 
        ModalBox._PreviousContentID = id
        ModalBox._PreviousParentID = document.getElementById(id).parentNode.id; 
        var c = ModalBox.GetModalContentObject(); 
        c.appendChild(document.getElementById(id).parentNode.removeChild(document.getElementById(id))); 
    }; // TakeContent(id) 
    this.ReplaceContent = function() 
    { 
        var c = ModalBox.GetModalContentObject(); 
        var pp = document.getElementById(ModalBox._PreviousParentID); 
        pp.appendChild(c.removeChild(document.getElementById(ModalBox._PreviousContentID))); 
        ModalBox._PreviousParentID = null
        ModalBox._PreviousContentID = null
    }; // ReplaceContent() 
}; 
(Note: I've also tried using element.cloneNode(true) to transfer the RadAjaxPanel, but the result is the same--callback is maintained but it just resets itself.)

The ascx control has this:
<div>I am currently <asp:HyperLink ID="hlStatus" runat="server" />.</div> 
<div id="SingleSignInOut_Self_Hidden" style="display: none;"
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"
        <table style="width: 100%;"
            <tr> 
                <td style="width: 30%;"><b>Status</b></td
                <td style="width: 30%;"><b>Reason</b></td
                <td style="width: 40%;"><b>Details</b></td
            </tr> 
            <tr> 
                <td> 
                    <asp:RadioButtonList ID="rblStatus" runat="server" AutoPostBack="true" OnSelectedIndexChanged="Status_Select"
                        <asp:ListItem Text=" In" Value="1" /> 
                        <asp:ListItem Text=" Out" Value="2" /> 
                        <asp:ListItem Text=" Extended" Value="3" /> 
                    </asp:RadioButtonList> 
                </td> 
                <td> 
                    <asp:RadioButtonList ID="rblReason" runat="server" /> 
                </td> 
                <td> 
                 
                </td> 
            </tr> 
        </table> 
    </telerik:RadAjaxPanel> 
</div> 

The ascx codebehind has:
    protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!IsPostBack) { Load_Vars(); } 
    } 
    protected void Load_Vars() 
    { 
        hlStatus.NavigateUrl = "javascript:void(ModalBox.DisplayAjaxContents('" + RadAjaxPanel1.ClientID + "'));"; 
        hlStatus.Text = "signed out"
    } 
 
    protected void Status_Select(object sender, EventArgs e) 
    { 
         
    } 
 

Anyone have any suggestions?
Tsvetoslav
Telerik team
 answered on 21 Oct 2009
1 answer
111 views

page that I use within a window. if I add the FormDecorator to the page, I cannot hit the enter key to force the click event.

Is there something inherent wihin the Office2007 skin that prevents the Enter key on buttons?  Or is this something with RadDecorator in general?

I am setting the global skin in the web.config.

Simple page:

 

<%

@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>

 

 

 

<!

 

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 runat="server">

 

 

 

 

 

<title>Untitled Page</title>

 

</

 

head>

 

<

 

body>

 

 

 

 

 

<form id="form1" runat="server">

 

 

 


<
telerik:RadScriptManager ID="RadScriptManager1" runat="server">

 

 

 

 

 

</telerik:RadScriptManager>

 

 

 

 

 

<div id="divMain">

 

 

 

 

 

<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecorationZoneID="divMain" />

 

 

 

 

 

<asp:Button ID="Button1" runat="server" Text=".net button" /></div>

 

 

 

 

 

</form>

 

</

 

body>

 

</

 

html>

 

Georgi Tunev
Telerik team
 answered on 21 Oct 2009
1 answer
508 views
Dear Telerik,

I'm trying to let one RadDateTimePicker communicate with another RadDateTimePicker; when I change the date and or time in the first control, I want to calculate the difference between the old and the new value and pass the difference to the other RadDateTimePicker, so I did the following:

In my AppFormView I created two RadDateTimePickers:

<telerik:RadDateTimePicker ID="rdtpAppointments_StartTime" SelectedDate='<%# Bind("StartedOn") %>' runat="server">  
  <DateInput> 
    <ClientEvents OnValueChanged="OnDateSelected" /> 
  </DateInput> 
</telerik:RadDateTimePicker> 

And
<telerik:RadDateTimePicker ID="rdtpAppointments_EndTime" runat="server" SelectedDate="<%# Bind('EndedOn') %>" /> 

I wrote the following Javascript code:

function OnDateSelected(sender, eventArgs) {  
    var endTimePicker = document.getElementById('<%= AppFormView.FindControl("rdtpAppointments_EndTime").ClientID%>'); ;  
 
    var newValue = new Date(eventArgs.get_newDate());  
    var oldValue = new Date(eventArgs.get_oldDate());  
    var difference = Math.round((newValue - oldValue) / 86400000);  
 
    var oldDate = new Date(endTimePicker.get_selectedDate())  
    var newDate = oldDate.setDate(oldDate.getDate()+difference);  
 
    endTimePicker.set_selectedDate() = newDate;      
  } 

In short it retrieves the old and new date for the first combobox, it calculates the difference in days and then I want to retrieve the current date selected in the RadDateTimePicker and add the same difference to it.

Only, I get the following error: endTimePicker.get_selectedDate is not a function, on the "var oldDate"-line.

What am I doing wrong?! When I look here, get_selectedDate is simply documented...


Shinu
Top achievements
Rank 2
 answered on 21 Oct 2009
10 answers
211 views
Hi there,

When using the Document Manager to insert links to documents, sometimes we want to update an existing link in the content also. When you position the cursor over a hyperlink and select a new document with the Doc Mgr, the default behaviour overwrites the entire A structure with a simple A tag. Some of our links have CSS Classes attached, an image as part of the link, etc.

Is there any solution to make this slightly more intelligent when updating an existing link?

Thanks
Gavin
Lini
Telerik team
 answered on 21 Oct 2009
2 answers
287 views
Hi there

I want to use a NestedViewTemplate in a RadGrid and then selectively display information depending on the status of a specific field.

I am working on a project where I want to display data, but depending on the type of entry (specified in a specific field) I need to show or hide some fields, or preferably templates in different panels.

e.g.

Type: Car
Engine: 2000cc
Color: Metalic Blue

Type: Bicycle
Color: Blue

Type: Motorcycle
Engine: 1000cc
Color: Red

In the second case (Type: Bicycle), the "Engine" field is not applicable, so I want to be able to hide it.

Any suggestions as to how this can be done?

One possibility is to hide the table row, another is to have different panels with a unique template in each and then show or hide the panels depending on the the value in the "Type" field.  I would prefer this kind of approach, if possible.

How can this be achieved?

Thanks.

Gerrit
Gerrit du Preez
Top achievements
Rank 1
 answered on 21 Oct 2009
1 answer
377 views
Hello, I am trying to make my grid be able to client side column resize without making the grid larger.....

In essence, when the user makes one grid column larger, the rest get smaller to fit the screen.  I know it is possible because I ran across one of your examples that did it, however I copied the settings in the clientside section and it didn't work for me....the grid width still grew to larger than my screen width.  Here is my grid:

        <telerik:RadGrid ID="RadGrid1" runat="server" Skin="Sunset" AllowSorting="true" ShowFooter="true">  
          
 
<MasterTableView Width="100%">  
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
</MasterTableView> 
 
 
        <ClientSettings AllowColumnHide="true">  
            <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
            <Resizing AllowColumnResize="true" ClipCellContentOnResize="true" /> 
        </ClientSettings> 
          
        </telerik:RadGrid> 
What I am doing wrong?

Thanks...

UPDATE - I had some CSS styles that were screwing up the grid in the header of my page....the grid now correctly stays within the desired area but presents a scroll bar at the bottom to view data that gets pushed out of the screen.....which is acceptable, but I would still like to know how to make the other columns resize automatically.
Pavlina
Telerik team
 answered on 21 Oct 2009
0 answers
94 views
sorry, I should post it in wpf section. please delete this
L uke
Top achievements
Rank 1
 asked on 21 Oct 2009
1 answer
113 views
I need to loop through the items in my toolbar client-side and set some specific properties if the item is a button and based upon it's "Group" property. When  I Ioop through, how do I first determine if the item is a RadToolbarButton (and therefore has the get_group method available? There doesn't seem to be a get_ItemType client-side method.
Yana
Telerik team
 answered on 21 Oct 2009
2 answers
178 views
Telerik Team,

I'm trying to change the editor control for a specific field ("Description" field), from a textBox to a RadEditor (because I want a multiline edit for this value).
Everything works just fine if I use a GridBoundColumn, but when I try to use a GridHTMLEditorColumn (as described in some demo), the value of the editor is not well transmitted to the objects accessible in UpdateCommand (as well as in InsertCommand which is handled by the same function).

Maybe I'm doing something wrong ? Maybe I'm too "in the code" to see what's really on it ? Could you please review my uses of the Telerik objects and give me a potential solution ?

<%@ Control Language="vb" Inherits="Scam.AnnuairePro.Edit" AutoEventWireup="false" 
    Explicit="True" CodeBehind="EditAnnuairePro.ascx.vb" %> 
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
    <script type="text/javascript"
            function RowDblClick(sender, eventArgs) 
            { 
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical()); 
            } 
    </script> 
</telerik:RadCodeBlock> 
 
 <style type="text/css"
    .GridEditRow_Default  
    { 
        background:#cccccc !important; 
    } 
    .GridEditRow_Default a  
    { 
        color:#333333; 
        } 
    </style> 
 
<asp:Label runat="server" ID="lblMessage"></asp:Label> 
<telerik:RadGrid ID="RadGrid1" GridLines="None" ShowStatusBar="True" PageSize="15" 
    AllowPaging="True" AllowSorting="False" runat="server" ShowGroupPanel="True"  EnableViewState="True"
    <mastertableview autogeneratecolumns="false" commanditemdisplay="TopAndBottom" enablenorecordstemplate="true" 
        allowautomaticinserts="true" editmode="editForms" allowautomaticupdates="true" 
        datakeynames="ItemId" onupdatecommand="RadGrid1_UpdateCommand" onneeddatasource="RadGrid1_NeedDataSource" 
        showstatusbar="true" oninsertcommand="RadGrid1_UpdateCommand" ondeletecommand="RadGrid1_DeleteCommand"
        <GroupByExpressions> 
                    <telerik:GridGroupByExpression> 
                        <SelectFields> 
                            <telerik:GridGroupByField FieldAlias="Categorie" FieldName="CategoryID"></telerik:GridGroupByField> 
                        </SelectFields> 
                        <GroupByFields> 
                            <telerik:GridGroupByField FieldName="CategoryID" SortOrder="Ascending"></telerik:GridGroupByField> 
                        </GroupByFields> 
                    </telerik:GridGroupByExpression> 
                </GroupByExpressions> 
            <Columns> 
            <telerik:GridButtonColumn CommandName="MoveUp" Text="Move Up" UniqueName="MoveUp" ButtonType="ImageButton"
                    </telerik:GridButtonColumn> 
                         <telerik:GridButtonColumn CommandName="MoveDown" Text="Move Down" UniqueName="MoveDown" ButtonType="ImageButton"
                    </telerik:GridButtonColumn> 
            <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete" /> 
            <telerik:GridEditCommandColumn UpdateText="Update" UniqueName="EditCommandColumn" 
                        CancelText="Cancel" EditText="Edit"></telerik:GridEditCommandColumn> 
                <telerik:GridBoundColumn DataField="Titre" HeaderText="Titre" UniqueName="Titre" 
                    SortExpression="Titre"
                </telerik:GridBoundColumn> 
                <telerik:GridHTMLEditorColumn  DataField="Description" HeaderText="Description" UniqueName="Description" 
                    SortExpression="Description"
                </telerik:GridHTMLEditorColumn > 
                <telerik:GridBoundColumn DataField="Adresse" HeaderText="Adresse" UniqueName="Adresse" 
                    SortExpression="Adresse"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Telephone" HeaderText="Telephone" UniqueName="Telephone" 
                    SortExpression="Telephone"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="URL" HeaderText="URL" UniqueName="URL" 
                    SortExpression="URL"></telerik:GridBoundColumn> 
                     
                <telerik:GridBoundColumn DataField="Courriel" HeaderText="Courriel" UniqueName="Courriel" 
                    SortExpression="Courriel"></telerik:GridBoundColumn> 
                    
                      <telerik:GridBoundColumn DataField="CategoryID"  
                      HeaderText="Categorie" UniqueName="CategoryID" 
                    SortExpression="CategoryID"
                    </telerik:GridBoundColumn> 
                     
                    <telerik:GridDropDownColumn UniqueName="CategoriesList" 
                        SortExpression="SortOrderInfoID" 
                        HeaderText="Categorie" ListTextField="Titre" 
                        ListValueField="CategoryID"  
                        DataField="CategoryID"  
                        visible="false"
                        </telerik:GridDropDownColumn> 
                         
                <telerik:GridBoundColumn DataField="LastModificationDate" HeaderText="Date de derni&egrave;re modification" UniqueName="LastModificationDate" 
                    SortExpression="LastModificationDate"></telerik:GridBoundColumn> 
                     
                <telerik:GridBoundColumn DataField="LastModificationUserID" HeaderText="par" UniqueName="LastModificationUserID" 
                    SortExpression="LastModificationUserID"></telerik:GridBoundColumn> 
                         
                         
            </Columns> 
            <EditFormSettings CaptionFormatString="Edition des d&eacute;tails de l'entr&eacute;e nommée {0}" CaptionDataField="Titre"
                    <FormTableItemStyle Width="100%" Height="29px"></FormTableItemStyle> 
                    <FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle> 
                    <FormStyle Width="100%" BackColor="#eef2ea"></FormStyle> 
                    <EditColumn ButtonType="ImageButton" /> 
                </EditFormSettings> 
              
                 <NoRecordsTemplate></NoRecordsTemplate
        </mastertableview> 
    <clientsettings> 
                <ClientEvents OnRowDblClick="RowDblClick" /> 
                <Resizing 
                    AllowColumnResize="True" 
                    AllowRowResize = "false" 
                    ResizeGridOnColumnResize = "false" 
                    ClipCellContentOnResize = "true" 
                    EnableRealTimeResize = "true" /> 
            </clientsettings> 
    <pagerstyle mode="NextPrevAndNumeric" /> 
</telerik:RadGrid> 
<p> 
    <asp:LinkButton CssClass="CommandButton" ID="cmdCancel" resourcekey="cmdReturn" runat="server" 
        BorderStyle="none" Text="Retour" CausesValidation="False"></asp:LinkButton> 
</p> 
 


' 
' DotNetNuke® - http://www.dotnetnuke.com 
' 
 
Imports DotNetNuke 
Imports DotNetNuke.Common 
Imports DotNetNuke.Services.Exceptions 
Imports DotNetNuke.Services.Localization 
Imports DotNetNuke.Entities.Users 
 
Imports Telerik.Web.UI 
Imports Telerik.Web.UI.Editor 
Imports System.Drawing 
 
 
 
Namespace MyCompany.MyClass 
 
    ''' ----------------------------------------------------------------------------- 
    ''' <summary> 
    ''' The EditMyClass class is used to manage content 
    ''' </summary> 
    ''' <remarks> 
    ''' </remarks> 
    ''' <history> 
    ''' </history> 
    ''' ----------------------------------------------------------------------------- 
    Partial Class Edit 
        Inherits Entities.Modules.PortalModuleBase 
#Region "Private Members" 
 
        Private ItemId As Integer = Null.NullInteger ' -1 
#End Region 
#Region "Event Handlers" 
 
        ''' ----------------------------------------------------------------------------- 
        ''' <summary> 
        ''' Page_Load runs when the control is loaded 
        ''' </summary> 
        ''' <remarks> 
        ''' </remarks> 
        ''' <history> 
        ''' </history> 
        ''' ----------------------------------------------------------------------------- 
        Private Sub Page_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load, Me.Load 
            Try 
 
 
                ' Generates false entries 
                'Dim objA As New MyClassInfo 
                'Static RandomNumGen As New System.Random 
                'objA.Titre = "Test " & RandomNumGen.Next 
                'objA.Description = "Desc " & RandomNumGen.Next 
                'APCtl.AddEntry(objA) 
 
 
 
                Me.RadGrid1.DataSource = Me.EmployeesData 
                If Not Me.Page.IsPostBack Then 
                    ' Define current texts 
                    Me.RadGrid1.MasterTableView.NoRecordsTemplate = New NoRecordsTemplate("lblNoEntry.Text"Me.LocalResourceFile) 
                End If 
 
 
            Catch exc As Exception    'Module failed to load 
                ProcessModuleLoadException(Me, exc) 
            End Try 
        End Sub 
 
        Private Sub RadGrid1_UpdateCommand(ByVal source As System.ObjectByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand, RadGrid1.InsertCommand 
 
            Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) 
            Dim editMan As GridEditManager = editedItem.EditManager 
 
            Dim ID As String = Null.NullInteger  
            If Not e.Item.ItemIndex = Null.NullInteger Then 
                ID = (CType(e.Item, GridEditFormItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ItemId").ToString 
            End If 
 
            Dim column As GridColumn 
            Dim objAP As New MyClassInfo 
 
            For Each column In e.Item.OwnerTableView.Columns 
                If TypeOf column Is IGridEditableColumn Then 
                    Dim editableCol As IGridEditableColumn = CType(column, IGridEditableColumn) 
                    If (editableCol.IsEditable) Then 
                        Dim editor As IGridColumnEditor = editMan.GetColumnEditor(editableCol) 
 
                        Dim editorType As String = CType(editor, Object).ToString() 
                        Dim editorText As String = "unknown" 
                        Dim editorValue As Object = Nothing 
 
                        If (TypeOf editor Is GridHTMLEditorColumnEditor) Then   ' The RadEditor 
                            editorText = CType(editor, GridHTMLEditorColumnEditor).Editor.Text 
                            editorValue = CType(editor, GridHTMLEditorColumnEditor).Editor.Text 
                        End If 
 
                        If (TypeOf editor Is GridTextColumnEditor) Then 
                            editorText = CType(editor, GridTextColumnEditor).Text 
                            editorValue = CType(editor, GridTextColumnEditor).Text 
                        End If 
 
                        If (TypeOf editor Is GridBoolColumnEditor) Then 
                            editorText = CType(editor, GridBoolColumnEditor).Value.ToString() 
                            editorValue = CType(editor, GridBoolColumnEditor).Value 
                        End If 
 
                        If (TypeOf editor Is GridDropDownColumnEditor) Then 
                            editorText = CType(editor, GridDropDownColumnEditor).SelectedText & "; " & CType(editor, GridDropDownColumnEditor).SelectedValue 
                            editorValue = CType(editor, GridDropDownColumnEditor).SelectedValue 
                        End If 
 
                        Try 
 
                            If Not ID = "-1" Then 
                                Dim changedRows As DataRow() = Me.EmployeesData.Tables("Employees").Select("ItemId = " & editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("ItemId")) 
                                ' Chaque DropDownList effectuant des transformations devra avoir sa transformation 
                                If column.UniqueName = "CategoriesList" Then 
                                    changedRows(0)("CategoryID") = editorValue 
                                Else 
                                    changedRows(0)(column.UniqueName) = editorValue 
                                End If 
 
                                Me.EmployeesData.Tables("Employees").AcceptChanges() 
 
                            End If 
 
                            Select Case column.UniqueName 
                                Case "ItemId" 
                                    objAP.ItemId = CType(editorValue, Integer
                                Case "Titre" 
                                    objAP.Titre = editorValue 
                                Case "Description"  ' The RadEditor 
                                    objAP.Description = editorValue 
                                Case "Adresse" 
                                    objAP.Adresse = editorValue 
                                Case "Telephone" 
                                    objAP.Telephone = editorValue 
                                Case "URL" 
                                    objAP.URL = editorValue 
                                Case "Courriel" 
                                    objAP.Courriel = editorValue 
                                Case "CategoriesList" 'Equivalent unique de CategoryID, soit la liste deroulante 
                                    objAP.CategoryID = CType(editorValue, Integer
 
                            End Select 
 
                        Catch ex As Exception 
                            SetMessage("<strong>Unable to set value of column '" & column.UniqueName & "'</strong> - " + ex.Message) 
                            e.Canceled = True 
                        End Try 
 
 
 
                    End If 
                End If 
            Next 
            If Not e.Canceled = True Then 
                Dim objAPCtl As New MyClassController 
 
                ' TimeStamp actualisation 
                objAP.LastModificationDate = Date.Now 
                objAP.LastModificationUserID = Me.UserId 
 
                If ID = Null.NullInteger.ToString Then 
                    ' New entry 
                    objAPCtl.AddEntry(objAP) 
                    SetMessage("Entree ajoutee"
 
                    Dim MyEmployeesData As DataSet = New DataSet 
 
                    Dim APCtl As New MyClassController 
                    Dim objAPs As New List(Of MyClassInfo) 
                    objAPs = APCtl.GetEntries() 
                    Dim objC As New CollectionToDataSet(objAPs) 
 
                    ' I convert the collection to Dataset in order to remain comparable with Telerik samples as found in your intranet 
                    MyEmployeesData = objC.CreateDataSet 
 
                    ' Define PK on Dataset for .Find() method 
                    Dim pk(1) As DataColumn 
                    pk(0) = MyEmployeesData.Tables(0).Columns("ItemId"
                    MyEmployeesData.Tables(0).PrimaryKey() = pk 
 
                    Me.EmployeesData = MyEmployeesData 
 
                    ' GiveDataSource() 
                    ' Rebind and close edit window 
                    ' TODO : Find a way to rebind and close the edit window 
                    ' TODO Note : (Seb) The methods given by Telerik on forums and samples doesn't works here (Version 2008..1314 problem ?) 
                    Response.Redirect(NavigateURL(Request.QueryString("ctl"), "mid=" & Request.QueryString("mid"))) 
 
                Else 
                    ' Update 
                    Dim objAPorigin As New MyClassInfo 
                    objAPorigin = objAPCtl.GetEntryByID(ID) 
 
                    ' Here is a list of the columns not displayed in the Grid 
                    objAP.ItemId = objAPorigin.ItemId 
                    objAP.SortOrderInfoID = objAPorigin.SortOrderInfoID 
 
                    ' Update LastSortOrder when category changes 
                    Dim booClearCache As Boolean = False 
                    If objAP.CategoryID <> objAPorigin.CategoryID Then 
                        objAPCtl.UpdateSortOrder(objAP.SortOrderInfoID, objAPCtl.GetLastSortOrder(Constantes.ItemType.Entree, objAP.CategoryID).SortOrder + 1, objAP.CategoryID) 
                        ' booClearCache = True 
                    End If 
 
                    objAPCtl.UpdateEntry(objAP) 
 
                    Me.RadGrid1.MasterTableView.ClearEditItems() 
 
                    ' If booClearCache Then 
                    ' Enforce update on the grid 
                    ' Refresh cat group if needed 
                    ' Refresh timeStamp 
                    Me.Session.Remove("EmployeesData"
                    Me.RadGrid1.DataSource = Me.EmployeesData 
                    Me.RadGrid1.DataBind() 
                    'End If 
 
                    SetMessage("Entry updated"
 
                End If 
            End If 
        End Sub 
 
        Private Sub RadGrid1_ItemDataBound(ByVal sender As ObjectByVal e As GridItemEventArgs) Handles RadGrid1.ItemDataBound 
            If (TypeOf e.Item Is GridEditableItem AndAlso CType(e.Item, GridEditableItem).IsInEditMode) Then 
                Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) 
                Dim editMan As GridEditManager = editedItem.EditManager 
 
                Dim editor As GridDropDownColumnEditor = CType(editMan.GetColumnEditor("CategoriesList"), GridDropDownColumnEditor) 
 
                Dim htmleditor As GridHTMLEditorColumnEditor = CType(editMan.GetColumnEditor("Description"), GridHTMLEditorColumnEditor) 
                Dim objRadE As RadEditor = CType(htmleditor.ContainerControl.Controls(0), RadEditor) 
 
                objRadE.CssClass = "MyRadEditor" 
                objRadE.AutoResizeHeight = True 
 
                ' TODO 
                'objRadE.EditModes = EditModes.All 
                objRadE.EnableResize = False 
                objRadE.ToolbarMode = EditorToolbarMode.ShowOnFocus 
                objRadE.Tools.Clear() 
                Dim main As New EditorToolGroup() 
                objRadE.Tools.Add(main) 
                Dim bold As New EditorTool() 
                bold.Name = "Bold" 
                bold.ShortCut = "CTRL+B" 
                main.Tools.Add(bold) 
                Dim italic As New EditorTool() 
                italic.Name = "Italic" 
                italic.ShortCut = "CTRL+I" 
                main.Tools.Add(italic) 
                Dim underline As New EditorTool() 
                underline.Name = "Underline" 
                underline.ShortCut = "CTRL+U" 
                main.Tools.Add(underline) 
 
 
 
                Dim ID As String = "-1" 
 
                If Not e.Item.ItemIndex = -1 Then 
                    ID = (CType(e.Item, GridEditFormItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ItemId").ToString 
                End If 
 
                ' Hides some columns 
                editedItem("CategoryID").Parent.Visible = False 
                editedItem("LastModificationDate").Parent.Visible = False 
                editedItem("LastModificationUserID").Parent.Visible = False 
 
                ' Modify the list control as per custom conventions 
                Dim objAPCtl As New MyClassController 
                Dim objCats As New List(Of CategoryInfo) 
 
                Dim objEmptyCat As New CategoryInfo 
                objEmptyCat.CategoryID = 0 
                objEmptyCat.SortOrderInfoId = -1 
                objEmptyCat.Titre = "--   Choose   --" 
                objCats.Add(objEmptyCat) 
 
                objCats.AddRange(objAPCtl.GetCategories()) 
 
                editor.DataTextField = "Titre" 
                editor.DataValueField = "CategoryID" 
                editor.DataSource = objCats 
                Editor.DataBind() 
 
                If Not ID = -1 Then 
                    Dim objPA As New MyClassInfo 
                    objPA = objAPCtl.GetEntryByID(ID) 
                    'If Not editedItem("CategoryID") Is Nothing Then 
                    ' TODO : (seb) We should be able to get the CategoryId from the context RadGrid but I don't know how asap. 
                    editor.SelectedValue = objPA.CategoryID.ToString 
                    'CType(editedItem("CategoryID").Controls(0), TextBox).Text 
                    'End If 
                End If 
 
                'And so on 
            ElseIf (TypeOf e.Item Is GridDataItem AndAlso Not e.Item.IsInEditMode) Then 
                Dim item As GridDataItem = e.Item 
 
                ' Replaces some values of the grid so the user has a better comprehension of the stored data 
                Dim ObjAPCtl As New MyClassController 
 
                Dim catID As String = item("CategoryID").Text 
                If catID = "-1" Or catID = "0" Or catID = Null.NullString Then 
                    ' No category 
                    item("CategoryID").Text = "-" 
                Else 
                    ' Category given 
 
                    Dim ObjCat As New CategoryInfo 
                    ObjCat = ObjAPCtl.GetCategoryByID(CType(catID, Integer)) 
                    item("CategoryID").Text = ObjCat.Titre 
 
                End If 
 
                ' Crop the Description which could be very long 
                If item("Description").Text.Length >= 100 Then 
                    item("Description").Text = item("Description").Text.Substring(0, 100) & "[...]" 
                End If 
 
                ' Replace the UserID by the display name 
                Dim objUCtl As New UserController 
                item("LastModificationUserID").Text = objUCtl.GetUser(Me.PortalId, CType(item("LastModificationUserID").Text, Integer)).DisplayName 
 
                ' The date 
                'item("LastModificationDate").Text = CType(item("LastModificationDate").Text, Date).ToLongDateString & " " & CType(item("LastModificationDate").Text, Date).ToLongTimeString 
 
                ' The sortOrder 
                CType(item("MoveUp").Controls(0), ImageButton).ImageUrl = ResolveUrl("~/images/action_up.gif"
                CType(item("MoveDown").Controls(0), ImageButton).ImageUrl = ResolveUrl("~/images/action_down.gif"
 
                Dim ID As String = "-1" 
 
                If Not e.Item.ItemIndex = -1 Then 
                    ID = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ItemId").ToString 
                End If 
 
                ' TODO : Update Telerik.Web.UI and use Drag'n'Drop for Re-ordering 
 
                Dim LastSortIndex As Integer = ObjAPCtl.GetLastSortOrder(Constantes.ItemType.Entree, catID).SortOrder 
                Dim MySortIndex As Integer = ObjAPCtl.GetSortOrderByID(ObjAPCtl.GetEntryByID(ID).SortOrderInfoID).SortOrder 
 
                If MySortIndex = LastSortIndex And MySortIndex = 1 Then 
                    ' 1 entry only 
                    item("MoveUp").Controls(0).Visible = False 
                    item("MoveDown").Controls(0).Visible = False 
                ElseIf MySortIndex = LastSortIndex Then 
                    ' End of the list 
                    item("MoveDown").Controls(0).Visible = False 
                ElseIf MySortIndex = 1 Then 
                    ' Start of the list 
                    item("MoveUp").Controls(0).Visible = False 
                End If 
 
 
 
            End If 
        End Sub 
 
 
        Private Sub RadGrid1_ItemCommand(ByVal source As System.ObjectByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand 
            If e.Item.GetType.Equals(GetType(GridDataItem)) Then 
 
 
                ' TODO : Update Telerik.Web.UI and use Drag'n'Drop for Re-ordering 
 
 
                ' Up/Down for re-ordering 
                Dim item As GridDataItem = CType(e.Item, GridDataItem) 
 
                Dim ID As String = "-1" 
                If Not e.Item.ItemIndex = -1 Then 
                    ID = item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ItemId").ToString 
                End If 
 
                Dim objAPCtl As New MyClassController 
                Dim objAP As MyClassInfo = objAPCtl.GetEntryByID(ID) 
 
                If e.CommandName = "MoveUp" Then 
                    objAPCtl.UpdateSortOrderByMove(objAP.SortOrderInfoID, Constantes.ItemType.Entree, objAP.CategoryID, True
                ElseIf e.CommandName = "MoveDown" Then 
                    objAPCtl.UpdateSortOrderByMove(objAP.SortOrderInfoID, Constantes.ItemType.Entree, objAP.CategoryID, False
                End If 
 
                Me.Session.Remove("EmployeesData"
                Me.RadGrid1.DataSource = Me.EmployeesData 
                Me.RadGrid1.DataBind() 
            End If 
        End Sub 
 
 
 
        Private Sub GiveDataSource() 
            RadGrid1.DataSource = Me.EmployeesData 
            Me.EmployeesData.Tables("Employees").PrimaryKey = New DataColumn() {Me.EmployeesData.Tables("Employees").Columns("ItemId")} 
        End Sub 
 
        Private Sub RadGrid1_NeedDataSource(ByVal source As System.ObjectByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource 
            If Not Me.EmployeesData Is Nothing Then 
                GiveDataSource() 
            Else 
                Me.RadGrid1.DataSource = New List(Of MyClassInfo) 
            End If 
        End Sub 
 
        Private Sub Page_PreRender(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.PreRender 
            If Not MyBase.IsPostBack Then 
                ' Me.RadGrid1.MasterTableView.Items(0).Edit = True 
                Me.RadGrid1.MasterTableView.Rebind() 
            End If 
        End Sub 
 
        Protected Sub RadGrid1_DeleteCommand(ByVal source As ObjectByVal e As GridCommandEventArgs) Handles RadGrid1.DeleteCommand 
            Dim ID As String = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ItemId").ToString 
 
            Dim MyEmployeesData As DataSet = New DataSet 
            MyEmployeesData = Me.EmployeesData 
 
            Dim employeeTable As DataTable = MyEmployeesData.Tables("Employees"
            If Not (employeeTable.Rows.Find(ID) Is NothingThen 
                employeeTable.Rows.Find(ID).Delete() 
                employeeTable.AcceptChanges() 
            End If 
 
            Me.EmployeesData = MyEmployeesData 
 
            GiveDataSource() 
 
            Dim APCtl As New MyClassController 
            APCtl.DeleteEntryById(ID) 
 
            SetMessage("Entree " & ID & " deleted"
 
 
        End Sub 
 
        Protected Sub SetMessage(ByVal message As String
            RadGrid1.Controls.Add(New LiteralControl(message)) 
        End Sub 
 
        Public Property EmployeesData() As DataSet 
            Get 
                Dim obj As Object = Me.Session("EmployeesData"
                If Not obj Is Nothing Then 
                    Return CType(obj, DataSet) 
                End If 
 
                Dim MyEmployeesData As DataSet = New DataSet 
 
                Dim APCtl As New MyClassController 
                Dim objAPs As New List(Of MyClassInfo) 
                objAPs = APCtl.GetEntries() 
 
                ' No entries ? 
                If objAPs.Count > 0 Then 
 
                    Dim objC As New CollectionToDataSet(objAPs) 
 
                    ' I convert the collection to Dataset in order to remain comparable with Telerik samples as found in your intranet 
                    MyEmployeesData = objC.CreateDataSet 
 
                    ' Define PK on Dataset for .Find() method 
                    Dim pk(1) As DataColumn 
                    pk(0) = MyEmployeesData.Tables(0).Columns("ItemId"
                    MyEmployeesData.Tables(0).PrimaryKey() = pk 
 
                    Me.Session("EmployeesData") = MyEmployeesData 
 
                    Return MyEmployeesData 
                Else 
                    ' No entries . 
                    Return Nothing 
                End If 
 
            End Get 
            Set(ByVal value As DataSet) 
                Me.Session("EmployeesData") = value 
            End Set 
        End Property 
 
 
 
        ''' ----------------------------------------------------------------------------- 
        ''' <summary> 
        ''' cmdCancel_Click runs when the cancel button is clicked 
        ''' </summary> 
        ''' <remarks> 
        ''' </remarks> 
        ''' <history> 
        ''' </history> 
        ''' ----------------------------------------------------------------------------- 
        Private Sub cmdCancel_Click(ByVal sender As ObjectByVal e As EventArgs) Handles cmdCancel.Click 
            Try 
                Response.Redirect(NavigateURL(), True
            Catch exc As Exception    'Module failed to load 
                ProcessModuleLoadException(Me, exc) 
            End Try 
        End Sub 
#End Region 
 
    End Class 
 
End Namespace 




Sébastien
Top achievements
Rank 2
 answered on 21 Oct 2009
1 answer
120 views
I have a Chart inside a Splitter Pane.

If chart haven't zooming and scrolling enabled, all work fine (the HTML overflow of chart image are correctly scrolled inside splitter panel).
When i enable the Chart zooming and scrolling feature, the chart div container style is set to "position:absolute" and the result is who the image trespass the splitter panel limit.

Have you a solution?


(Sorry for my english)
Best Regards.
Matteo
Vladimir Milev
Telerik team
 answered on 21 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?