Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
166 views
I have got my script working to restrict only one dock in a zone.

But the problem I am having is, it works only if I drag the dock below the current dock. Say there are two zones:

Zone Destination
---------------------------
Dock A

Zone Origin
---------------------------
Dock B

I am moving Dock B to Zone Destination, when it is dropped, the script will check if Zone Destination has more than 1 dock, if so, remove old dock and replace with new dock. Old dock will get sent back to Zone Origin.

It works fine, but only if I drag Dock B below Dock A. If I drag Dock B above Dock A, it will just append to the zone.

What am I missing here?

Here's the script:

 <script type="text/javascript">  
 
     function SetHandleDock(dock, args) {  
 
         dock.set_handle(document.getElementById(dock.get_id()));  
 
     }  
 
     var dockZoneID;  
     function checkMaximumDock(dock) {  
         var selectionZone = $find('<%= radDockZone.ClientID %>');  
         var newDockZoneID = dock.get_dockZoneID();  
         //if the dock is floated or dropped in the selection zone return    
         if (newDockZoneID == '' || selectionZone.get_clientID() == newDockZoneID) return;  
 
         if (dockZoneID != newDockZoneID) {  
             var dockZone = $find(newDockZoneID);  
             var docks = dockZone.get_docks();  
             if (docks.length > 1) {  
                 var oldDock = docks[0];  
                 oldDock.undock();  
                 selectionZone.dock(oldDock);  
                 dockZone.dock(dock);  
             }  
         }  
     }  
 
     function OnClientDragStart(dock) {  
         dockZoneID = dock.get_dockZoneID();  
          
     }    
      
 </script> 

For dock B:

radDock.OnClientDragEnd = "checkMaximumDock";  
radDock.OnClientDragStart = "OnClientDragStart"; 
Jim
Top achievements
Rank 1
 answered on 03 Aug 2009
3 answers
100 views
Hi,

I have implemented RadChart with Negative values but now need to add seprate background colors for the PlotArea above zero and below zero. Please let me know how it could be done.

Regards,
Arun
Giuseppe
Telerik team
 answered on 03 Aug 2009
1 answer
114 views
We are tyring to embed videos into our MOSS 07 instance... we have the latest Q2 editor release.

We are able to embed the video into a web part and it will save and play into the page...
however when using the editor as a field control the obect code is complety removed.

<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" type="application/x-shockwave-flash" width="425" height="344">
<param NAME="src" VALUE="http://www.youtube.com/v/GVC4Jxh6CZo">
<param name="movie" value="http://www.youtube.com/v/aUczKPXWLAM&amp;hl=en&amp;fs=1">
<param NAME="width" VALUE="425">
<param NAME="height" VALUE="350">
<param NAME="quality" VALUE="high">
<param NAME="play" VALUE="true">
<param name="allowFullScreen" value="true">
<param NAME="type" VALUE="application/x-shockwave-flash">
<param NAME="pluginspage" VALUE="http://www.macromedia.com/go/getflashplayer">
<embed src="http://www.youtube.com/v/aUczKPXWLAM&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" height="344" width="425"></embed>
</object>


Any ideas... this only happens in the pages we use the editor as a field control... pages where its a web part work fine.

thanks...
Rumen
Telerik team
 answered on 03 Aug 2009
4 answers
267 views
Hi there,

I have a client, that wants to lay some links over a pie diagramm. That means, by clicking on a piece, he wants to redirect to a predefined link. Is it possible to do this with telerik?

Thanks for Help,
Simon
Giuseppe
Telerik team
 answered on 03 Aug 2009
2 answers
151 views
Hi Telerik,

I am using ajax rad  tree view in our project. And there is a chance that user can put some html tags as node text.

For example if we use node text as <marquee>test</marquee>, the text is moving horizantally.
but it should render like "<marquee>test</marquee>"

Please suggest me to stop rendering the text as html.

Thanks in advance,
Balaji Velasiri.
Balaji
Top achievements
Rank 1
 answered on 03 Aug 2009
2 answers
90 views
I want to change the edit window and want to show my custom ASP controls in window for editing. is that possible?
Shinu
Top achievements
Rank 2
 answered on 03 Aug 2009
6 answers
127 views
Hello,

I have a bit problem with scheduler - I would like to display grouped items sorted by different property than the primary key, which I think is the default way that scheduler sorts by.

