views:

41

answers:

0

The following application is not rendering the information that I am getting back from a web service into the datagrid. I know I am being able to connect to the webservice because I am getting the count for the class array. I am being able to get a Response.Write but when I try to pull all the information from the array class I haven't been able to see the elements nor to render the whole class into the data grid. What might be my issue? I am stuck with this one.

void LoadABCPhoneInfo()
{

    PhoneTypeInfo[] PhoneInfo = GetPhoneInfo();

    DataSet quoteDataSet = XmlString2DataSet(PhoneInfo.ToString());

 //Here is NOT doing the databinding. 
    grdABC.DataSource = quoteDataSet;
    grdABC.DataBind();
    grdABC.Visible = true;
}

private PhoneTypeInfo[] GetPhoneInfo()
{
    //string strGetPhoneInfo = String.Empty;
    PhoneTypeInfo[] strGetPhoneInfo; //

    try
    {
        OwnerAndReservation ownerAndReservationWS = new OwnerAndReservation();

        strGetPhoneInfo = ownerAndReservationWS.GetPhoneTypes();
        //GetPhoneTypesAsync()
  //Here I can get the count for the array
        Response.Write("GetPhoneInfo Length "+ strGetPhoneInfo);
    }
    catch (Exception ex)
    {
        //raise the error
        string errorMessage = String.Format("Error while trying to connect to the Web Service. {0}", ex.Message);
        throw new Exception(errorMessage);

    }
    //return the quote information
    return strGetPhoneInfo;
}


private DataSet XmlString2DataSet(string xmlString)
{
    //create a new DataSet that will hold our values
    DataSet quoteDataSet = null;

    //check if the xmlString is not blank
    if (String.IsNullOrEmpty(xmlString))
    {
        //stop the processing
        return quoteDataSet;

    }

    try
    {
        //create a StringReader object to read our xml string
        using (StringReader stringReader = new StringReader(xmlString))
        {
            //initialize our DataSet
            quoteDataSet = new DataSet();

            //load the StringReader to our DataSet
            quoteDataSet.ReadXml(stringReader);
        }
    }
    catch
    {
        //return null
        quoteDataSet = null;
    }

    //return the DataSet containing the stock information
    return quoteDataSet;
}