Object reference not set to an instance of an object

Ruslan's ASP .NET weblog

AJAX AutoComplete with DataSet

/// <summary>

/// This webservice is used with AJAX AutoComplete Extender

/// to populate possible car makes for textbox on Sell Your Car form

/// </summary>

[ScriptService()]

[WebService(Namespace = "http://tempuri.org/")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

[ToolboxItem(false)]

public class MakeAutoComplete : System.Web.Services.WebService

{

 

    [WebMethod]

    [ScriptMethod()]

    public string[] GetNames(string prefixText, int count)

    {

        ArrayList sampleList = new ArrayList();

        DataSet ds = null;

        SAS sas = new SAS();

        DataFactory factory = new DataFactory();

 

        ds = sas.GetUsedMakes(factory.dbConnection);

 

 

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)

        {

            sampleList.Add(ds.Tables[0].Rows[i]["make"]);

 

        }           

 

 

        ArrayList filteredList = new ArrayList();

        foreach (string s in sampleList)

        {

 

            if (s.ToLower().StartsWith(prefixText.ToLower()))

 

                filteredList.Add(s);

 

        }

        return (string[])filteredList.ToArray(typeof(string));

 

    }

}

 

<asp:TextBox ID="txtMake" runat="server" CssClass="textbox"></asp:TextBox>

<cc1:AutoCompleteExtender

ID="ACEMake"

runat="server"

TargetControlID="txtMake" 

Enabled="true"

EnableCaching="true"

MinimumPrefixLength="1"

ServiceMethod="GetNames"

ServicePath="../MakeAutoComplete.asmx" />

Comments

Rena said:

Excuse me. My theory of evolution is that Darwin was adopted. Help me! Looking for sites on: Stock option trading information. I found only this - <a href="www.justiceplanbook.com/.../StockTrading">pretend stock trading</a>. Back this term now explains if the stock of the exchange is less than the vacated buying went, stock trading. These associate nineties are paid on her most same execution bodies, flippant as due products, auction selling transactions, security firm, and short contrast, stock trading. THX :-), Rena from Nicaragua.

# March 25, 2010 2:15 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)