Now I have:
In C#:
var planesQuery = from plane in entities.PlaneSet orderby plane.PlaneCategory select plane; 
In scheduler: 
GroupBy="Plane"

This C# query selects planes correctly ordered, but scheduler does not show them in order defined by planesQuery, it reorders planes, they are sorted by primary key. I need something like OrderBy="Plane. PlaneCategory"

How can I solve this ? Thanks in advance.
Rudolf Kajan
Top achievements
Rank 1
 answered on 03 Aug 2009
0 answers
123 views
hi,

I am unable to implement ajax loading panel in my MVC application,

When ever i configure loading panel it raises an error "'System.Web.HttpUnhandledException' in

httpHandler.ProcessRequest(

HttpContext.Current);

 

 method.


Can anybody guide me how to use these feature in MVC.


Santhosh
Top achievements
Rank 1
 asked on 03 Aug 2009
3 answers
128 views
I have a "best practices" question I was hoping to get some insight on...

My project has a user control ("GridPanel") which consists of a RadGrid, plus a few other controls (such as an object data source) for controlling the behavior of the grid, custom paging, sorting, filtering, and AJAX.

I have created another user control ("ParentChildGridPanel") which nests two "GridPanel" user controls, one as the parent, and one as the child.  So far so good...

In the ParentChildGridPanel control, I want to add "Select" GridButtonColumn to the parent grid, so that clicking on it can return the primary key which I can use to populate the child grid with data.  Normally this would be a simple matter of hooking up the grids to a DataSet with two tables and a relationship between the tables, but in my case, everything needs to be done separately (i.e. the child grid's data isn't retrieved from the DB until the user actually clicks an item in the parent grid.

So... in the ParentChildGridPanel control, I want to add the "Select" column to the parent grid.  My "ParentChildGridPanel" user control exposes two properties to get at the underlying "GridPanel" user controls nested in it... these properties are called "ParentGridPanel" and "ChildGridPanel".  Each GridPanel control exposes a property called "ActiveGrid" which exposes the underlying RadGrid.

I'm using the following code in the Page_Init handler:

        protected void Page_Init(object sender, EventArgs e) 
        { 
            // Attach the parent grid's SelectedIndexChanged event 
            ParentGridPanel.ActiveGrid.SelectedIndexChanged += new EventHandler(ParentGrid_SelectedIndexChanged); 
 
            // Create the new GridButtonColumn to attach to the parent grid 
            GridButtonColumn GBC = new GridButtonColumn(); 
            GBC.CommandName = "Select"; 
            GBC.UniqueName = "Details"; 
            GBC.Text = "Details"; 
 
            // Attach the new column 
            this.ParentGridPanel.ActiveGrid.Columns.Add(GBC); 
        } 

I have created a delegate called "DrillDownSelected", along with custom event arguments, to be used in the ParentGrid_SelectedIndexChanged event handler (referenced in the above code).  The purpose is to raise an event back to the main page, alerting the page that the user has selected an item in the parent grid and that it needs to retrieve the data for the child grid.  The code is as follows:
        void ParentGrid_SelectedIndexChanged(object sender, EventArgs e) 
        { 
            RadGrid ParentGrid = (RadGrid)sender; 
 
            // Find the item selected by the user and get the value of the data key value field 
            object x = ParentGrid.SelectedItems[0].OwnerTableView.DataKeyValues[ParentGrid.SelectedItems[0].ItemIndex]["PRIMARY_KEY"]; 
 
            // Build the custom argument to send back to the main page 
            DrillDownEventArgs customArgs = new DrillDownEventArgs(); 
            customArgs.UniqueParentID = Int32.Parse(x.ToString()); 
 
            // Alert the main page that the user has clicked an item in the ParentGrid 
            if (DrillDownSelected != null) 
            { 
                this.DrillDownSelected(this, customArgs); 
            } 
        } 

All of this works exactly as I want it to.  The problem arises when the user click on the "Details" link of the Select column that was added in the Init event handler... I end up getting an additional "Details" column every time, but I lose the content of the column itself.  I know it's a Details column because I can look at the UniqueName property.  In other words, on postback I get the new Details column, and then a blank "old" Details column to the right.  On the next postback, the new Details column, and then 2 blank "old" Details columns to the right... next postback, Details column, 3 blank columns, etc.

I'm not sure why this is happening, although I suspect it's a ViewState issue.  To remedy the problem, I've added the following code to my ParentChildGridPanel's "Page_Load" event handler to remove the unwanted column each time:
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (Page.IsPostBack) 
            { 
                this.ParentGridPanel.ActiveGrid.Columns.RemoveAt(this.ParentGridPanel.ActiveGrid.Columns.Count - 1); 
            } 
        } 
 

