Telerik Forums
Kendo UI for jQuery Forum
0 answers
81 views
HI!
I need that someone make a good example about how to use a wcf service to bind data to a area chart datasource....using a sql server database..

should i have this

Grafica.aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Grafica.aspx.cs" Inherits="CantidadDePagos2.Grafica" %>


<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE htmlL>
<html>
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="Scripts/kendo/2012.2.710/kendo.all.min.js" type="text/javascript"></script>
    <script src="Scripts/kendo/2012.2.710/kendo.dataviz.min.js" type="text/javascript"></script>
    <link href="Content/kendo/2012.2.710/kendo.common.min.css" rel="stylesheet" type="text/css" />
    <link href="Content/kendo/2012.2.710/kendo.default.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div id="GAreaCPagos" runat="server">
     </div>
    <script type="text/jscript">


        function graficaCPagos() {

            $("#GAreaCPagos").kendoChart({
                theme: $(document).data("kendoSkin") || "default",
                dataSource: {
                    schema: {
                        data: "d", 
                        model: { 
                            fields: {
                                IDPAGOS: { type: "number" },
                                CANTPAGOS: { type: "number" }
                            }
                        }
                    },


                    transport: {


                        read: {
                            url: "ServicePagos.svc/ObtenerPagos"
                            contentType: "application/json; charset=utf-8"
                            type: "POST" 
                        }
                    }
                },


                title: {
                    text: "Cantidad de Pagos",
                    color: "#848484"
                },


                legend: {
                    visible: true
                },


                seriesDefaults: {
                    type: "area"
                },


                series: [{ field: "CANTPAGOS"}],
                valueAxis: {
                    labels: {
                        format: "{0}"
                    }
                },


                categoryAxis: {
                    field: "IDPAGOS"
                },
                tooltip: {
                    visible: true,
                    format: "{0} Id"
                }
            });
        }

        $(document).ready(function () { graficaCPagos(); })
        
        
    </script>
    </form>
</body>
</html>

ServicePagos.svc.cs code:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;


namespace CantidadDePagos2
{
public class ServicePagos : IServicePagos
{
    private string strConnection = ConfigurationManager.ConnectionStrings["cas"].ToString();
    public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}


public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}


    public List<IndiceMorosidad> ObtenerPagos()
    {
        List<IndiceMorosidad> pagos = new List<IndiceMorosidad>();
        using (SqlConnection con = new SqlConnection(strConnection))
        {
            con.Open();
            SqlCommand cmd = new SqlCommand("SELECT CodIndiceMorosidad, CantidadPagos FROM IndiceMorosidad", con);
            SqlDataAdapter dta = new SqlDataAdapter(cmd);
            DataTable dtresp = new DataTable();
            dta.Fill(dtresp);
            if (dtresp.Rows.Count > 0)
            {
                for (int i = 0; i < dtresp.Rows.Count; i++)
                {
                    IndiceMorosidad infopago = new IndiceMorosidad();
                    infopago.IDPAGOS = int.Parse(dtresp.Rows[i]["CodIndiceMorosidad"].ToString());
                    infopago.CANTPAGOS = int.Parse(dtresp.Rows[i]["CantidadPagos"].ToString());
                    pagos.Add(infopago);
                }
            }
            con.Close();
        }
        return pagos;
    }
}
}

and i have the IServicePagos with this code:

namespace CantidadDePagos2
{
    // NOTA: puede usar el comando "Rename" del menú "Refactorizar" para cambiar el nombre de interfaz "IServicePagos" en el código y en el archivo de configuración a la vez.
    [ServiceContract(Name = "CantidadDePagos2")]
    public interface IServicePagos
    {
        [OperationContract]
        List<IndiceMorosidad> ObtenerPagos();
    }


    [DataContract]
    public class IndiceMorosidad
    {
        int Id;
        int CPagos;


        [DataMember]
        public int IDPAGOS
        {
            get { return Id; }
            set { Id = value; }
        }


        [DataMember]
        public int CANTPAGOS
        {
            get { return CPagos; }
            set { CPagos = value; }
        }
    }
}

my web config is that:

<?xml version="1.0"?>
<!--
  Para obtener más información sobre cómo configurar la aplicación de ASP.NET, visite
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
    <add name="cas" connectionString="Data Source=localhost;Initial Catalog=CASWEB_2012_;Persist Security Info=True;User ID=cas;Password=123" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>
    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>
    <profile>
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
      </providers>
    </profile>
    <roleManager enabled="false">
      <providers>
        <clear />
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>
    <httpHandlers>
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
    </handlers>
  </system.webServer>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IServicePagos" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:56245/ServicePagos.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IServicePagos" contract="ServiceReference1.IServicePagos" name="BasicHttpBinding_IServicePagos" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
</configuration>

someone that tell me how y make this area chart with the list of my wcfservice please
David
Top achievements
Rank 1
 asked on 15 Nov 2012
4 answers
2.3K+ views
I have a grid bound to a remote data source which displays a summary of data. I also have a detail grid which is used for adding additional data.

