Access a method in a proxy class RRS feed

  • Question

  • I'm trying to access a method in a proxy class and display the values returned by the method on a web page.

    This is the class and the method I'm trying to access is RaceDaySimple[] raceDay:

    /// <remarks/>
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")]
        public partial class RaceDayCalendarSimple : object, System.ComponentModel.INotifyPropertyChanged {
            private RaceDaySimple[] raceDayField;
            private AtgDateTime timestampField;
            /// <remarks/>
            [System.Xml.Serialization.XmlArrayAttribute(IsNullable=true, Order=0)]
            /*Access this method ==>*/public RaceDaySimple[] raceDay {
                get {
                    return this.raceDayField;
                set {
                    this.raceDayField = value;
            /// <remarks/>
            [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=1)]
            public AtgDateTime timestamp {
                get {
                    return this.timestampField;
                set {
                    this.timestampField = value;
            public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
            protected void RaisePropertyChanged(string propertyName) {
                System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
                if ((propertyChanged != null)) {
                    propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));

    On WebForm1.aspx.cs I have this content:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    //using System.Net;
    namespace WebServiceClient
        public partial class WebForm1 : System.Web.UI.Page
            protected void Page_Load(object sender, EventArgs e)
                InformationServiceReference.PartnerInfoServicePortClient pbs = new InformationServiceReference.PartnerInfoServicePortClient();
                pbs.ClientCredentials.UserName.UserName = "SomeUsername";
                pbs.ClientCredentials.UserName.Password = "SomePassword";
               test.InnerHtml = Convert.ToString(pbs.fetchRaceDayCalendarSimple().raceDay);

    This method will return a race day and I'm trying to display it on WebForm1.aspx. First I tried with:

    test.InnerHtml = pbs.fetchRaceDayCalendarSimple().raceDay;

    Then "pbs.fetchRaceDayCalendarSimple().raceDay;" is underlined so I understand that something is wrong. When hovering over it I get the error message:

    Cannot implicitly convert 'WebServiceClient.InformationServiceReference.RaceDaySimple[]' to 'String'

    So I figure I should do this instead:

    test.InnerHtml = Convert.ToString(pbs.fetchRaceDayCalendarSimple().raceDay);

    So "test" is the div id on the page WebForm1.aspx:

    <html xmlns="">
    <head runat="server">
        <form id="form1" runat="server">
        <div id="test" runat="server"></div>

    So then when loading WebForm1.aspx this is what is displayed:



    Only the name of the method is displayed, but I want the method to displayed what the method does and that is to display a race day. So how do I do that?

    Saturday, June 14, 2014 7:42 PM


All replies

  • raceDay is an array of strings. You expect for a single string.

    Maybe you want to do something like that:

    test.InnerHtml = pbs.fetchRaceDayCalendarSimple().raceDay[0];

    Sunday, June 15, 2014 9:42 AM
  • I get the same error message:

    convert 'WebServiceClient.InformationServiceReference.RaceDaySimple[]' to 'String'

    Any advise?

    Sunday, June 22, 2014 2:23 PM