autocomplete using xml file

Posted by Klbaiju under ASP.NET on 10/15/2009 | Views : 5605 | Status : [Member] | Replies : 6
Hi ,
iam working in a travel portal.
i need the autocomplete example .the data should be come from an xml file.
if i enter 3 character of a place .name of all places starts with that place should be shown.
i don't need ajax example. how it is possible

Regards Baiju.
here is the xml file



<?xml version="1.0" encoding="utf-8"?>
<Persons>
<Person>
<id>100</id>
<Name>Ellahggg</Name>
<City>LAddf</City>
<Age>13</Age>
</Person>
<Person>
<id>101</id>
<Name>Ingridjhhh</Name>
<City>Oslofff</City>
<Age>63</Age>
</Person>
<Person>
<id>102</id>
<Name>baiju</Name>
<City>kollamfff</City>
<Age>37</Age>
</Person>
<Person>
<id>103</id>
<Name>ddjkk</Name>
<City>hhh</City>
<Age>888</Age>
</Person>
<Person>
<id>104</id>
<Name>eejjhhh</Name>
<City>eee</City>
<Age>543</Age>
</Person>
</Persons><?xml version="1.0" encoding="utf-8"?>
<Persons>
<Person>
<id>100</id>
<Name>Ella</Name>
<City>LAffff</City>
<Age>13</Age>
</Person>
<Person>
<id>101</id>
<Name>Ingrid</Name>
<City>Oslokk</City>
<Age>63</Age>
</Person>
<Person>
<id>102</id>
<Name>baiju</Name>
<City>kollam</City>
<Age>37</Age>
</Person>


</Persons>




Responses

Posted by: Vuyiswamb on: 10/16/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day

Please look at this

http://aspdotnetpatterns.blogspot.com/2009/08/jquery-autocomplete-using-xml-with-key.html


http://www.liquid-technologies.com/XmlStudio/Free-Xml-Editor.aspx


Thank you for Posting at Dotnetfunda

Vuyiswa Maseko



Thank you for posting at Dotnetfunda
[Administrator]

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh4u on: 10/16/2009 [Member] Bronze

Up
0
Down
Hi Kibaiju
first u bind the dataset from a XML File.
 Dim dsUser  As New DataSet ds.ReadXml(System.Configuration.ConfigurationManager.AppSettings("XMLPath") & "\" & "BirthDay.xml")

Dim datacollection As New AutoCompleteStringCollection
For i As Integer = 0 To dsUser.Tables(0).Rows.Count - 1
datacollection.Add(dsUser.Tables(0).Rows(i).Item(1).ToString)
Next
txtUserName.AutoCompleteSource = AutoCompleteSource.CustomSource
txtUserName.AutoCompleteMode = AutoCompleteMode.Suggest
txtUserName.AutoCompleteCustomSource = datacollection

More Details Follow Below Linl
http://santoshdotnetarena.blogspot.com/2009/10/in.html
Regards
Santosh



Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Niradhip on: 10/16/2009 [Member] Starter

Up
0
Down
Get the value from xml file and put it in array and try the following code.

private void Form1_Load(object sender, EventArgs e)

{

string[] array = { "a", "a1", "b", "b1", "c", "c1" };
//Create AutoComplete Collection
AutoCompleteStringCollection collection = new AutoCompleteStringCollection();
//Add Array Values to that Collection
collection.AddRange(array);
// Set TextBox Properties
textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
textBox1.AutoCompleteCustomSource = collection;

}




Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Klbaiju on: 10/16/2009 [Member] Starter

Up
0
Down
what is the namespace for autocompletestringcollection

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Niradhip on: 10/17/2009 [Member] Starter

Up
0
Down

AutoCompleteStringCollection is for Windows Forms applications, not ASP.Net.

Check out the following article:

http://msdn.microsoft.com/en-us/library/system.windows.forms.autocompletestringcollection.aspx

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Klbaiju on: 10/17/2009 [Member] Starter

Up
0
Down
i need asp.net application code. not desktop


Regards
Baiju

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response