Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
86 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
122 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
117 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
119 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
127 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 StringAs 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 StringAs 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 StringAs 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
2 answers
74 views
I have dynamically created docks and when I create a new dock the collapse icon is on top of the close. If I drag it just a hair and then drop it, it falls into the correct place. I'm using the default skin. On the black skin the behavior is similar, but the collapse icon is below the close icon.

Anyone shed any thoughts on why this would occur and how I can fix it?

Oh, and this seems to only happen on IE8. FF3 works just fine. ???
Pero
Telerik team
 answered on 03 Aug 2009
1 answer
134 views

Hi,

I am trying to export the Grid details to Word/Excel/PDFformat files. I am able to accomplish the same. I would like to add Title,Headers and footers to the exported data.

When I open the exported file I should see the Titles andthen Data.

For example..

Title: sometitle

Subject: somesubject

From: dateTo: date

Grid data

.

.

.

.

Report for To –From days


Thanks

Sabarish

Shinu
Top achievements
Rank 2
 answered on 03 Aug 2009
2 answers
97 views
I need to update some input parameters and need to be able to access the data object being edited in the objectdatasource updating event. How can I get access to the object.
Peter
Telerik team
 answered on 03 Aug 2009
1 answer
84 views
I have displayed the sum of a column on the footer,how to just display the result but the word'sum".
Thanks very much!
Princy
Top achievements
Rank 2
 answered on 03 Aug 2009
7 answers
164 views
Hello,
I have a project initial developed using 2009 Q1.  It is a DNN module (using DNN 4.9).  Things worked perfectly until after the upgrade to Q2.   I am now receiving an error Page_Validators is undefined... blah blah... http://localhost/DNN/ScriptResource.axd. 

It only happens on Insert when the options are clicked and when editing an existing appointment.   I am aware of an issue with DNN 4.8 in this regard, and was faced with a null is null error until I upgraded to 4.9.  After that it worked perfectly until after the Telerik Q2 release.  To simplyy things I created a new module that is an exact copy of the RadScheduler DNN module provided by telerik.   It too gets the same error under the same conditions.

Please advise.  Is this a bug or did I miss something while upgrading?
Des
Top achievements
Rank 2
 answered on 03 Aug 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?