HighTechTalks DotNet Forums  

how to get the dropdown feature when using AutoCompleteExtender

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss how to get the dropdown feature when using AutoCompleteExtender in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
rote
 
Posts: n/a

Default how to get the dropdown feature when using AutoCompleteExtender - 12-05-2007 , 02:19 AM






If you have a look at this site below you will notice that after typing some
text and the list is too long the textbox will give
you like a dropdown list
http://www.tuyr.net/AutoComplete/AutoComplete.aspx

How can i achieve this i have set all the properties on that page but still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance



Reply With Quote
  #2  
Old   
coolCoder
 
Posts: n/a

Default Re: how to get the dropdown feature when using AutoCompleteExtender - 12-05-2007 , 09:53 AM






On Dec 5, 12:19 pm, "rote" <naijaco... (AT) hotmail (DOT) com> wrote:
Quote:
If you have a look at this site below you will notice that after typing some
text and the list is too long the textbox will give
you like a dropdown listhttp://www.tuyr.net/AutoComplete/AutoComplete.aspx

How can i achieve this i have set all the properties on that page but still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance

There is a property to fetch limited number of records while doing
that.
By the way, have you given path of web service correctly ??


Reply With Quote
  #3  
Old   
Milosz Skalecki [MCAD]
 
Posts: n/a

Default RE: how to get the dropdown feature when using AutoCompleteExtender - 12-05-2007 , 04:49 PM



Howdy,

Paste both aspx & vb.net/c# code.
--
Milosz


"rote" wrote:

Quote:
If you have a look at this site below you will notice that after typing some
text and the list is too long the textbox will give
you like a dropdown list
http://www.tuyr.net/AutoComplete/AutoComplete.aspx

How can i achieve this i have set all the properties on that page but still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance




Reply With Quote
  #4  
Old   
rote
 
Posts: n/a

Default Re: how to get the dropdown feature when using AutoCompleteExtender - 12-05-2007 , 08:42 PM



Thanks for the prompt reply.
The snipped code below:-
If i can have it in a dropdlown list it would be nice though as the returned
list is too long or even have a
paging sort of.



<asp:TextBox ID="SearchText" CssClass="Ajaxtextbox" Width="150px"
runat="server" />

<toolkit:AutoCompleteExtender

ID="AutoCompleteSearch"

MinimumPrefixLength="1"

runat="server"

TargetControlID="SearchText"

ServicePath="SimpleListService.asmx"

ServiceMethod="LookUpEmployee"

EnableCaching="true"

CompletionInterval="10"

CompletionSetCount="20"

CompletionListCssClass="completionListElement"

CompletionListItemCssClass="listItem"

CompletionListHighlightedItemCssClass="highlighted ListItem"

DelimiterCharacters=";"/>

SimplestListService.asmx
---------------------------------------------
[WebMethod]
public string[] LookUpEmployee(string prefixText,int count)
{
count = 10;
string sql = "select distinct E.FirstName + ' ' + E.LastName AS [Name] from
Employee E where E.firstname like @prefixText order by [Name]";
SqlConnection cn = new SqlConnection();
DataTable dt = new DataTable();

cn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
try
{
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar,
50).Value = prefixText + "%";
da.Fill(dt);
}
finally
{
if (da != null)
{
da.Dispose();
}

if (cn != null)
{
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
cn = null;
}

}
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["Name"].ToString(),i);
i++;
}
return items;
}










"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote

Quote:
Howdy,

Paste both aspx & vb.net/c# code.
--
Milosz


"rote" wrote:

If you have a look at this site below you will notice that after typing
some
text and the list is too long the textbox will give
you like a dropdown list
http://www.tuyr.net/AutoComplete/AutoComplete.aspx

How can i achieve this i have set all the properties on that page but
still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance






Reply With Quote
  #5  
Old   
Milosz Skalecki [MCAD]
 
Posts: n/a

Default Re: how to get the dropdown feature when using AutoCompleteExtend - 12-06-2007 , 02:24 PM



