Here is my scenario:
这是我的场景:
- User enters in address
- Address is geolocated
- Geolocation is buffered (1 ft)
- Graphic returned is used in query feature to get a road ID
用户输入地址
地址是地理定位的
地理定位缓冲(1英尺)
返回的图形用于查询功能以获取道路ID
All the above is pretty straight forward ESRI JavaScript API – now I am hitting a bit of a crossroads in approaches and I am wondering if you have an approach you use for the following:
以上所有内容都是非常直接的ESRI JavaScript API - 现在我在方法上遇到了一些十字路口,我想知道你是否有一个方法用于以下方面:
I have the road segment ID in a variable on the client side in JavaScript. I need this ID to query a database table in sql server.
我在JavaScript中的客户端变量中有路段ID。我需要此ID来查询sql server中的数据库表。
The query is pretty simple
查询非常简单
SELECT Library FROM DataTable WHERE Road_ID = x
SELECT Library FROM DataTable WHERE Road_ID = x
It is just a database table not geodatabase. The returned data will only be one record and one attribute - the closest Library. I will use the returned data to continue on in the JavaScript API.
它只是一个数据库表而不是地理数据库。返回的数据只是一个记录和一个属性 - 最近的库。我将使用返回的数据继续在JavaScript API中。
So I have an idea of how to proceed but I am not sure it is the smartest way to go. My tool set is ASP.NET, C#, Dojo, ESRI JavaScript API and JavaScript:
所以我知道如何继续,但我不确定这是最聪明的方法。我的工具集是ASP.NET,C#,Dojo,ESRI JavaScript API和JavaScript:
- Connection string to the database goes in web.config
- JavaScript will have to interact with C# function
- C# function should be on the “code behind page” of an aspx page.
- I think I need to implement a Client Callback without Post Backs as outlined in this article http://msdn.microsoft.com/en-us/library/ms178208.aspx
- Then I can use the callback data returned to move on my happy way with the JavaScript API on the client side again.
数据库的连接字符串位于web.config中
JavaScript必须与C#函数交互
C#函数应该在aspx页面的“代码隐藏页面”上。
我想我需要实现一个没有回发的客户端回调,如本文所述http://msdn.microsoft.com/en-us/library/ms178208.aspx
然后我可以使用返回的回调数据再次使用客户端的JavaScript API以我愉快的方式移动。
1 个解决方案
#1
I think you're making things way too complicated with Client Callback.
我认为你使用Client Callback让事情变得太复杂了。
Create an Web Handler that returns the record as JSON or XML and make the road ID a querystring parameter of the Handler.
创建一个Web处理程序,将记录作为JSON或XML返回,并将道路ID作为Handler的查询字符串参数。
Call the handler via an AJAX call from within your JavaScript.
通过JavaScript中的AJAX调用来调用处理程序。
#1
I think you're making things way too complicated with Client Callback.
我认为你使用Client Callback让事情变得太复杂了。
Create an Web Handler that returns the record as JSON or XML and make the road ID a querystring parameter of the Handler.
创建一个Web处理程序,将记录作为JSON或XML返回,并将道路ID作为Handler的查询字符串参数。
Call the handler via an AJAX call from within your JavaScript.
通过JavaScript中的AJAX调用来调用处理程序。