As new detail rows are added, the summary becomes out of sync with the detail, as it is based on a different data source. I'm happy with this, but I'm trying to add a button that will refresh the master/summary grid.

It should be pretty simple. I'm using HTML:
<button  id="refresh">Refresh Totals</button>
And javascript (abbreviated):
var grid = $("#grid").kendoGrid({... });
 
$('#refresh').click(function(){
    grid.refresh();
});
Clicking the refresh button just gives me:
Uncaught TypeError: Object [object Object] has no method 'refresh'
in Chrome's console

Where am I going wrong?

Thanks
M
Top achievements
Rank 1
 answered on 15 Nov 2012
5 answers
418 views
Trying to get a drop down to display during the edit of a foreign key column. The examples all provided appear overly complex and I am unable to get my code functioning. Furthermore, the ASPX and Razor examples do not match their HTML counterparts. The examples also use ViewData and another uses a "Template". I am unable to unwind all the different parts of the examples since they are not self-contained.

http://demos.kendoui.com/web/grid/foreignkeycolumn.html

My Code Simplified:

@(Html.Kendo().Grid<Business.EquipmentModel>()
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(e => e.EquipmentId);
        columns.Bound(e => e.Make);
        columns.Bound(e => e.Model);
        columns.Bound(e => e.EquipmentTypeId);
        columns.ForeignKey(e => e.EquipmentTypeId, (System.Collections.IEnumerable)Business.EquipmentTypeModel.All(), "EquipmentTypeId", "EquipmentTypeName");
        columns.Bound(e => e.FacilityId);
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(e => e.EquipmentId))
        .Read(read => read.Action("Equipment_Read", "Facilities"))
        .Create(update => update.Action("Equipment_Create", "Facilities"))
        .Update(update => update.Action("Equipment_Update", "Facilities"))
        .Destroy(update => update.Action("Equipment_Destroy", "Facilities"))
    )
)
In non-edit mode, the EquipmentTypeName resolves correctly, but upon edit, the EquipmentTypeId is displayed (as an int). I need to bind a dropdown in edit mode to a model action.

Brendon
Top achievements
Rank 1
 answered on 15 Nov 2012
9 answers
162 views
Is localization supported in Q3? What about the various strings that are output by the widgets or the framework? Can they be translated to other languages easily?

Maybe localization is already prepared by language-specific Javascript files, which contain nothing but text in one specific language? 

Michael G. Schneider
mgs
Top achievements
Rank 1
 answered on 15 Nov 2012
0 answers
102 views
Hi,

I have a solution to perform crud operation.
I have some problem with update operation.
The scenario is, I have a sharepoint2010 list. this list is binded with grid.
for update operation I am specifying the event provided by Kendo UI Framework that is "k-grid-update".
please just suggest me how can I access the newly edited values in my event handler". Following is my handler.
 $("#grid").on("click", "k-grid-update", function(e){
                         // How can I retrieve newest edited or added values.
                          });

.
So that I can update the sharepoint list as well with grid it is update itself.
Please suggest me soon.

Thanks,
Kalpesh
Kalpesh
Top achievements
Rank 1
 asked on 15 Nov 2012
2 answers
61 views
Is there a fix for this issue? Here is the scenario:

Choose some date in the control, i.e.: November 14, 2012
Choose a time other than midnight, i.e.: 2:30 PM
Select another date in November. Notice that "2:30 PM" is retained.
Without changing months, select one of the grayed-out dates for October.
Notice that "2:30 PM" is replaced by "12:00 AM".

Expected user result is that when the date outside of the November dates are selected, the time is retained.
Sarah
Top achievements
Rank 1
 answered on 15 Nov 2012
1 answer
64 views

Requirements

Kendo UI Mobile


jquery-1.8.2


IOS


group button & popover



PROJECT DESCRIPTION 

Here is a sample of a group-button opening a popover.  The folks at the help desk got me started with a solution.
Used the select index, selectTimeout  function, and openFor method. The document is attached  below.  
setTimeout(function() {
                       $("#foo").data("kendoMobilePopOver").openFor($("#fooBtn"));
                       }, 0);


Alexander Valchev
Telerik team
 answered on 15 Nov 2012
2 answers
168 views
As far as I understood, HierarchicalDataSource does not have get method, meaning recursively traverse the structure for a node by its attribute. Am I correct?
Vladimir Iliev
Telerik team
 answered on 15 Nov 2012
2 answers
97 views
While working with the Treeview, I noticed that checkboxes would only work if I switched from 2012.2.xxxx to 2012.3.xxxx.  Fine. After switching to the 3Q release, I get bad behavior with the Grid.  Without changing the code, only switching the reference from 2Q to 3Q CSS & JS, the checked-treeview now works but the Grid does not.  Am I missing something?  See the JSFiddle here: http://jsfiddle.net/TJxFZ/ 
Paul Seabury
Top achievements
Rank 1
 answered on 15 Nov 2012
1 answer
795 views
When I have a date time with milliseconds, the milliseconds will always be set to 0 if you change the date with the calandar while the hours, minutes and seconds remains the same.

Am I the only one dealing with this issue?
Georgi Krustev
Telerik team
 answered on 15 Nov 2012
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?