Hi Rote,

If you're using page method instead of web service, the method must be static:

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] LookUpEmployee(string prefixText,int count)
{
// blahblah
}

I'm not sure if the ScriptManager should have EnablePageMethods set to true:
<asp:ScriptManager runat="server" ID="scriptManager"
EanblePageMethods="true"/>

hope this helps
--
Milosz


"rote" wrote:

Quote:
Thanks for the prompt reply.
The snipped code below:-
If i can have it in a dropdlown list it would be nice though as the returned
list is too long or even have a
paging sort of.



asp:TextBox ID="SearchText" CssClass="Ajaxtextbox" Width="150px"
runat="server" /

toolkit:AutoCompleteExtender

ID="AutoCompleteSearch"

MinimumPrefixLength="1"

runat="server"

TargetControlID="SearchText"

ServicePath="SimpleListService.asmx"

ServiceMethod="LookUpEmployee"

EnableCaching="true"

CompletionInterval="10"

CompletionSetCount="20"

CompletionListCssClass="completionListElement"

CompletionListItemCssClass="listItem"

CompletionListHighlightedItemCssClass="highlighted ListItem"

DelimiterCharacters=";"/

SimplestListService.asmx
---------------------------------------------
[WebMethod]
public string[] LookUpEmployee(string prefixText,int count)
{
count = 10;
string sql = "select distinct E.FirstName + ' ' + E.LastName AS [Name] from
Employee E where E.firstname like @prefixText order by [Name]";
SqlConnection cn = new SqlConnection();
DataTable dt = new DataTable();

cn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
try
{
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar,
50).Value = prefixText + "%";
da.Fill(dt);
}
finally
{
if (da != null)
{
da.Dispose();
}

if (cn != null)
{
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
cn = null;
}

}
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["Name"].ToString(),i);
i++;
}
return items;
}










"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote in message
news:C9CA1B11-348D-4620-8ED0-494C8C2B27D4 (AT) microsoft (DOT) com...
Howdy,

Paste both aspx & vb.net/c# code.
--
Milosz


"rote" wrote:

If you have a look at this site below you will notice that after typing
some
text and the list is too long the textbox will give
you like a dropdown list
http://www.tuyr.net/AutoComplete/AutoComplete.aspx

How can i achieve this i have set all the properties on that page but
still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance







Reply With Quote
  #6  
Old   
rote
 
Posts: n/a

Default Re: how to get the dropdown feature when using AutoCompleteExtend - 12-08-2007 , 04:54 AM



Thanks for the message Millosz but that didn't answer my question.
The page does work only i want the dropdownlist feature like on this page
type in som text and u will see the textboc change to dropdownlist

http://www.tuyr.net/AutoComplete/AutoComplete.aspx


"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote

Quote:
Hi Rote,

If you're using page method instead of web service, the method must be
static:

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] LookUpEmployee(string prefixText,int count)
{
// blahblah
}

I'm not sure if the ScriptManager should have EnablePageMethods set to
true:
asp:ScriptManager runat="server" ID="scriptManager"
EanblePageMethods="true"/

hope this helps
--
Milosz


"rote" wrote:

Thanks for the prompt reply.
The snipped code below:-
If i can have it in a dropdlown list it would be nice though as the
returned
list is too long or even have a
paging sort of.



asp:TextBox ID="SearchText" CssClass="Ajaxtextbox" Width="150px"
runat="server" /

toolkit:AutoCompleteExtender

ID="AutoCompleteSearch"

MinimumPrefixLength="1"

runat="server"

TargetControlID="SearchText"

ServicePath="SimpleListService.asmx"

ServiceMethod="LookUpEmployee"

EnableCaching="true"

CompletionInterval="10"

CompletionSetCount="20"

CompletionListCssClass="completionListElement"

CompletionListItemCssClass="listItem"

CompletionListHighlightedItemCssClass="highlighted ListItem"

DelimiterCharacters=";"/

