473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to call query from web service..

4
Hello,

I using ajax autocomplete in gridview to select the data. Once i select the data from textbox gridview i want the other textbox in gridview display related data. i use a javascript and put it in markup to call the webservice query and ajax autocomplete in app code. The problem is when i select the data using ajax the data from other textbox not display..

Here is an example...

This coding ajax to select the data from gridview textbox name task_person:-


Expand|Select|Wrap|Line Numbers
  1.  if (field_txtbox.ID == "task_person")
  2.                     {
  3.                         AjaxControlToolkit.TextBoxWatermarkExtender twe = new AjaxControlToolkit.TextBoxWatermarkExtender();
  4.                         twe.ID = "twe" + field_txtbox.ID;
  5.                         twe.TargetControlID = field_txtbox.ID;
  6.                         twe.WatermarkText = "person";
  7.                         Container.Controls.Add(twe);
  8.                         AjaxControlToolkit.AutoCompleteExtender autosuggest = new AjaxControlToolkit.AutoCompleteExtender();
  9.                         autosuggest.ID = "autoSuggest" + field_txtbox.ID;
  10.                         autosuggest.ServiceMethod = "GetMember";     
  11.                         autosuggest.TargetControlID = field_txtbox.ID;
  12.                         autosuggest.CompletionSetCount = 50;
  13.                         autosuggest.EnableCaching = true;
  14.                         autosuggest.MinimumPrefixLength = 3;
  15.  
  16.                         autosuggest.OnClientItemSelected = "test";
  17.  
  18.                         Container.Controls.Add(autosuggest);
  19.  
  20.                     }


This coding in web service:-

Expand|Select|Wrap|Line Numbers
  1. <WebMethod()> _
  2.    <Script.Services.ScriptMethod()> _
  3.    Public Shared Function GetDept(ByVal prefixText As String, ByVal count As Integer) As System.String()
  4.  
  5.         Dim iCount As Integer
  6.  
  7.         iCount = 10
  8.  
  9.         Dim items As New List(Of String)(count)
  10.         Dim ds As New DataSet()
  11.         Dim connectionString As String = "Data Source=202.75.36.58;Initial Catalog=PGB_POD_IMS;Persist Security Info=True;User ID=pgbuser;Password=p@ssw0rd"
  12.         Using connection As New SqlConnection(connectionString)
  13.             Dim sql As String = "SELECT user_department FROM m_user WHERE user_fullnm LIKE '%" + prefixText + "%'"
  14.             Dim adapter As New SqlDataAdapter()
  15.             adapter.SelectCommand = New SqlCommand(sql, connection)
  16.             adapter.Fill(ds)
  17.         End Using
  18.         For Each dr As DataRow In ds.Tables(0).Rows
  19.             items.Add(dr("user_department").ToString())
  20.  
  21.         Next
  22.         Return items.ToArray()
  23.  
  24.     End Function


This is javascript function:-



Expand|Select|Wrap|Line Numbers
  1. function test()
  2.     {
  3.      document.getElementById('TableGridView_ctl06_task_department').value='result';
  4.     }



I just use the word result to pass value to ensure the function can pass the data or not. I don't know how can i use the java script function to call the web service query. Please anybody correct my code..
Mar 31 '10 #1
1 2744
Dormilich
8,658 Expert Mod 8TB
read about AJAX, that’s used for JavaScript <=> server communication
Mar 31 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Robert | last post by:
I am trying to create a db for service providers by county. I'm relatively new to db programming, but I have done quite a bit of programming ranging from the old basic days up to doing some...
6
by: Siegfried Heintze | last post by:
I have the following C# code in my web service: public static extern double add_(double X, double Y ); public double add (double X, double Y){ return add_(X, Y); }
3
by: Jim Lewis | last post by:
I have read several things that state accessing a Web Service through a Query String should work. However, when I try to execute http://localhost/webservice1/service1.asmx/HelloWorld I get the...
2
by: haydn.chapman | last post by:
Hi, I have a simple web service that has a method public string Query(string message) that at the moment just takes a message and returns it. Is it possible to call this method using the...
6
by: blue875 | last post by:
A tale of two queries: One query looks like this, and runs fine. We'll call this the "Customer1 query": SELECT Customer1 overall.*, IIf(IsNull(.),0,1) AS IsField, IIf(IsNull(.),0,1) AS...
1
by: blue875 | last post by:
SELECT Service.Name As AtlasProductName, IIf(Service.Name Like "1004*", "1004/URAR", IIf(Service.Name Like "2055E CompPhots&Land", "2055 Ext w/Comp Pics", IIf(Service.Name Like "2055I...
4
by: Paul | last post by:
Hi, I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so...
3
by: Marshall | last post by:
Hello, I am wondering if it is possible to call a remote web service using ATLAS and if so, how. I have read several docs which show how to call a web service that is within the same project as...
5
by: Stan | last post by:
I am working on a database in ACCESS 2003. Six of the fields provide for entry of service dates 1 to 6 progressively recording when the client was serviced. The data type is Date/Time. I need to...
6
by: alho | last post by:
The web service is called by a program running on pocket pc. When to call the web service, the first call is still ok, but for the second or later calls, it will throw "403 Forbidden" WebException....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.