Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
53 views
Hello,
use the object radupload to send images to a remote server ... I have a problem with the TargetFolder. If I set the object properties of the folder, the transfer on the server is ok, but if you pass the path to the folder using vb net, transferring the image is not there. Why? Here is the code I use.
Protected Sub Imgbtncarica_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles Imgbtncarica.Click
    Dim _dir As String = Server.MapPath("/Image/image_card/1")
     If Directory.Exists(_dir) = False Then
     Directory.CreateDirectory(_dir)
     End If
     RadUpload1.TargetFolder = "/Image/image_card/1"
    If RadUpload1.UploadedFiles.Count > 0 Then
        Label1.Text = "File caricato: " & RadUpload1.UploadedFiles.Item(0).FileName & "(" &
    Else
        Label1.Visible = False
    End If
End Sub
Fabio Cirillo
Top achievements
Rank 1
 answered on 14 Dec 2012
7 answers
327 views
Hello,

Here is my situation. I am developing a portal page using Raddocks. On top of the page I will have a rad grid which will have a linkbutton with an onclick event on server side. When the user clicks on a linkbutton of a specific row of a radgrid, a new widget/dock should be created and added to the Layout. 

Every dock has a usercontrol in it which is loaded via a webservice. I am saving the state in the database from client side. My issue here is that whenever I am creating a new dock, all the existing docks are getting recreated and all the usercontrols are getting loaded again. I just want the user selected dock to be loaded. 

I know that I can use AsyncPostBackTrigger, but I am getting an error that it is not able to find the control that I am clicking(btnAddWidget) which is inside a RadGrid. I was wondering if there is any other way to handle this without having to re-create all the docks again. I have the flexibility to replace the RadGrid with any other control like a listview or something.

The following is my code:

Default.aspx:

   function OnClientDockPositionChanged(dock, args) {
                            SaveState();
                        }
                        function OnClientResizeEnd(dock, args) {
                            SaveState();
                        }
                       function OnClientCommand(dock, args) {
                            SaveState();
                        }
                        function SaveState() {
                            var i;
                            var state = "";
                           var zone1 = $find("RadDockZone1");
                            var zone2 = $find("RadDockZone2");
                            var array1Docks = zone1.get_docks();
                            var array2Docks = zone2.get_docks();
                            for (i = 0; i < array1Docks.length; i++) {
                                var dock = array1Docks[i];
                                var dockID = dock.get_id();
                                var tag = $get(dockID).attributes["tag"].value;
                                state = state + tag + "#" + array1Docks[i].saveClientState() + "|";
                            }
                            for (i = 0; i < array2Docks.length; i++) {
                                var dock = array2Docks[i];
                                var dockID = dock.get_id();
                                var tag = $get(dockID).attributes["tag"].value;
                                state = state + tag + "#" + array2Docks[i].saveClientState() + "|";
                            }
                            SOLEWebService.VerifyUserSessionAndUpdateUserSettings(state, success, onFail);
                        }
                      function success(result) {
                            alert("success");
                        }
                       function onFail(result) {
                            alert(result.d);
                        }
               function OnClientInitialize(dock, args) {
                var dockID = dock.get_id();
              var tag = $get(dockID).attributes["tag"].value;
              var UserControl = $get(dockID).attributes["UserControl"].value;
              if ($get(dockID).attributes["NewDock"] != null && $get(dockID).attributes["NewDock"].value != null) {
                  var newDock = $get(dockID).attributes["NewDock"].value;
                  var state = "";
                  state = tag + "#" + dock.saveClientState() + "|";
                  SOLEWebService.VerifyUserSessionAndSaveUserSettings(state, success, onFail);
              }
                 UserControlService.GetUserWidgetData(UserControl, tag, function (result) {
                 $get(dockID + "_C").innerHTML = result;
              });
          }
       <script src="/Scripts/JQuery/Scripts/JQuery-1.4.1-vsdoc.js" type="text/javascript"></script>
    </head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" EnablePageMethods = "true" EnableScriptCombine="true">
    <Services>
      <asp:ServiceReference Path = "~/UserControlService.asmx" />
      <asp:ServiceReference Path = "~/SOLEWebService.asmx" />
    </Services>
    </telerik:RadScriptManager>
  <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" EnableStyleSheetCombine="true">
    </telerik:RadStyleSheetManager>
      <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"  ClientEvents-OnResponseEnd = "RecallJquery">
        <asp:UpdatePanel runat="server" ID="UpdatePanel1">
        <ContentTemplate>
        <table>
        <tr>
        <td>
        <div id = "gridViewPanel" class = "ContainerPanel">
          <div id="gridViewHeader" class="collapsePanelHeader">
            <div id="Div2" class="HeaderContent">Add Stuff</div>
            <div id="Div3" class="ArrowClose"></div>
         </div>
          <div id = "gridContent" class = "Content" style="display:none">
                 <telerik:RadGrid runat="server" ID="grdWidgets" OnNeedDataSource="grdWidgets_NeedDataSource"
                    AllowPaging="True" Width="400px" >
                    <MasterTableView DataKeyNames="Widgets" Width="100%" TableLayout="Fixed">
                        <Columns>
                            <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="" ItemStyle-Width = "50px">
                        <ItemTemplate>
                            <asp:Panel ID="Panel1" runat="server">
                                <asp:LinkButton ID="btnAddWidget" runat="server"   Text = "Add" OnClick = "btnAddWidget_Click"  />
                            </asp:Panel>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
           </Columns>
                    </MasterTableView>
                    <ClientSettings AllowRowsDragDrop="True">
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
                      <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="320px" />
                    </ClientSettings>
                    <PagerStyle Mode="NumericPages" PageButtonCount="4" />
                </telerik:RadGrid>
         </div>
         </div>
        </td>
        </tr>
        </table>
       <telerik:RadDockLayout runat="server" ID="RadDockLayout1" OnLoadDockLayout="RadDockLayout1_LoadDockLayout">
        <table>
            <tr>
                <td style="vertical-align: top">
                    <telerik:RadDockZone ID="RadDockZone1" runat="server" Orientation="Vertical" Width="250px"
                        MinHeight="400px">
                     </telerik:RadDockZone>
                </td>
                <td style="vertical-align: top">
                    <telerik:RadDockZone ID="RadDockZone2" runat="server" Orientation="Vertical" Width="560px"
                        MinHeight="400px">
                     </telerik:RadDockZone>
                </td>
            </tr>
        </table>
        </telerik:RadDockLayout>
         </ContentTemplate>
       <%--  <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnAddWidget" EventName="Click" />
        </Triggers>--%>
            </asp:UpdatePanel>
            </telerik:RadAjaxPanel>
 