SimplestListService.asmx
---------------------------------------------
[WebMethod]
public string[] LookUpEmployee(string prefixText,int count)
{
count = 10;
string sql = "select distinct E.FirstName + ' ' + E.LastName AS [Name]
from
Employee E where E.firstname like @prefixText order by [Name]";
SqlConnection cn = new SqlConnection();
DataTable dt = new DataTable();

cn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
try
{
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar,
50).Value = prefixText + "%";
da.Fill(dt);
}
finally
{
if (da != null)
{
da.Dispose();
}

if (cn != null)
{
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
cn = null;
}

}
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["Name"].ToString(),i);
i++;
}
return items;
}










"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote in message
news:C9CA1B11-348D-4620-8ED0-494C8C2B27D4 (AT) microsoft (DOT) com...
Howdy,

Paste both aspx & vb.net/c# code.
--
Milosz


"rote" wrote:

If you have a look at this site below you will notice that after
typing
some
text and the list is too long the textbox will give
you like a dropdown list
http://www.tuyr.net/AutoComplete/AutoComplete.aspx

How can i achieve this i have set all the properties on that page but
still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance









Reply With Quote
  #7  
Old   
Milosz Skalecki [MCAD]
 
Posts: n/a

Default Re: how to get the dropdown feature when using AutoCompleteExtend - 12-08-2007 , 11:28 AM



Howdy,

Aplogies I missed there was a webservice in the code you posted. I can't
really understand the problem - are you able to see the list below your text
box at all? Or is just the "transition" effect we see on the sample control
toolkit page (i suspect is just dropDownExtender in conjunction with
Animations)?

Kind Regards
--
Milosz


"rote" wrote:

Quote:
Thanks for the message Millosz but that didn't answer my question.
The page does work only i want the dropdownlist feature like on this page
type in som text and u will see the textboc change to dropdownlist

http://www.tuyr.net/AutoComplete/AutoComplete.aspx


"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote in message
news:9ACD148B-B504-4AFE-B4C8-F36CAEC729B7 (AT) microsoft (DOT) com...
Hi Rote,

If you're using page method instead of web service, the method must be
static:

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] LookUpEmployee(string prefixText,int count)
{
// blahblah
}

I'm not sure if the ScriptManager should have EnablePageMethods set to
true:
asp:ScriptManager runat="server" ID="scriptManager"
EanblePageMethods="true"/

hope this helps
--
Milosz


"rote" wrote:

Thanks for the prompt reply.
The snipped code below:-
If i can have it in a dropdlown list it would be nice though as the
returned
list is too long or even have a
paging sort of.



asp:TextBox ID="SearchText" CssClass="Ajaxtextbox" Width="150px"
runat="server" /

toolkit:AutoCompleteExtender

ID="AutoCompleteSearch"

MinimumPrefixLength="1"

runat="server"

TargetControlID="SearchText"

ServicePath="SimpleListService.asmx"

ServiceMethod="LookUpEmployee"

EnableCaching="true"

CompletionInterval="10"

CompletionSetCount="20"

CompletionListCssClass="completionListElement"

CompletionListItemCssClass="listItem"

CompletionListHighlightedItemCssClass="highlighted ListItem"

DelimiterCharacters=";"/

SimplestListService.asmx
---------------------------------------------
[WebMethod]
public string[] LookUpEmployee(string prefixText,int count)
{
count = 10;
string sql = "select distinct E.FirstName + ' ' + E.LastName AS [Name]
from
Employee E where E.firstname like @prefixText order by [Name]";
SqlConnection cn = new SqlConnection();
DataTable dt = new DataTable();

cn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
try
{
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar,
50).Value = prefixText + "%";
da.Fill(dt);
}
finally
{
if (da != null)
{
da.Dispose();
}

if (cn != null)
{
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
cn = null;
}

}
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["Name"].ToString(),i);
i++;
}
return items;
}










"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote in message
news:C9CA1B11-348D-4620-8ED0-494C8C2B27D4 (AT) microsoft (DOT) com...
Howdy,

