Showing posts with label necessary. Show all posts
Showing posts with label necessary. Show all posts

Monday, March 26, 2012

AJAX AutoCompleteExtender

Hi, I'm a newbie to the AJAX tool kit.

I have few basic questions.

1) Is it necessary to have a webservice running to get the data from the data base.. My question is, assume i have a list of Employee names.As soon as i started typing in the Text Field i need to display the Employee name. I have seen a Video session on this. but do we exactly need to run the webservice which has data base conection and retrieval from the database?

2) is it sufficient to have a method to get the data from DB in the .cs file.

Suggest me the Best one.

Tell me a best practise link where i can learn them from basics...

Thanks,

Mythily

Hi Mythily,

No, you have an alternative option, PageMethod. This is a static method defined in the page itself and can be accessed from client side directly.

For example:

// this method is defined in the page itself
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public staticstring[] GetCompletionList(string prefixText, int count)
{
string[] words = prefixText.Split(new char[] { ';' });
string[] result = new string[16];
for (int i = 0; i < 16; i++)
{
result[i] = "aaaa";
}
return result;
}

<ajaxToolkit:AutoCompleteExtender CompletionSetCount="4" CompletionListCssClass="completeListStyle" BehaviorID="ace" ID="AutoCompleteExtender1"ServicePath="AutoCompleteExtender.aspx" ServiceMethod="GetCompletionList"runat="server" TargetControlID="TextBox1">

Hope

Saturday, March 24, 2012

AJAX and web server controls

Please some one explain me the following in ajax.

1) Is it necessary that I have to use html controls instead of web server control in order to support AJAX in my web page?. (I know we can use Magic AJAX – penal control to do the same. But I don't want to use any third party component or library).

2) As per my understanding in AJAX like technology I can send some information to the server and I can get some info from the server based on the info sent. But if I want to add a new row to my web server datagrid control. How can we do this with AJAX. I mean if I add a blank row to my collection class then how will I reflect that in UI.

3) Is there any simple code sample available in the net that demonstrates the web server control manipulation with AJAX.

Hi,

you can use normal web controls when you use Atlas, which is the AJAX implementation/framework from Microsoft.

For more information and quickstartsplease take a look here.

Grz, Kris.