This works just fine, although it seems very "hacky" to me to have to do this.  I'll admit that I don't completely understand every detail of all of the columns collections on a RadGrid (RadGrid.Columns, RadGrid.MasterTableView.Columns, RadGrid.MasterTableView.RenderColumns) and when to use one over the other, so perhaps I'm just going about this the wrong way.

What is the "best practice" way to achieve my original goal?

Thank you.
Sebastian
Telerik team
 answered on 03 Aug 2009
2 answers
132 views
I'm working with a Grid based on the online demo using the Stock Quote WebService.    I want to be able to use the name of the stock and/or index instead of the symbol.     I've changed the yahooFeedTemplate URL to return the name, but the code breaks whenever a name contains a comma.   Has anyone worked with the StockQuoteService and modified it to handle names with commas?   Also, would it be possible to return an additional field to my grid based on an evaluation of the change in price.   For example, if the change percentage is positive return GridImage.ImageUrl = "Images/Up.gif" or GridImage.Image.Url = "Images/Down.gif" if it is negative.    The code in the StockQuoteService is little more complex than I'm used to working with, so thanks in advance for any assistance.  Note, in the code below I'm still referring to StockTicker but the first item returned from the Yahoo feed is actually the name.

 
Imports System  
Imports System.Collections.Generic  
Imports System.ComponentModel  
Imports System.Data  
Imports System.IO  
Imports System.Net  
Imports System.Text  
Imports System.Web  
Imports System.Web.Services  
Imports System.Xml  
Imports System.Globalization  
 
 
<WebService([Namespace]:="http://www.telerik.com/"), WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _  
Public Class StockQuoteService  
    Inherits WebService  
    Private random As Random  
    Private yahooFeedTemplate As String = "http://finance.yahoo.com/d/quotes.csv?s={0}&f=nl1d1t1c1ohgv&e=.csv" 
 
    Public Sub New()  
        random = New Random(DateTime.Now.Millisecond)  
    End Sub 
 
    Property SessionQuotesData() As String 
        Get 
            Return HttpContext.Current.Session("TelerikAspAjaxGridApplication")  
        End Get 
        Set(ByVal value As String)  
            HttpContext.Current.Session("TelerikAspAjaxGridApplication") = value  
        End Set 
    End Property 
 
    <WebMethod(), Description("Gets stock quote for a specific symbol")> _  
    Public Function GetStockQuotes(ByVal stockTickers As String) As DataSet  
        Dim stockTickerList As String() = stockTickers.Split(","c)  
        Dim index As Integer 
        For index = 0 To stockTickerList.Length - 1  
            stockTickerList(index) = stockTickerList(index).Trim()  
        Next index  
 
        Dim quotes As List(Of Quote) = New List(Of Quote)  
        
            Dim url As String = String.Empty  
            Dim webRequest As WebRequest = Nothing 
            Dim webResponse As WebResponse = Nothing 
            Dim stockTicker As String 
            For Each stockTicker In stockTickerList  
                url = String.Format(yahooFeedTemplate, HttpUtility.UrlEncode(stockTicker))  
                webRequest = HttpWebRequest.Create(url)  
                webResponse = webRequest.GetResponse()  
 
                Dim quote As Quote = GetQuoteData(webResponse.GetResponseStream())  
                quotes.Add(quote)  
            Next stockTicker  
 
 
        SerializeQuotesData(quotes)  
 
        Dim dataset As New DataSet("QuotesDataSet")  
        Dim data As XmlReader = XmlReader.Create(New System.IO.StringReader(SessionQuotesData))  
        dataset.ReadXml(data)  
        Return dataset  
    End Function 
 
    
 
 
    Private Overloads Function GetQuote(ByVal bufferList() As String) As Quote  
        Dim stockTicker As String = bufferList(0)  
        Dim stockQuote As [Decimal] = [Decimal].Parse(bufferList(1), CultureInfo.InvariantCulture)  
        Dim lastUpdated As DateTime = DateTime.Parse((bufferList(2) + " " + bufferList(3)), CultureInfo.InvariantCulture)  
        Dim change As [Decimal] = [Decimal].Parse(bufferList(4), CultureInfo.InvariantCulture)  
        Dim dailyMaxRange As [Decimal] = 0D  
        If (bufferList(6) <> "N/A") Then 
            dailyMaxRange = [Decimal].Parse(bufferList(6), CultureInfo.InvariantCulture)  
        End If 
 
        Dim dailyMinRange As [Decimal] = 0D  
        If (bufferList(7) <> "N/A") Then 
            dailyMinRange = [Decimal].Parse(bufferList(7), CultureInfo.InvariantCulture)  
        End If 
 
        Return New Quote(stockTicker, stockQuote, lastUpdated, change, dailyMinRange, dailyMaxRange)  
    End Function 
 
 
    Private Overloads Function GetQuote(ByVal quoteNode As XmlNode) As Quote  
 
        Dim stockTicker As String = quoteNode.Attributes("stockTicker").Value  
        Dim stockQuote As [Decimal] = [Decimal].Parse(quoteNode.Attributes("lastTrade").Value, CultureInfo.InvariantCulture)  
        Dim lastUpdated As DateTime = DateTime.Parse(quoteNode.Attributes("lastUpdated").Value, CultureInfo.InvariantCulture)  
        Dim change As [Decimal] = [Decimal].Parse(quoteNode.Attributes("change").Value, CultureInfo.InvariantCulture)  
        Dim dailyMaxRange As [Decimal] = IIf(quoteNode.Attributes("dailyMaxRange").Value = "N/A", 0D, [Decimal].Parse(quoteNode.Attributes("dailyMaxRange").Value, CultureInfo.InvariantCulture))  
        Dim dailyMinRange As [Decimal] = IIf(quoteNode.Attributes("dailyMinRange").Value = "N/A", 0D, [Decimal].Parse(quoteNode.Attributes("dailyMinRange").Value, CultureInfo.InvariantCulture))  
         
        Return New Quote(stockTicker, stockQuote, lastUpdated, change, dailyMinRange, dailyMaxRange)  
    End Function 
 
 
    Private Function GetQuoteData(ByVal dataStream As Stream) As Quote  
        Dim buffer As String = Nothing 
        Dim sr As New StreamReader(dataStream)  
        Try 
            buffer = sr.ReadToEnd()  
        Finally 
            sr.Dispose()  
        End Try 
 
        buffer = buffer.Replace("""", "")  
        buffer = buffer.Replace(ControlChars.Cr + ControlChars.Lf, "")  
 
        Dim bufferList As String() = buffer.Split(New Char() {","c})  
        Dim quote As Quote = GetQuote(bufferList)  
 
        Return quote  
    End Function 
 
    Private Function GetQuotesData(ByVal xmlData As String) As List(Of Quote)  
        Dim xmlDocument As New XmlDocument()  
        xmlDocument.LoadXml(xmlData)  
 
        Dim quotes As List(Of Quote) = New List(Of Quote)  
        Dim quote As Quote = Nothing 
        Dim quoteNode As XmlNode  
        For Each quoteNode In xmlDocument.DocumentElement.ChildNodes  
            quote = GetQuote(quoteNode)  
            quotes.Add(quote)  
        Next quoteNode  
 
        Return quotes  
    End Function 
 
 
    Private Sub SerializeQuotesData(ByVal quotes As List(Of Quote))  
        Dim str As StringBuilder = New StringBuilder("<quotes>")  
        Try 
            Dim quote As Quote  
            For Each quote In quotes  
                str.Append("<quote ")  
                str.Append("stockTicker=""" & quote.StockTicker & """ ")  
                str.Append("lastTrade=""" & quote.StockQuote.ToString(CultureInfo.InvariantCulture) & """ ")  
                str.Append("change=""" & quote.Change.ToString(CultureInfo.InvariantCulture) & """ ")  
                str.Append("lastUpdated=""" & quote.LastUpdated.ToString("MM/dd/yyyy HH:mm:ss") & """ ")  
                str.Append("dailyMaxRange=""" & quote.DailyMaxRange.ToString(CultureInfo.InvariantCulture) & """ ")  
                str.Append("dailyMinRange=""" & quote.DailyMinRange.ToString(CultureInfo.InvariantCulture) & """ ")  
                str.Append(" />")  
            Next quote  
        Catch e As Exception  
        End Try 
        str.Append("</quotes>")  
        SessionQuotesData = str.ToString()  
    End Sub 
End Class 
Nikolay Rusev
Telerik team
 answered on 03 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?