Paste both aspx & vb.net/c# code.
--
Milosz


"rote" wrote:

If you have a look at this site below you will notice that after
typing
some
text and the list is too long the textbox will give
you like a dropdown list
http://www.tuyr.net/AutoComplete/AutoComplete.aspx

How can i achieve this i have set all the properties on that page but
still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance










Reply With Quote
  #8  
Old   
rote
 
Posts: n/a

Default Re: how to get the dropdown feature when using AutoCompleteExtend - 12-09-2007 , 08:35 PM



Yes Milosz thats what i'm talking about the
"transition" effect we see on the sample control
toolkit page
at http://www.tuyr.net/AutoComplete/AutoComplete.aspx
Any ideas???



"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote

Quote:
Howdy,

Aplogies I missed there was a webservice in the code you posted. I can't
really understand the problem - are you able to see the list below your
text
box at all? Or is just the "transition" effect we see on the sample
control
toolkit page (i suspect is just dropDownExtender in conjunction with
Animations)?

Kind Regards
--
Milosz


"rote" wrote:

Thanks for the message Millosz but that didn't answer my question.
The page does work only i want the dropdownlist feature like on this page
type in som text and u will see the textboc change to dropdownlist

http://www.tuyr.net/AutoComplete/AutoComplete.aspx


"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote in message
news:9ACD148B-B504-4AFE-B4C8-F36CAEC729B7 (AT) microsoft (DOT) com...
Hi Rote,

If you're using page method instead of web service, the method must be
static:

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] LookUpEmployee(string prefixText,int count)
{
// blahblah
}

I'm not sure if the ScriptManager should have EnablePageMethods set to
true:
asp:ScriptManager runat="server" ID="scriptManager"
EanblePageMethods="true"/

hope this helps
--
Milosz


"rote" wrote:

Thanks for the prompt reply.
The snipped code below:-
If i can have it in a dropdlown list it would be nice though as the
returned
list is too long or even have a
paging sort of.



asp:TextBox ID="SearchText" CssClass="Ajaxtextbox" Width="150px"
runat="server" /

toolkit:AutoCompleteExtender

ID="AutoCompleteSearch"

MinimumPrefixLength="1"

runat="server"

TargetControlID="SearchText"

ServicePath="SimpleListService.asmx"

ServiceMethod="LookUpEmployee"

EnableCaching="true"

CompletionInterval="10"

CompletionSetCount="20"

CompletionListCssClass="completionListElement"

CompletionListItemCssClass="listItem"

CompletionListHighlightedItemCssClass="highlighted ListItem"

DelimiterCharacters=";"/

SimplestListService.asmx
---------------------------------------------
[WebMethod]
public string[] LookUpEmployee(string prefixText,int count)
{
count = 10;
string sql = "select distinct E.FirstName + ' ' + E.LastName AS
[Name]
from
Employee E where E.firstname like @prefixText order by [Name]";
SqlConnection cn = new SqlConnection();
DataTable dt = new DataTable();

cn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
try
{
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar,
50).Value = prefixText + "%";
da.Fill(dt);
}
finally
{
if (da != null)
{
da.Dispose();
}

if (cn != null)
{
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
cn = null;
}

}
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["Name"].ToString(),i);
i++;
}
return items;
}










"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote in message
news:C9CA1B11-348D-4620-8ED0-494C8C2B27D4 (AT) microsoft (DOT) com...
Howdy,

Paste both aspx & vb.net/c# code.
--
Milosz


"rote" wrote:

If you have a look at this site below you will notice that after
typing
some
text and the list is too long the textbox will give
you like a dropdown list
http://www.tuyr.net/AutoComplete/AutoComplete.aspx

How can i achieve this i have set all the properties on that page
but
still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance












Reply With Quote
  #9  
Old   
Milosz Skalecki [MCAD]
 
Posts: n/a

Default Re: how to get the dropdown feature when using AutoCompleteExtend - 12-13-2007 , 06:49 PM



Ho again,

