This is a migrated thread and some comments may be shown as answers.

[Solved] On Demand don't show all items

4 Answers 77 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Support ATT
Top achievements
Rank 1
Support ATT asked on 24 May 2008, 01:22 PM
http://www.sport-events.ch/Sport_Event_Suchen.aspx

When i search in the combobox: "Wo" for a word "Winterthur"
the search doesn't work !! why ?

For other searches it works perfect !!

4 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 26 May 2008, 12:24 PM
Hi Toprak Abdullah,

Maybe you have not set the WHERE clause in the SELECT statement in the ItemsRequested event handler of the second combobox. Can you paste here the code for that handler?


Sincerely yours,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Support ATT
Top achievements
Rank 1
answered on 26 May 2008, 01:06 PM
Hi

I don't think that the problem is the "where", because for other search words it works perfect, but only for the search text: "Winterthur". You can test online !

protected

void ddlSport_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)

{

DataTable data = DBManager.getInstance().getSportNames(e.Text);

try

{

int itemsPerRequest = 15;

int itemOffset = e.NumberOfItems;

int endOffset = itemOffset + itemsPerRequest;

if (endOffset > data.Rows.Count)

{

endOffset = data.Rows.Count;

}

if (endOffset == data.Rows.Count)

{

e.EndOfItems =

true;

}

else

{

e.EndOfItems =

false;

}

for (int i = itemOffset; i < endOffset; i++)

{

ddlSport.Items.Add(

new RadComboBoxItem(data.Rows[i]["Name"].ToString(), data.Rows[i]["SportsID"].ToString() ));

}

if (data.Rows.Count > 0)

{

e.Message =

String.Format("Sportarten <b>1</b>-<b>{0}</b> von <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString());

}

else

{

e.Message =

"No matches";

}

}

catch

{

e.Message =

"No matches";

}

}


public

DataTable getSportNames(string sportName)

{

SqlDataAdapter da = null;

DataTable data = null;

 

string query = "SELECT * FROM Sports WHERE Name LIKE '%" + sportName + "%'" + " " +

"ORDER BY Name ASC";

try

 

{

da =

new SqlDataAdapter(query, ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString);

data =

new DataTable();

da.Fill(data);

}

catch (Exception ex)

{

}

finally

 

{

}

return data;

}

0
Veselin Vasilev
Telerik team
answered on 28 May 2008, 12:05 PM
Hi Toprak,

Have you managed to fix the problem?

It seems working for me. Here is a screenshot.




Greetings,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Support ATT
Top achievements
Rank 1
answered on 28 May 2008, 02:18 PM
Hi

I have fixed the "where" problem ;-)

thanks.
Tags
ComboBox
Asked by
Support ATT
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Support ATT
Top achievements
Rank 1
Share this question
or