ArcGISServer adf uses Asp. Net Self-Ajax to implement refreshing operations

Source: Internet
Author: User

During project development, the tool bar or task of the adf is troublesome and lacks flexibility. Therefore, it is very helpful to know that the Js library provided by ArcGISServer has great benefits for the development of ArcGISServer. For example, after creating a task, we can not display the task page, but we can "steal" The task function and use JavaScript to use this function.

Code:

Code
1 function CX ()
2 {
3 executeTask ('searchtext = '+ document. getElementById ('info '). value, "WebForm_DoCallback ('taskmanager1 $ SearchAttributesTask1 ', argument, processCallbackResult, context, postBackError, true )");
4}

The above is the function of "Stealing" SearchAttributesTask, but the page form can be customized. "SearchText" is followed by the information to be queried, so that the custom query is implemented.

In addition to the above form of "theft", we can also use the Ajax provided by Asp. Net to implement the refreshing operation. For example, if we want to display a feature in the center, we first implement Asp for the map page. net's own Ajax ICallbackEventHandler interface, and implement void ICallbackEventHandler in the interface event. raiseCallbackEvent (string eventArgument), write the code in the center of the feature, and then return Map1.CallbackResults. toString. This is what we are stealing. The returned format is a string that can be processed by processCallbackResult of the esri js library. After parsing this string, the map can be refreshed (this string includes ^ :: for more information about the format, see the help description ). We cannot refresh the returned string through Asp. Net ICallbackEventHandler. We need to register the corresponding js call block.

Code
1 public string centeratCallBackFunctionInvocation;
2 protected void Page_Load (object sender, EventArgs e)
3 {
4 centeratCallBackFunctionInvocation = Page. ClientScript. GetCallbackEventReference (this,
5 "message", "processCallbackResult", "context", "postBackError", true );
6}

 

You can also call and input parameters in page js:

Code
1 function Center2 ()
2 {
3 var wgid = document. getElementById ("wgid"). value;
4 var message;
5 if (wgid)
6 {
7 message = "WGID =" + wgid;
8 <% = centeratCallBackFunctionInvocation %>
9
10}
11
12}

In this way, we can flexibly implement operations such as Ajax refreshing, not limited to controls such as FloatPanel.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.