As I had mentioned before, use Animations:

<cc1:AutoCompleteExtender runat="server" ID="ex"
ServiceMethod="GetText"
TargetControlID="txt">
<Animations>
<OnShow>
<Sequence>
<OpacityAction Opacity="0" />
<HideAction Visible="true" />
<FadeIn />
</Sequence>
</OnShow>
<OnHide>
<FadeOut Duration=".2"/>
</OnHide>
</Animations>
</cc1:AutoCompleteExtender>

hope this helps
--
Milosz


"rote" wrote:

Quote:
Yes Milosz thats what i'm talking about the
"transition" effect we see on the sample control
toolkit page
at http://www.tuyr.net/AutoComplete/AutoComplete.aspx
Any ideas???



"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote in message
news:79E65934-5C62-4D00-A7B8-A8A50A1BE34F (AT) microsoft (DOT) com...
Howdy,

Aplogies I missed there was a webservice in the code you posted. I can't
really understand the problem - are you able to see the list below your
text
box at all? Or is just the "transition" effect we see on the sample
control
toolkit page (i suspect is just dropDownExtender in conjunction with
Animations)?

Kind Regards
--
Milosz


"rote" wrote:

Thanks for the message Millosz but that didn't answer my question.
The page does work only i want the dropdownlist feature like on this page
type in som text and u will see the textboc change to dropdownlist

http://www.tuyr.net/AutoComplete/AutoComplete.aspx


"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote in message
news:9ACD148B-B504-4AFE-B4C8-F36CAEC729B7 (AT) microsoft (DOT) com...
Hi Rote,

If you're using page method instead of web service, the method must be
static:

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] LookUpEmployee(string prefixText,int count)
{
// blahblah
}

I'm not sure if the ScriptManager should have EnablePageMethods set to
true:
asp:ScriptManager runat="server" ID="scriptManager"
EanblePageMethods="true"/

hope this helps
--
Milosz


"rote" wrote:

Thanks for the prompt reply.
The snipped code below:-
If i can have it in a dropdlown list it would be nice though as the
returned
list is too long or even have a
paging sort of.



asp:TextBox ID="SearchText" CssClass="Ajaxtextbox" Width="150px"
runat="server" /

toolkit:AutoCompleteExtender

ID="AutoCompleteSearch"

MinimumPrefixLength="1"

runat="server"

TargetControlID="SearchText"

ServicePath="SimpleListService.asmx"

ServiceMethod="LookUpEmployee"

EnableCaching="true"

CompletionInterval="10"

CompletionSetCount="20"

CompletionListCssClass="completionListElement"

CompletionListItemCssClass="listItem"

CompletionListHighlightedItemCssClass="highlighted ListItem"

DelimiterCharacters=";"/

SimplestListService.asmx
---------------------------------------------
[WebMethod]
public string[] LookUpEmployee(string prefixText,int count)
{
count = 10;
string sql = "select distinct E.FirstName + ' ' + E.LastName AS
[Name]
from
Employee E where E.firstname like @prefixText order by [Name]";
SqlConnection cn = new SqlConnection();
DataTable dt = new DataTable();

cn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, cn);
try
{
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar,
50).Value = prefixText + "%";
da.Fill(dt);
}
finally
{
if (da != null)
{
da.Dispose();
}

if (cn != null)
{
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
cn = null;
}

}
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["Name"].ToString(),i);
i++;
}
return items;
}










"Milosz Skalecki [MCAD]" <mily242 (AT) DONTLIKESPAMwp (DOT) pl> wrote in message
news:C9CA1B11-348D-4620-8ED0-494C8C2B27D4 (AT) microsoft (DOT) com...
Howdy,

Paste both aspx & vb.net/c# code.
--
Milosz


"rote" wrote:

If you have a look at this site below you will notice that after
typing
some
text and the list is too long the textbox will give
you like a dropdown list
http://www.tuyr.net/AutoComplete/AutoComplete.aspx

How can i achieve this i have set all the properties on that page
but
still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance













Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.