Code-Behind:
 Protected Sub grdWidgets_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs)
        grdWidgets.DataSource = PortalDataManager.GetDefaultWidgets()
    End Sub

    Private ReadOnly Property CurrentDockStates() As List(Of DockState)
        Get
            'Get saved state string from the database - set it to dockState variable for example 
            Dim dockStatesFromDB As String = String.Empty
           dockStatesFromDB = PortalDataManager.GetUserWidgetSettings(33357)
           Dim _currentDockStates As New List(Of DockState)()
            If dockStatesFromDB Is Nothing Then
                Return _currentDockStates
            End If
            If dockStatesFromDB Is String.Empty Then
                Return _currentDockStates
            End If
            Dim stringStates As String() = dockStatesFromDB.Split("|"c)
            For i As Integer = 0 To stringStates.Length - 2
                Dim currentState As String() = stringStates(i).Split("#"c)
                Dim uniqueName As String = currentState(0)
                Dim state As String = currentState(1)
                If state.Trim() <> String.Empty Then
                    Dim ds As DockState = DockState.Deserialize(state)
                    ds.Tag = uniqueName
                    ds.UniqueName = uniqueName
                    _currentDockStates.Add(ds)
                End If
            Next
     Return _currentDockStates
        End Get
    End Property
 
 Protected Sub RadDockLayout1_LoadDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs)
        Dim states As List(Of DockState) = CurrentDockStates
        For Each state As DockState In states
            e.Positions(state.UniqueName) = state.DockZoneID
            e.Indices(state.UniqueName) = state.Index
        Next
    End Sub

    Private Function CreateRadDockFromState(ByVal state As DockState) As RadDock
        Dim dock As New RadDock()
        dock.DockMode = DockMode.Docked
        dock.ID = String.Format("RadDock{0}", state.UniqueName)
        dock.ApplyState(state)
        SetDockProperties(dock)
        AddClientEventsToDock(dock)
        Return dock
    End Function

    Private Sub SetDockProperties(ByRef dock As RadDock)
        dock.AutoPostBack = False
        dock.CommandsAutoPostBack = False
        dock.Commands.Add(New DockCloseCommand())
        dock.Commands.Add(New DockExpandCollapseCommand())
        dock.EnableEmbeddedScripts = True
        dock.EnableRoundedCorners = True
        dock.EnableAnimation = True
    End Sub

    Private Sub AddClientEventsToDock(ByRef dock As RadDock)
        dock.OnClientInitialize = "OnClientInitialize"
        dock.OnClientResizeEnd = "OnClientResizeEnd"
        dock.OnClientDragEnd = "OnClientDragEnd"
        dock.OnClientDockPositionChanged = "OnClientDockPositionChanged"
        dock.OnClientCommand = "OnClientCommand"
    End Sub

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
         If (Not Page.IsPostBack) Then
        Dim dockCount As Integer = CurrentDockStates.Count
        For i As Integer = 0 To dockCount - 1
            If CurrentDockStates(i).Closed = False Then
                Dim dock As RadDock = CreateRadDockFromState(CurrentDockStates(i))
                RadDockLayout1.Controls.Add(dock)
                LoadUserControl(dock)
            End If
        Next
        End If
    End Sub

   Protected Sub btnAddWidget_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim btnAdd As LinkButton = CType(sender, LinkButton)
        Dim myPanel As Panel = CType(btnAdd.Parent, Panel)
        Dim dataItem As GridDataItem = CType(myPanel.NamingContainer, GridDataItem)
        Dim widgetType As String = dataItem("Widgets").Text
        Dim widgetTag As String = dataItem("WidgetTag").Text
        Dim userControl As String = dataItem("WidgetUserControl").Text
        Dim dock As RadDock = CreateRadDock(widgetTag)
        dock.Attributes("NewDock") = "True"
        dock.Attributes("UserControl") = userControl
        dock.Attributes("tag") = dock.Tag
        RadDockZone1.Controls.Add(dock)
        btnAdd.Text = "Added"
        btnAdd.Enabled = False
    End Sub

 Private Function CreateRadDock(ByVal tag As String) As RadDock
        Dim dock As New RadDock()
        dock.DockMode = DockMode.Docked
        dock.UniqueName = tag
        dock.Tag = tag
        dock.ID = String.Format("RadDock{0}", dock.UniqueName)
        dock.Title = "New Dock"
        SetDockProperties(dock)
        AddClientEventsToDock(dock)
        Dim img As New Image()
        img.ImageUrl = "Reload.gif"
        dock.ContentContainer.Controls.Add(img)
       Return dock
   End Function

   Protected Sub grdWidgets_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdWidgets.ItemCreated
        If TypeOf e.Item Is GridDataItem Then
            Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
            dataItem.ToolTip = dataItem("Widgets").Text
        End If
    End Sub

    Public Sub LoadUserControl(ByRef dock As RadDock)
        If dock.Tag Is Nothing Then
            Return
        End If
        Dim img As New Image()
        img.ImageUrl = "Reload.gif"
        dock.ContentContainer.Controls.Add(img)
        dock.Attributes("UserID") = 33357
        dock.Attributes("UserControl") = PortalDataManager.GetUserControlForWidget(dock.Tag)
        dock.Attributes("tag") = dock.Tag
    End Sub

Thanks so much for your time on this,

Uday.


Slav
Telerik team
 answered on 14 Dec 2012
1 answer
67 views
Hello Team!

We are developing a web part which make use of RadDateTimePicker & RadDatePicker. It works perfectly in our development environment. However, the controls are not responding when we deployed the solutions to UAT environment. The calendar icon is still showing but there is no response when we clicked on the icon. The JavaScript error below was thrown. Can anyone please advise what are the things that we should check when deploying the solution in a web part in SP2010?

Message: Object expected
Line: 5
Char: 32749
Code: 0
URI: http://test.mycompany.com/ScriptResource.axd?d=-MjrHJBff7jU9KF-pPP1Rni4KJhM1xhvUGHZPgnsV_4PX0zXBVRzYnzACX1YwxtYxGGb8ewfPZLoI5-lRHFijYA4VpfrgsAp0h09g8-1EZ7SrcwnEK2U-HIy4nTK5wOuuZPkDQ_UBlj4HM9U87AAQWVujuc1&t=ffffffffb868b5f4

Thanks in advance!


Maria Ilieva
Telerik team
 answered on 14 Dec 2012
4 answers
86 views
When I nest an AutoCompleteBox on a page other than the first page in a MultiPage the
text entered in the AutoCompletBox is hidden to the left of the cursor. Please see code
and screen shots.

<
div>
 
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1">
        <Tabs>
            <telerik:RadTab Text="TAB 1" PageViewID="RadPageView1" />
            <telerik:RadTab Text="TAB 2" PageViewID="RadPageView2" />
        </Tabs>
    </telerik:RadTabStrip>
 
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
         
        <telerik:RadPageView ID="RadPageView1" runat="server">
            <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" DataSourceID="ds" DataTextField="Name" DataValueField="Id" />
        </telerik:RadPageView>
         
        <telerik:RadPageView ID="RadPageView2" runat="server">
            ABC
        </telerik:RadPageView>
 
    </telerik:RadMultiPage>
 
</div>
 
<div>
 
    <telerik:RadTabStrip ID="RadTabStrip2" runat="server" MultiPageID="RadMultiPage2">
        <Tabs>
            <telerik:RadTab Text="TAB 3" PageViewID="RadPageView3" />
            <telerik:RadTab Text="TAB 4" PageViewID="RadPageView4" />
        </Tabs>
    </telerik:RadTabStrip>
 
    <telerik:RadMultiPage ID="RadMultiPage2" runat="server" SelectedIndex="0">
         
        <telerik:RadPageView ID="RadPageView3" runat="server">
            ABC
        </telerik:RadPageView>
 
        <telerik:RadPageView ID="RadPageView4" runat="server">
            <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox2" runat="server" DataSourceID="ds" DataTextField="Name" DataValueField="Id" />
        </telerik:RadPageView>
         
    </telerik:RadMultiPage>
 
    <asp:SqlDataSource ID="ds" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionStringDB %>" DataSourceMode="DataSet" SelectCommand="SELECT Id, Name FROM Table;" />
 
</div>
Morten
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 14 Dec 2012
9 answers
139 views
I've set the image icon on a radWindow as the following (using a relative path):

<telerik:RadWindow runat="server" ID="UserGuideWindow" Width="500px" Height="400px" Modal="false" Behaviors="Close,Minimize,Move" IconUrl="~/Img/help_small.png">

Users receive the security warning: "do you want to view only the webpage content that was delivered securely" in IE8 when visiting the page over SSL.

I looked in the page source and found this:
Sys.Application.add_init(function() {
    $create(Telerik.Web.UI.RadWindow, {"_dockMode":true,"_stylezindex":"80000","behaviors":38,"clientStateFieldID":"ctl00_UserGuideWindow_ClientState","formID":"aspnetForm","height":"400px","iconUrl":"//Img/help_small.png","minimizeIconUrl":"//Img/help_small.png","name":"UserGuideWindow","skin":"Sitefinity","title":"User Guide","width":"500px"}, null, null, $get("ctl00_UserGuideWindow"));
});

It looks like the icon is not being set correctly, and the browser thinks that the icon is content from another (unsecure) location.

I can confirm that removing the icon reference completely fixed the issue of the security warning being displayed.
Nicolaï
Top achievements
Rank 2
 answered on 14 Dec 2012
2 answers
261 views

I am using radcombo for grid filtering.I am using FilterTemplate for that

Is it possible to display the filter on clicking the header (label) or provide an icon next to header label?

Instead of showing them in a seperate row below header labels? If so, do you have any sample for that?
jason
Top achievements
Rank 1
 answered on 14 Dec 2012
5 answers
114 views
I've had posted my code snip in another forum : http://www.telerik.com/community/forums/aspnet-ajax/rotator/q3-2012-adds-border.aspx#2369096

  1. And I am wanting to figure out a way so that I can cache the result set being returned from the database, as I would be doing just the read operations & the data is not going to be updated per my application scenario.
  2. I also want to be able to retrieve the value of the first column of the selected row (cell selection should be disabled) in the code-behind. I looked at the help topics but could not find something that depicts same or similar to my query.

Thanks for your help,
-Aarsh

Maria Ilieva
Telerik team
 answered on 14 Dec 2012
1 answer
58 views
Hi !

I have a tooltip manager through which I am loading a user control inside tooltip using update panel. The user control contains 6 radio buttons and two command buttons. I want to display a loading panel inside tooltip on clicking command button. I tried out using RadAjaxManagerProxy and RadAjaxLoadingPanel but its not working. Can any one have idea?

Thanks,
Dev
Marin Bratanov
Telerik team
 answered on 14 Dec 2012
13 answers
361 views
Hello,
I am getting the following error message when I try to save the edited image to another location in the Image Editor:
"Cannot write to the target folder!"

I am using 2008.02.1001.2 version.

I did a search about this issue but i found the solution is useless for me since I use an old version.
So Please show me how to fix this bug.

Thank you,
Amr Saafan
http://amrsaafan.blogspot.com/
Vessy
Telerik team
 answered on 14 Dec 2012
4 answers
214 views
Hi there ! I tried to follow up this (http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplatedeclarativerelations/defaultcs.aspx) and also referred this (http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx) demo and my application it works in a similar way as that demo does. But I have a question for this :

What if I want to have >1 results in the nested grid for records in main grid ?

In terms of Northwind Database (to clarify) assume that I want to enlist customers in the main Grid and their Order History in the nested grid using some stored procedure (could not attach the txt file).

My application shows just one record in the nested (inner) grid at the moment. Is there a way to over-come this ?

Thanks,
-Aarsh


-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Attachment:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
USE [Northwind]
GO
/****** Object:  StoredProcedure [dbo].[CustOrderHist]    Script Date: 12/11/2012 09:26:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[CustOrderHist] @CustomerID nchar(5)
AS
SELECT ProductName, Total=SUM(Quantity)
FROM Products P, [Order Details] OD, Orders O, Customers C
WHERE C.CustomerID = @CustomerID
AND C.CustomerID = O.CustomerID AND O.OrderID = OD.OrderID AND OD.ProductID = P.ProductID
GROUP BY ProductName
Angel Petrov
Telerik team
 answered on 14 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?