Welcome to ESRI Blogs

Displaying task results in a table

In this post, Tom Brenneman of ESRI Professional Services presents a Web control he developed for displaying task results in a table.

The standard Web ADF controls render task results with a tree view. This is allows multiple results as well as a variety of result types to be displayed in a uniform way. However some applications require that task results be displayed in a table without having to navigate the tree structure of the standard task results. There is an existing sample that illustrates how this can be done by working with custom tasks or application logic that dynamically updates an ASP.NET GridView control.

The custom control I've provided in this post is a little different in that it works with both standard tasks and custom tasks. Using this GridResults control, you can display the results of a task in a grid by simply adding the GridResults as a Task Result Container of the task. The table generated by the GridResults control also includes rows with buttons and check boxes to enable Pan, Zoom, and Select for each feature. This is what the GridResults control looks like in a web application:

GridResults control in a Web application 

As you can see in the example there are also links at the top to you can Select, Unselect, and Zoom to all of the features in the table. By clicking on the column headers you can sort data in the table. What you can’t see in the example above is that this control also supports ASP.NET themes, so you have complete control over the colors, fonts, and text sizes used by the control. Implementing themes for the control is discussed in more detail at the end of this post.

If you are using the Web Mapping Application template, there are slightly different ways to configure the grid than if you are using it in a standard web page. Below are instructions for each approach.

Using the GridResults control in a Web Mapping Application template application

  1. Install the GridResults web control.
  2. Using Visual Studio, create a new website using the Web Mapping Application template.
  3. Right-click anywhere on the Toolbox and click Choose Items...
  4. Click Browse and Navigate to gridResults.dll (Default location is C:\Program Files\ESRI\ArcGIS GridResults Control).
  5. Click OK to dismiss the Choose Toolbox Items dialog.
  6. Open the Source view for Default.aspx.
  7. Find the Results floating panel at about line 98. Highlight this block and copy it, then paste it immediately below. We are doing this with the Source view so you can be sure that the location you paste the floating panel is still in the left panel div with the rest of the floating panels. You also may want to keep the Results panel and standard task results container "TaskResults1" for tools such as Identify.
  8. Change the Title property of the new floating panel to "Table Results".
  9. Delete the entire TaskResults tag (TaskResults2) from the new Table Results panel.
  10. Drag gridResults from the Toolbox into the Table Results floating panel (Where the taskResults control used to exist). Your markup should look like the following.

    <esri:FloatingPanel ID="FloatingPanel1" runat="server"
    BackColor="White" BorderColor="White" BorderStyle="Solid"
    BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt"
    ForeColor="Black" Height="150px" Style="position:relative; margin
    bottom:0px;" Draggable="False" Title="Table Results"
    TitleBarColor="White" TitleBarHeight="20px"
    TitleBarSeparatorLine="True" Transparency="0" Width="100%"
    HeightResizable="True" Font-Bold="True" CloseButton="False"
    TitleBarForeColor="DarkGray" Expanded="False"
    WidthResizable="False" ShowDockButton="True"
    ShowDockedContextMenu="True">
    <esri_samples:gridResults ID="GridResults1" runat="server"
    Height="200px" Style="position: absolute; overflow: auto;"
    Visible="True" Width="400px" />
    </esri:FloatingPanel>
  11. To make the grid display with scroll bars in the floating panel, we need to adjust the style attribute of the control. Change the style attribute to the following.

    Style="position:absolute; height:100%; width:100%; overflow:auto; left:0px; top:0px;"
  12. Switch to design view.
  13. Right-click on GridResults1 and click Properties.
  14. Set the Map property of the GridResults1 to the name of your map (Map1).
  15. Use the MapResourceManager to add a map resource to the application.
  16. Add tasks (such as QueryAttributesTask) to the task manager and configure their properties.
  17. Click the Smart Tag on your task(s) and click Choose Task Results container.
  18. Click Add and set the Name of the Buddy Control to GridResults1. If you use the standard TaskResults control with your tasks as well, make sure the standard TaskResults is the last one in the list.
  19. Click OK to the BuddyControl Collection Editor and run the application.
  20. When you execute the task, the floating panel will update with a table containing the results.

Using the GridResults control without a floating panel

Use the instructions below if you have created a web application without the Web Mapping Application template. In this case, you will set the style properties appropriately for your application.

  1. Open your web application in Visual Studio.
  2. Do steps 3-5 in the instructions from the previous section.
  3. Add the GridResults control to your page.
  4. Set the Map and other properties of the GridResults to display appropriately in your application. In the sample I use the following property settings.
    <esri_samples:gridResults ID="GridResults1" runat="server" Height="290px" Visible="True" Width="780px" Map="Map1" Style="position:absolute; overflow:auto; z-index: 500; left: 20px; top: 450px; vertical-align:top;" MinWidthOfZoom="0.001" />
  5. Do steps 15-20 in the instructions from the previous section.

Common properties of the GridResults control to modify

There are two additional properties that you may want to change specifically for your application: MinWidthOfZoom and ZoomExtentExpansionPercentage.

  • MinWidthOfZoom – this is the minimum width (or height actually) in map units of the extent rectangle that will be zoomed to. This is particularly useful if the result set is a single point or a very small feature. In this case you could set the minimum extent that the map will zoom to. If you are working with geographic data you may want to make this significantly smaller than the default of 10.
  • ZoomExtentExpansionPercent – this is the expansion percentage around the extent of the result set for the map to zoom to. This is useful for defining a margin around the extent of features returned in a result set.

Controlling the appearance of the results control with skins

The GridResults control is actually a Panel control containing a Label control (the resulting table name), Hyperlink controls (The zoom to all button, pan to all button, etc.), and a GridView control. The appearance of these controls honors the styleSheetTheme of your application. Using ASP.NET themes and skins you can control the look and feel of this control in your application. The following are the set of steps to enable themes and configure a skin for the table in the GridResults control. This example modifies the Blue_Bridge theme used by the Web Mapping Application template. If you aren’t using the Web Mapping Application template, you will have to create an appropriate theme for your application before walking through these steps.

  1. Enable style sheet themes by adding the following tag to your Web.config file.
    <pages styleSheetTheme="Blue_Bridge"/>
    If you are using the Web Mapping Application template you will want to leave the theme attribute as well, so your tag should look like this.
    <pages theme="Blue_Bridge" styleSheetTheme="Blue_Bridge"/>
  2. Open App_themes > Blue_Bridge > Default.skin.
  3. Add the appropriate tags to control the appearance of the Label, Hyperlink, and GridView controls contained within this control. Below is an example tag to make the symbology of the grid similar to the Blue_Bridge theme. You can copy and paste this into your skin file as an example.

    <asp:GridView runat="server" BackColor="White" BorderColor="#999999"
    BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
    <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
    <RowStyle BackColor="White" ForeColor="Black" />
    <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
    <HeaderStyle BackColor="#79A8D1" Font-Bold="True" ForeColor="Black"/>
    <AlternatingRowStyle BackColor="#C0D4E4" />
    </asp:GridView>
  4. Save and run the application. When you execute the task, you should now see the results displayed in the table with a light blue header and a blue background for the alternating item (See the graphic at the top of this post for an example).

Try it out

Note: This control and its source code are provided for example purposes only and do not constitute a supported ESRI product. Please direct questions about this control to the Comments section of this blog. You may also post questions about using the ArcGIS Server Web ADF to the ESRI User Forums.

Update (February 26, 2008): I fixed a problem with the GridResults control where sorting didn't work right when there are multiple results. This problem is most evident when you use the GridResults control with the Identify tool. This new control is available on ArcScripts here: http://arcscripts.esri.com/details.asp?dbid=15452 .

Published Wednesday, October 24, 2007 1:58 PM by sterlingdq
Filed under: , ,

Comments

# re: Displaying task results in a table

Thanks Tom. This is great. I look forward to getting into the source code and also to combining this with some custom tasks I am working on.
Wednesday, October 24, 2007 3:46 PM by Randy

# re: Displaying task results in a table

nice work!
Wednesday, October 24, 2007 4:07 PM by jxn

# re: Displaying task results in a table

This looks great!  Thank you so much for your work on this.  Does it require SP3?  I received an error adding it to my toolbar and I suspect that may be why.  Also, I have a field marked as a hyperlink field in my map document.  Does this by chance support hyperlinked fields?

Thanks again!

Thursday, October 25, 2007 6:44 AM by cyndiee

# re: Displaying task results in a table

Yes, it does require SP3. I built it with those assemblies. You should be able to crack open the code and change all the references back to an earlier version and rebuild, but it is likely easier just to apply SP3.
Thursday, October 25, 2007 8:41 AM by Tom Brenneman

# re: Displaying task results in a table

This is very helpful.

I'm trying to build this on ArcGIS Server for Java.

I wanted to use Icefaces or Richfaces fot building a such complex Table.

Unfortanly, I can't get working the combination of Iceface/ArcGIS JSF resp. Richfaces/ArcGIS JSF library.

Has anybody a JAVA solution for this example?

Thanks,

Tom

Saturday, October 27, 2007 9:07 AM by TomLUX

# re: Displaying task results in a table

Where is GridResults_Display.js

I don't see it in the source?

Saturday, October 27, 2007 11:56 AM by vinnymac

# re: Displaying task results in a table

GridResults_Display.js was part of an earlier prototype that I was playing with for resizing the grid inside of a parent window. That approach was abandoned for the current approach which uses the style attribute of the control to enable the scaling and scrolling. I just forgot to take it out of the assembly attributes.
Saturday, October 27, 2007 9:08 PM by Tom Brenneman

# re: Displaying task results in a table

This is a nice tool. Can you tell me how we can link this up to the identify tool and use it for that as well?
Monday, October 29, 2007 10:01 AM by Chris

# re: Displaying task results in a table

Getting the GridResults to work with the Identify tool is a little trickier. The identify tool is a custom tool integrated into the Web Mapping Application template instead of a common task. So we need to modify its code a bit to work with the GridResults. First we need to modify its code file to use ITaskResultsContainer instead of TaskResults (the type for the standard tree-based task results).

In MapIdentify.vb or MapIdentify.cs

[VB]
Change:

Public Property ResultsDisplay() As TaskResults
Get
Return m_resultsDisplay
End Get
Set(ByVal value As TaskResults)
m_resultsDisplay = value
End Set
End Property
To:
Public Property ResultsDisplay() As ITaskResultsContainer
Get


Return m_resultsDisplay
End Get
Set(ByVal value As ITaskResultsContainer)
m_resultsDisplay = value
End Set
End Property

[C#]
Change:


public TaskResults ResultsDisplay
{
get { return m_resultsDisplay; }
set { m_resultsDisplay = value; }
}

To:


public ITaskResultsContainer ResultsDisplay
{
get { return m_resultsDisplay; }
set { m_resultsDisplay = value; }
}

Then at the the top of MapIdentify.vb or MapIdentify.cs:

[VB]
Change:

Private m_resultsDisplay As TaskResults = Nothing

To:

Private m_resultsDisplay As ITaskResultsContainer = Nothing

[C#]
Change:

private TaskResults m_resultsDisplay = null;

To:

private ITaskResultsContainer m_resultsDisplay = null;

We also need to point the identify class to the grid results on startup of the application. In the code-behind file for the default page, Default.aspx.vb or Default.aspx.cs, at about line 45:

[VB]
Change:

identify.ResultsDisplay = TaskResults1

To:

identify.ResultsDisplay = GridResults1

[C#]
Change:

identify.ResultsDisplay = TaskResults1;

To:

identify.ResultsDisplay = GridResults1;

Now, instead of putting the GridResults control into its own floating panel, replace TaskResults1 with GridResults1 in Default.aspx. Your markup should look like the following.


<esri:FloatingPanel ID="Results" runat="server" BackColor="White" BorderColor="White" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="150px" Style="position:relative; margin-bottom:0px;" Draggable="False" Title="Results" TitleBarColor="White" TitleBarHeight="20px" TitleBarSeparatorLine="True" Transparency="0" Width="100%" HeightResizable="True" Font-Bold="True" CloseButton="False" TitleBarForeColor="DarkGray" Expanded="False" WidthResizable="False" ShowDockButton="True" ShowDockedContextMenu="True">
<esri_samples:gridResults ID="GridResults1" runat="server" Height="200px" Style="position: absolute;overflow: auto; height:100%;width:100%; left:0px; top:0px;" Visible="True" Width="400px" Map="Map1" />
</esri:FloatingPanel>

Make sure you don’t change the name of the Results floating panel. The JavaScript for the Identify tool uses that name to open and close the panel. Next you need to modify that JavaScript to get the identify tool add the activity indicator to the correct control.
Change line 30 of display_mapidentify.js from

var fpBody = document.getElementById('Results_TaskResults1');

To

var fpBody = document.getElementById('Results_GridResults1');

Now your identify tool should use the GridResults control for its display. There are other dependencies in display_mapidentify.js on the name of the Results floating panel being named “Results”. So if you use a different name for your results floating panel, make sure to update those references as well.
Tuesday, October 30, 2007 3:02 PM by Tom Brenneman

# re: Displaying task results in a table

add in line 31 of display_mapidentify.js fpBody.innerHTML = ""; So the taskresult will refresh before a new identify. The identify is great. Thanks. But it works only for one resource... Can someone help me to make it working by more resources?
Wednesday, October 31, 2007 2:26 PM by Marco Wagemakers

# re: Displaying task results in a table

Scroll down in the floating panel you should see the other tables with the results from the other resources. The GridResults control adds the tables one after the other for each resource.
Thursday, November 01, 2007 5:44 AM by Tom Brenneman

# PrintTask

Any chance that anyone has modified Bryan Baker's PrintTask to work with this GridResults?
Friday, November 02, 2007 11:16 AM by Randy

# re: Displaying task results in a table

its a good tool. but, I could not see sourcecode writen by VB.
Thursday, November 08, 2007 5:57 PM by mika

# re: Displaying task results in a table

The "Hyperlinking in task results" blog from July shows an example (in C++ though I'm using VB) of how to override the ExecuteTask method to create a hyperlink in the results.  Can this be done with the GridResults Control also?

Friday, November 09, 2007 9:54 AM by cyndiee

# re: Displaying task results in a table

I receive this error message when trying to use the control "Unable to cast object of type 'esri_samples.gridResults' to type 'ESRI.ArcGIS.ADF.Web.UI.WebControls.TaskResults' ..............
Tuesday, November 13, 2007 8:14 AM by Gabriela Voicu

# re: Displaying task results in a table

mika, Sorry I only wrote the code in C#. The control will work with C# and VB.NET code but you can only modify the control using C#. Perhaps an online utility like the following would help. http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx
Tuesday, November 13, 2007 10:49 AM by Tom Brenneman

# re: Displaying task results in a table

cyndiee, Sorry but the control as it is now, will not display URL's as hyperlinks. The control would have to be modified to look for such string structures and add them to a hyperlink control. The existing framework of using template controls inside of the GridView is the framework that you would use to do this. Look at gridViewTemplates.cs for an example. The only difference is that when you construct the table in addResultsGridToPanel in gridResults.cs you would have to look at the actual column values instead of just the column names.
Tuesday, November 13, 2007 10:55 AM by Tom Brenneman

# re: Displaying task results in a table

Gabriela, You are getting this message because the GridResults control is not a type of TaskResults, it is an implementation of ITaskResultsContainer. TaskResults is a separate implementation of ITaskResultsContainer. The GridResults control does not extend the TaskResults like Rex and my post for the ZoomToResults control http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2007/08/28/Automatically-zooming-to-task-results.aspx. All of the standard tasks interact with the results control via the ITaskResultsContainer interface so both controls should work fine for all out-of-the-box ADF tasks controls. The identify tool is a little different in that it looks for a TaskResults type which is what lead to my response above on October 30th. Custom tasks may also be looking for a TaskResults type but these should be easy to change to ITaskResultsContainer.
Tuesday, November 13, 2007 11:06 AM by Tom Brenneman

# Identify on more that one layer

Tom, I followed your suggestions for identify: when in the results I have more than one layer I can see the results but column order doesn't work any more.
Wednesday, November 14, 2007 8:37 AM by Michael

# re: Displaying task results in a table

Michael,

Yes it looks like my code doesn't do sorting well when there are multiple table results.  Currently the control just tracks column and sort order but it should store a collection of objects with info for how each table should be sorted.  I'm not sure if I will have time to fix this but if you want to tackle it yourself RefreshGrid in gridresults.cs is a good place to start.  If I get a chance to fix it, I'll repost.

Wednesday, November 14, 2007 10:46 AM by tbrenneman@esri.com

# re: Displaying task results in a table

Cyndiee, I was able to add a hyperlink to the gridview if I added the link to the result dataset in the Overrides Execute Task of a custom task by using code similar to this below:
For Each DataRow As System.Data.DataRow In ds.Tables(0).Rows
strValue = DataRow("SampleColumn")
strLink = "<a target='_blank' href='http://www.google.com/search?q=" & strValue & "'>" & strValue & "</a>"
DataRow("SampleColumn") = strLink
Next
Thursday, November 15, 2007 8:07 PM by Randy

# re: Displaying task results in a table

I get an error "An unhandled exception has occurred: Object reference not set to an instance of an object" when I try to zoom or pan to any of the results in the table. Everything else works great. Any help would be great. Thanks
Monday, November 19, 2007 10:18 AM by Aaron Mielke

# re: Displaying task results in a table

This is a very nice tool. Now in my programming i've got a datatable, System.Data.DataTable datatable Can you tell me how we can link this up to the tool and use it for that as well?
Tuesday, November 20, 2007 2:06 AM by d y

# re: Displaying task results in a table

Is it possible to use this with the Common Select and Buffer Tool?
Tuesday, November 20, 2007 8:42 AM by Mike Bialousz

# re: Displaying task results in a table

I've got the same error as Aaron. Any ideas?
Tuesday, November 20, 2007 8:49 AM by Rocky

# DataTable to Gridresults

You need to add the table to a Dataset, then send the dataset to the DisplayResults function of ITaskResultsContainer. Here is the code:
     System.Data.DataTable datatable = qfunc.Query(null, lids[layer_index], queryfilter);
        DataSet ds = new DataSet();
        ITaskResultsContainer tskRC = GridResults1;

        if (datatable.Rows.Count > 0)
        {
            ds.Tables.Add(datatable);
            tskRC.DisplayResults(null, null, null, ds);
        }
        else
        {
            string heading = "No results found";
            string detail = "No results found";
            SimpleTaskResult str = new SimpleTaskResult(heading, detail);
            tskRC.DisplayResults(null, null, null, str);
        }
Tuesday, November 20, 2007 9:49 AM by Trent Tinker

# re: Displaying task results in a table

Is there a way to adjust what fields display in the gridresults?  I don't need them all.

Tuesday, November 20, 2007 12:20 PM by TToutant

# Limiting Fields

TToutant,

You can limit the number of fields a couple of ways. If you're not coding, use the mxd by going into the layer properties and choosing the fields that should be visible. Or, using .NET you can list the fields you'd like to return:

string list = "Field1,Field2,Field3";

       String[] flds = list.Split(',');

       ESRI.ArcGIS.ADF.StringCollection scoll = new ESRI.ArcGIS.ADF.StringCollection(flds);

       queryfilter.SubFields = scoll;

Tuesday, November 20, 2007 9:28 PM by Tink0519

# re: Displaying task results in a table

Is there a way to change the field names? I have a join in my mxd, so the field names are really long.

Tuesday, November 20, 2007 9:30 PM by Tink0519

# re: Displaying task results in a table

You need to add the table to a Dataset, then send the dataset to the DisplayResults function of ITaskResultsContainer. Here is the code:

    System.Data.DataTable datatable = qfunc.Query(null, lids[layer_index], queryfilter);

       DataSet ds = new DataSet();

       ITaskResultsContainer tskRC = GridResults1;

       if (datatable.Rows.Count > 0)

       {

           ds.Tables.Add(datatable);

           tskRC.DisplayResults(null, null, null, ds);

       }

       else

       {

           string heading = "No results found";

           string detail = "No results found";

           SimpleTaskResult str = new SimpleTaskResult(heading, detail);

           tskRC.DisplayResults(null, null, null, str);

       }

I'm trying to use this code to display the dataset to the gridviewResults but getting the following error.

No parameterless constructor defined for this object.

It works fine with the identify tool but doesn't work for the query.

Monday, November 26, 2007 11:19 AM by Nipa Parikh

# re: Displaying task results in a table

I like the menu. How did you get the dropdownlist instead of a static list? Thanks.
Tuesday, November 27, 2007 10:33 AM by Joe

# Displaying Select Tool Results in GridResults

Has anyone tried to combine this with the Custom Select Tool Task (http://arcscripts.esri.com/details.asp?dbid=15133)? I am trying to incorporate this now, but it doesn't like it when it get to the GetTaskResultsControls function.
Tuesday, November 27, 2007 12:28 PM by Mike

# re: Limiting Fields

Thanks Tink for the code about limiting the fields. The sample gives fields like "FID" and "ADF Geometry" that I have turned off, or don't have in an mxd. Where does the code snippet you provided go?
Tuesday, November 27, 2007 12:30 PM by Rocky

# re: Displaying task results in a table

Nipa,

Which object is your error refering to?

Tuesday, November 27, 2007 12:47 PM by Tink0519

# re: Limiting Fields

Rocky, The code snippet filters the field list return from the mxd. However, there are some fields that have to be returned, such as ADF Geometry. This field isn't in the MXD, but is used in the graphics layer within the ArcServer enviroment. To turn off those fields you need to make changes in the source code and recomplie the dll.

In the source code, open gridResults.cs and search for: dc.ColumnName != pGl.GraphicsIDColumn.ColumnName

Here you will find a list of the column names gridResults does not display such as "IS_SELECTED" and "SHAPE". Add any column names you do not want displayed to that if statement:

&& dc.ColumnName.ToUpper() != "ADF GEOMETRY"

Make sure you completely remove gridResults from your website before you try to use your newly compiled version, including removing the assembly reference in the web.config file. Hope this helps. -Trent, ROK Technologies

Wednesday, November 28, 2007 10:57 PM by Tink0519

# re: Displaying task results in a table

What I'm trying to do is run a Query by selecting parameters from the drop down list and then I would like to display that results in gridresults as a table. When I try to use the below code I'm getting error in DisplayResults line. No parameterless constructor defined for this object. I was able to get this to work for Identify tool but I like to do the same thing from the seperate query that I'm building. Any ideas? Nipa Parikh
Thursday, November 29, 2007 7:56 AM by Nipa Parikh

# re: Displaying task results in a table

I'm referring to the line that calls tskRC.DisplayResults(null, null, null, ds); It doesn't work and I can't see the results. Thanks for you help. Nipa Parikh
Thursday, November 29, 2007 8:15 AM by Nipa Parikh

# re: Displaying task results in a table

How can I see in gridresults domain values?
Friday, November 30, 2007 4:26 AM by Michael

# re: Limiting Fields

Tink0519 or Anyone, I downloaded the source code to my computer, now I am lost. I have created an application and added the gridResults web control to it I installed it than added to my toolbox and i am using it in my application to make Limiting Fields what do i do next what code i need to add to my application what steps i need to take do I need.

I am just trying to put the source code to my application so I can Limit the Fields, any help is a big help. Thank you.

Friday, November 30, 2007 9:01 AM by abakhtiyarov

# re: Displaying task results in a table

I got this application to work with Identify tool. When the user clicks on checkbox that feature displays on the map. I've a seperate button that should read the values of each checkbox. How do I do that? How can I read the gridresults checkbox values so see which one is turned on or off. Nipa Parikh
Friday, November 30, 2007 10:44 AM by Nipa.Parikh

# re: Displaying task results in a table

i want to start custimze the query task tool how can i do co
Tuesday, December 04, 2007 4:56 AM by Marwa

# re: Displaying task results in a table

I'd like to have the table launch in a new popup window - is this possible?

Tuesday, December 04, 2007 1:11 PM by drprune

# re: Displaying task results in a table

I've been trying to use the code to limit the fields shown in the grid results window. I can't seem to make it work. I have recompiled the dll and removed the grid results from my project including in the web.config file and it still doesn't work. I have specified the fields I don't want and they still come up. Any suggestions? Is there something I'm missing?
Wednesday, December 05, 2007 10:41 AM by Kirsten

# re: Displaying task results in a table

Tom, On postback the results of my gridView WebControl are lost whereas if the results are contained within a Task Results WebControl they persist across the postback. What am I missing?
Monday, December 10, 2007 7:19 AM by Aaron

# re: Displaying task results in a table

Tom, How can I access the data within the gridView after it has been generated? I am experienced working with the ASP.NET GridView, and would like to similarly parse information from the gridView results as part of a function I am writing. I also tried accessing ResultsNonGraphicsDataset to get direct access to the datatable; however, no datatable is returned.
Monday, December 10, 2007 11:24 AM by Aaron

# re: Displaying task results in a table

How would I go about adding the zoom and/or select tools to an ASP .Net Gridview? I need the flexibility of a standard Gridview (hyperlinks, template fields, nested gridviews) with the functionality of zooming to and/or selecting records like you have in this GridResults control. Any guidance would be appreciated.
Monday, December 10, 2007 12:39 PM by Mike

# re: Displaying task results in a table

Tom, would it be possible to add a linkbutton template to the gridresultstemplates.cs so that when that value was clicked it would zoom to that portion of the map?

Right now I've tried to make a linkbutton that will zoom to that portion of the map by modifying the GridViewButtonTemplate so that it works with a link button, but provides the functionality of the imagebutton. It still doesn't show up as a link though, and when I click on it nothing happens?

Is there some kind of event handler that isn't being specified? Does this make sense to you at all?

Wednesday, December 12, 2007 11:23 AM by BennyHusted

# re: Displaying task results in a table

Also, is there an easy way to make the selected column a radiobutton? I tried modifying the gridViewCheckBoxTemplate to use a radiobutton instead of a checkbox, but I can still select many of the results. I made sure the radiobuttons were using the same groupname too.

My goal here is to have only one result selected at any given moment.

Any ideas?

Wednesday, December 12, 2007 12:34 PM by BennyHusted

# re: Displaying task results in a table

How do you debug the dll so I can step through it?

Thursday, December 13, 2007 9:06 AM by bobtec

# re: Displaying task results in a table

I got the following error while running a coded ? tskRC.DisplayResults(Nothing, Nothing, Nothing, ds) Can someone help me? Exception occurred: The given key was not present in the dictionary
Friday, December 14, 2007 11:42 AM by Wayne

# re: Displaying task results in a table

Has anyone tried to combine this with the Custom Select Tool Task (http://arcscripts.esri.com/details.asp?dbid=15133)? I am trying to incorporate this now, but it doesn't like it when it get to the GetTaskResultsControls function.

Tuesday, December 18, 2007 7:51 AM by Nipa

# re: Displaying task results in a table

i too am trying to get the Custom Select Tool Task (http://arcscripts.esri.com/details.asp?dbid=15133) to work with gridResult. works fine in taskresult. i get a callback error but more specifically this seems to be the problem... "unable to cast object of type esri.sample.gridResult to type ESRI.ArcGIS.ADF.UI.WebControls.TaskResults" any help would be appreciated. thanks
Thursday, December 20, 2007 4:54 PM by Bryan

# re: Displaying task results in a table

Aaron and Rocky, Sorry I've been MIA from the blog for a while. Can you tell me how you are using the GridResults when you get the error: "An unhandled exception has occurred: Object reference not set to an instance of an object". What task have you buddied with the results container?
Friday, December 21, 2007 10:01 AM by Tom Brenneman

# re: Displaying task results in a table

Several of you have asked about using the GridResults with a tool on a toolbar (not a task). As has already been mentioned, you need to call DisplayResults on the ITaskResultsContainer interface and pass in a DataSet with the results you want displayed.  The trick is that you need to get a reference to the GridResults control from the tool.  To do this there is a FindControl function in the Utils static class.  Then after you've called DisplayResults you need to send the callbacks generated by the GridResults back to the client using the map control.  Below is some sample code.  In this code "ds" is the dataset with my results.

//Get the GridResults from the page

       esri_samples.gridResults gResults = esri_samples.Utils.FindControl<esri_samples.gridResults>(pMap.Page, "GridResults1");

       ITaskResultsContainer pTaskRes = gResults as ITaskResultsContainer;

       //Start the activity indicator to get the floating panel to expand.

       pTaskRes.StartTaskActivityIndicator(null, "");

       //Send the dataset to the DisplayResults method

       pTaskRes.DisplayResults(null, "", null, ds);

       //Add the callbacks of the GridResults to the callback of the map (referenced by pMap).

       //since all tools are processed through the map control, the map control

       //itself is in a callback and will take care of updating the grid for us.

       pMap.CallbackResults.CopyFrom(pTaskRes.CallbackResults);

       //Clear the callbacks in the grid so they don't get sent twice

       pTaskRes.CallbackResults.Clear();

I hope this helps.  Happy coding!

Friday, December 21, 2007 12:17 PM by Tom Brenneman

# re: Displaying task results in a table

The unhandled problem is fixed. (maybe) I did make some small changes in the source code and recompiled. Now the error is "Parser Error Message: ESRI.ArcGIS.ADF.Web.UI.WebControls.BuddyControlCollection must have items of type 'ESRI.ArcGIS.ADF.Web.UI.WebControls.BuddyControl'. 'esri.arcgis.adf.web.ui.webcontrols.buddycontrol' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'." Can anyone help? No idea where the HTML Generic control is coming from...
Wednesday, December 26, 2007 2:01 PM by Rocky

# re: Displaying task results in a table

Okay, changing the html tag from esri.arcgis.adf.web.ui.webcontrols.buddycontrol to esri:buddycontrol worked. But that was auto populated when I chose the control as the task container. Thanks for the code snip to limit the return fields, worked like a charm.
Thursday, December 27, 2007 6:42 AM by Rocky

# Display field alias names

Hi Tom. Your grid control helped me very much, because previously I was not able to fully localize task results for Georgian language. Now I just have one problem - I need use field alias names instead of real names. Have you any suggestions about it? Thanks.
Friday, December 28, 2007 4:07 AM by Anania

# re: Displaying task results in a table

I want to implement same technology in JAVA If anybody has Java so;ution for this scenerio, Please provide the same.

Thanks

Saturday, January 05, 2008 5:02 AM by aroranidh

# re: Displaying task results in a table

Okay...Bryan Baker retooled the Custom Select Tool Task to work with GridResults. Works great. Anybody know how to pass a Geoprocessing Task result to the GridResults. And\Or export the GridResults to CSV or excel with the code behind a button (export button). Everyone has been extremely helpful! Thanks! Bryan
Friday, January 11, 2008 2:19 PM by Bryan

# re: Displaying task results in a table

Tom, I had a quick question regarding the GridResults control. When I buddy up a QueryAttributesTask with GridResults1 (for example) the results are returned. However, if I pan or zoom I get the error that Aaron & Rocky from above got "An unhandled exception has occurred: Object reference not set to an instance of an object". But if I use the SearchAttributesTask the zoom and pan work great. FYI - I am on sp3. Any Ideas. Thanks! JB
Tuesday, January 15, 2008 8:21 AM by Jeff Bray

# Problem with the Scrollbar

Thank you, this control works great. But I have a little problem: When I use the scrollbar to scroll down in a big result and then change the selection or sort a table, then the scrolbar scrolls up and I need to find my former position. Again, thank you
Wednesday, January 16, 2008 7:35 AM by Andreas Roelovs

# re: Displaying task results in a table

FYI, who ever has been getting the zoom/pan errors with this control--one thing that worked for me: Make sure your shape field is not hidden in your MXD.
Thursday, January 17, 2008 12:46 PM by Evan

# re: Displaying task results in a table

Hi. This works very nice. Thanks. I have one problem: When i try zooming to a record in the result table, instead of zooming in to the selrcted record the map zooms out to full extent. Any ideas? Thanks, Michael.
Friday, January 18, 2008 12:33 AM by Michael

# re: Displaying task results in a table

Dim ds As New DataSet()

           Dim gResults As esri_samples.gridResults = esri_samples.Utils.FindControl(Of esri_samples.gridResults)(Map1.Page, "GridResults1")

           Dim pTaskRes As ITaskResultsContainer = TryCast(gResults, ITaskResultsContainer)

 If datatable.Rows.Count > 0 Then

               ds.Tables.Add(datatable)

               '    'Me.GridResults1.FindControl("GridView1")

               pTaskRes.DisplayResults(Nothing, "", Nothing, ds)

           Else

               Dim heading As String = "No results found"

               Dim detail As String = "No results found"

               Dim str As New SimpleTaskResult(heading, detail)

               pTaskRes.DisplayResults(Nothing, "", Nothing, str)

           End If

When I tried the above code I'm getting the following error.

No parameterless constructor defined for this object.

Any help is appreciated.

Thanks.

Tuesday, January 22, 2008 9:28 AM by Nipa Parikh

# re: Displaying task results in a table

I am also havign the same error "no parameterless constructor defined"..please let me know if I missed anything
Friday, January 25, 2008 3:25 AM by Surender

# re: Displaying task results in a table

Hi Nipa,

I was able rectify the issue of no parameterless query...  the grid view control takes input as graphic dataset and in your code you are sending the system.data.dataset..so it throws an error..

please check the code below which i am using it.. it does not throw any error.

Dim datatable As System.Data.DataTable = qfunc.Query(Nothing, lids(layer_index), spatialfilter)

                   Dim graphicslayer As ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicsLayer = ESRI.ArcGIS.ADF.Web.Converter.ToGraphicsLayer(datatable, System.Drawing.Color.Yellow, System.Drawing.Color.Yellow)

                   Dim selresource As ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource = Nothing

                   For Each gfunc In gfc

                       If gfunc.Resource.Name = "Selection" Then

                           selresource = CType(gfunc.Resource, ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource)

                           selresource.Graphics.Tables.Clear()

                       End If

                   Next

                   If selresource Is Nothing Then

                       Return "Nothing"

                   End If

                   'selresource.Graphics.Tables.Add(graphicslayer)                    '''''''

                   Dim gds As New ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicsDataSet

                   Dim gResults As esri_samples.gridResults = esri_samples.Utils.FindControl(Of esri_samples.gridResults)(m_page, "GridResults1")

                   Dim pTaskRes As ITaskResultsContainer = TryCast(gResults, ITaskResultsContainer)

                   If datatable.Rows.Count > 0 Then

                       'ds.Tables.Add(datatable)

                       gds.Tables.Add(graphicslayer)

                       pTaskRes.DisplayResults(Nothing, "", Nothing, gds)

                       selresource.Graphics = gds

                   Else

                       Dim heading As String = "No results found"

                       Dim detail As String = "No results found"

                       Dim str As New SimpleTaskResult(heading, detail)

                       pTaskRes.DisplayResults(Nothing, "", Nothing, str)

                       pTaskRes.Refresh()

                   End If

But I have a issue..after this the Grid results are not displayed.. the Results pnale does not refresh..can anyone help

Friday, January 25, 2008 6:02 AM by Surender rao k

# re: Displaying task results in a table

Dim gds As New DataSet Dim gResults As esri_samples.gridResults = esri_samples.Utils.FindControl(Of esri_samples.gridResults)(Map1.Page, "GridResults1") Dim pTaskRes As ITaskResultsContainer = TryCast(gResults, ITaskResultsContainer) If datatable.Rows.Count > 0 Then Dim layer As Display.Graphics.GraphicsLayer = ESRI.ArcGIS.ADF.Web.Converter.ToGraphicsLayer(datatable, System.Drawing.Color.Empty, System.Drawing.Color.Black) If Not (layer Is Nothing) Then gds.Tables.Add(layer) Else gds.Tables.Add(datatable) End If pTaskRes.StartTaskActivityIndicator(Nothing, "") pTaskRes.DisplayResults(Nothing, "", Nothing, gds) Map1.CallbackResults.CopyFrom(pTaskRes.CallbackResults) pTaskRes.CallbackResults.Clear() End If
Friday, January 25, 2008 11:38 AM by Nipa

# re: Displaying task results in a table

Hi Surender,

  Thanks for your code but I'm having the same issue of not displaying Gridresults.  Please let me know if you find any solution.

Thanks.

Nipa

Monday, January 28, 2008 4:35 AM by Nipa

# re: Displaying task results in a table

Hi Nipa, I got the solution for not displaying grid resutls... the reason for this is that you r not performing the callbacks after data is loaded to gridresults1. Please see the below code for callback which works for me.. ObjmapSelection -> is my map control name. If datatable.Rows.Count > 0 Then gds.Tables.Add(graphicslayer) pTaskRes.StartTaskActivityIndicator(Nothing, "") pTaskRes.DisplayResults(Nothing, "", Nothing, gds) objmapselection.CallbackResults.CopyFrom(pTaskRes.CallbackResults) Else Dim str As New SimpleTaskResult(heading, detail) pTaskRes.StartTaskActivityIndicator(Nothing, "") pTaskRes.DisplayResults(Nothing, "", Nothing, str) End If Return objmapselection.CallbackResults.ToString() Hope this solves your problem.. Regards, Surender
Monday, January 28, 2008 4:55 AM by Surender

# re: Displaying task results in a table

Hi Surender, Map1 is my map control name and I added Could you please more about "Return Map1.CallbackResults.ToString()" Where the returned string goes? I tried to put it into the function involved after clicking a button. But the gridresults is still not displayed. Thanks! Nipa
Monday, January 28, 2008 11:59 AM by Nipa

# re: Displaying task results in a table

Nipa, are you still trying to get the Custom Select Tool Task (http://arcscripts.esri.com/details.asp?dbid=15133) to output to the gridresults? Bryan Baker fixed it so you can now choose where the data is displayed (TaskResults or Gridresults) by selecting it in the BuddyControl. http://edndoc.esri.com/arcobjects/9.2/NET_Server_Doc/developer/ADF/control_taskresults.htm Anybody know how to export the gridresults to excel or csv?
Monday, January 28, 2008 8:27 PM by Bryan

# re: Displaying task results in a table

Hi Nipa, There two call back statements for refreshing the grid once the spatial query is completed (i.e the data is added to datatable..please make sure datatable.rows.count is greater than zero) the two call back statemetns are 1. pTaskRes.StartTaskActivityIndicator(Nothing, "") this will start the Indicator Gif in grid control. 2.pTaskRes.DisplayResults(Nothing, "", Nothing, gds)..this will add the data to grid control these two should be in this if loop If datatable.Rows.Count > 0 Then here.... else endif after if loop use objmapselection.CallbackResults.CopyFrom(pTaskRes.CallbackResults) pTaskRes.CallbackResults.Clear() Return objmapselection.CallbackResults.ToString() This should work..
Tuesday, January 29, 2008 6:09 AM by Surender rao k

# re: Displaying task results in a table

Surender, I did exactly same thing and the gridresults is still not displayed. Could you share more of your code? Thanks! Nipa
Tuesday, January 29, 2008 11:38 AM by Nipa

# re: Displaying task results in a table

Hi Nipa, Please find the code for Polygon Search and place the results to Grid view.. Note: My GridView control is in "TableResuls" Panel and Grid Control name is "GridRwesult1" Code below: Dim gResults As esri_samples.gridResults = esri_samples.Utils.FindControl(Of esri_samples.gridResults)(m_page, "GridResults1") Dim pTaskRes As ITaskResultsContainer = TryCast(gResults, ITaskResultsContainer) If eventArg = "polygon" Then Dim ims_map_points As Object = Session("ims_map_points") Dim ring As ESRI.ArcGIS.ADF.Web.Geometry.Ring = New ESRI.ArcGIS.ADF.Web.Geometry.Ring() Dim mappoly As ESRI.ArcGIS.ADF.Web.Geometry.Polygon = New ESRI.ArcGIS.ADF.Web.Geometry.Polygon() Dim rings As ESRI.ArcGIS.ADF.Web.Geometry.RingCollection = New ESRI.ArcGIS.ADF.Web.Geometry.RingCollection() Dim mf As ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality = Nothing Dim gisresource As ESRI.ArcGIS.ADF.Web.DataSources.IGISResource = Nothing Dim qfunc As ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality = Nothing Dim graphicslayer As ESRI.ArcGIS.ADF.Web.Display.Graphics.FeatureGraphicsLayer = Nothing Dim gds As New ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicsDataSet Dim spatialfilter As ESRI.ArcGIS.ADF.Web.SpatialFilter = Nothing Dim datatable As System.Data.DataTable = Nothing Dim heading As String = "No results found" Dim detail As String = "No results found" Dim lids() As String = Nothing Dim lnames() As String = Nothing Dim mapResItemval As Integer Dim layer_index As Integer = 0 Dim layerCount As Integer ring.Points = ims_map_points rings.Add(ring) mappoly.Rings = rings For mapResItemval = 0 To objmapselection.MapResourceManagerInstance.ResourceItems.Count - 1 If objmapselection.MapResourceManagerInstance.ResourceItems(mapResItemval).Name = ConfigurationManager.AppSettings("MapResourceItemName") Then mf = CType(objmapselection.GetFunctionality(mapResItemval), _ ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality) End If Next ' end of for loop gisresource = mf.Resource qfunc = CType(gisresource.CreateFunctionality(GetType(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality), Nothing), ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality) qfunc.GetQueryableLayers(Nothing, lids, lnames) For layerCount = 0 To lnames.Length - 1 Step layerCount + 1 If lnames(layerCount) = HttpContext.Current.Session("ActiveLayerName") Then 'targetlayername Then layer_index = layerCount Exit For End If Next spatialfilter = New ESRI.ArcGIS.ADF.Web.SpatialFilter() spatialfilter.ReturnADFGeometries = True spatialfilter.MaxRecords = 500 spatialfilter.Geometry = mappoly spatialfilter.SearchOrder = SearchOrder.Spatial datatable = qfunc.Query(Nothing, lids(layer_index), spatialfilter) graphicslayer = ESRI.ArcGIS.ADF.Web.Converter.ToGraphicsLayer(datatable, Drawing.Color.Cyan, Drawing.Color.Cyan) // gds.DataSetName = [String].Format("{0} - {1} ({2})", "Selection", graphicslayer.TableName, datatable.Rows.Count) pTaskRes.CallbackResults.Clear() If datatable.Rows.Count > 0 Then gds.Tables.Add(graphicslayer) pTaskRes.StartTaskActivityIndicator(Nothing, "") pTaskRes.DisplayResults(Nothing, "", Nothing, gds) Else Dim str As New SimpleTaskResult(heading, detail) pTaskRes.StartTaskActivityIndicator(Nothing, "") pTaskRes.DisplayResults(Nothing, "", Nothing, str) End If gds.Clear() spatialfilter = Nothing qfunc = Nothing End If objmapselection.CallbackResults.CopyFrom(pTaskRes.CallbackResults) pTaskRes.CallbackResults.Clear() Return objmapselection.CallbackResults.ToString() Hope this will help to fix your errror Regards, Surender rao k
Wednesday, January 30, 2008 10:18 AM by Surender

# re: Displaying task results in a table

Hi All, I need to add a "Export" in the GridView similar to "Select ALL,"Zoom to All" and On click of "Export" Button I need to Export the Grid View Results to an Excel sheet. Please let me how to implement this... Regards, Surender rao k
Thursday, January 31, 2008 2:53 AM by Surender

# re: Displaying task results in a table

Hi Surender, Thanks for your code but I've pasted my function that I'm calling from a button pressed. I'm really confused and can definately use your help to figure out why the gridresults is not showing. Please give me some guidance. Thanks. CODE: Public Function SelectFeatures() Dim WhereClauseString As String = "" Dim EmulsionString As String = "" Dim sensorTypeString As String = "" Dim o As ListItem Dim resource_index As Integer = 2 'Index of resource in MapResourceManager Dim targetlayername = "Photo Footprints" Dim mf As ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality = CType(Map1.GetFunctionality(resource_index), ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality) Dim gisresource As ESRI.ArcGIS.ADF.Web.DataSources.IGISResource = mf.Resource Dim supported As Boolean = gisresource.SupportsFunctionality(GetType(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality)) If supported Then Dim qfunc As ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality = CType(gisresource.CreateFunctionality(GetType(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality), Nothing), ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality) Dim lids() As Object = Nothing Dim lnames() As String = Nothing qfunc.GetQueryableLayers(Nothing, lids, lnames) Dim layer_index As Integer = 0 Dim i As Integer For i = 0 To lnames.Length - 1 If lnames(i) = targetlayername Then layer_index = i Exit For End If Next i Dim adfEnvelope As ESRI.ArcGIS.ADF.Web.Geometry.Envelope adfEnvelope = Map1.Extent Dim spatialfilter As New ESRI.ArcGIS.ADF.Web.SpatialFilter() spatialfilter.ReturnADFGeometries = True spatialfilter.Geometry = adfEnvelope spatialfilter.MaxRecords = 1000 WhereClauseString = "STATE=" & "'" & Me.state.SelectedValue & "' and (" WhereClauseString &= "year(exposedate) between " & Me.ExposeDateFrom.SelectedValue & " and " & Me.ExposeDateTo.SelectedValue & ")" For Each o In emulsion.Items If o.Selected = True Then EmulsionString &= "Emulsion=" & "'" & o.Value & "' OR " End If Next If EmulsionString.Length > 0 Then WhereClauseString &= " and (" & Left(EmulsionString, EmulsionString.Length - 4) & ")" End If For Each o In sensortype.Items If o.Selected = True Then sensorTypeString &= CommonFunctions.getCameraList(o.Value) End If Next If sensorTypeString.Length > 0 Then WhereClauseString &= " and (" & Left(sensorTypeString, sensorTypeString.Length - 4) & ")" End If 'for Debugging purpose only WhereClauseString = "STATE='FL' and (year(exposedate) between 2006 and 2006) and (Emulsion='11' OR Emulsion='1') and (sensortype='1' OR sensortype='2' OR sensortype='3' OR sensortype='4' OR sensortype='5' OR sensortype='6' OR sensortype='7' OR sensortype='8' OR sensortype='9' OR sensortype='10' OR sensortype='11' OR sensortype='12' OR sensortype='13' OR sensortype='14' OR sensortype='15' OR sensortype='16' OR sensortype='17' OR sensortype='18' OR sensortype='19' OR sensortype='20' OR sensortype='21' OR sensortype='22')" spatialfilter.WhereClause = WhereClauseString 'spatialfilter.WhereClause = "State='FL'" Dim flds As String() = qfunc.GetFields(Nothing, lids(layer_index)) Dim scoll As New ESRI.ArcGIS.ADF.StringCollection(flds) spatialfilter.SubFields = scoll Dim datatable As System.Data.DataTable = qfunc.Query(Nothing, lids(layer_index), spatialfilter) Dim gfc As IEnumerable = Map1.GetFunctionalities() Dim gResource As ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource = Nothing Dim gfunc As IGISFunctionality For Each gfunc In gfc '***Exercise 5 Step 3.a: Get the GraphicsLayer Resource by name If gfunc.Resource.Name = "Selection" Then gResource = CType(gfunc.Resource, ESRI.ArcGIS.ADF.Web.DataSources.Graphics.MapResource) End If Next gfunc If gResource Is Nothing Then Exit Function End If Dim glayer As ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer = Nothing Dim dt As System.Data.DataTable For Each dt In gResource.Graphics.Tables If TypeOf dt Is ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer Then glayer = CType(dt, ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer) Exit For End If Next dt If glayer Is Nothing Then '***Exercise 5 Step 3.b: Create a new ElementGraphicsLayer glayer = New ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer() '***Exercise 5 Step 3.c: Add the GraphicsLayer to the GraphicsDataSet gResource.Graphics.Tables.Add(glayer) End If glayer.Clear() Dim drs As DataRowCollection = datatable.Rows Dim shpind As Integer = -1 'Dim i As Integer For i = 0 To datatable.Columns.Count - 1 If datatable.Columns(i).DataType Is GetType(ESRI.ArcGIS.ADF.Web.Geometry.Geometry) Then shpind = i Exit For End If Next i Try Dim dr As DataRow For Each dr In drs Dim geom As ESRI.ArcGIS.ADF.Web.Geometry.Geometry = CType(dr(shpind), ESRI.ArcGIS.ADF.Web.Geometry.Geometry) '***Exercise 5 Step 3.d: Create a new GraphicElement Dim ge As New ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement(geom, System.Drawing.Color.DarkRed) Dim pSimpleFill As New ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol pSimpleFill.BoundaryColor = Drawing.Color.DarkRed pSimpleFill.Transparency = 100 ge.Symbol = pSimpleFill '***Exercise 5 Step 3.e: Add the GraphicElement to GraphicsLayer glayer.Add(ge) Next dr Catch ice As InvalidCastException End Try If Map1.ImageBlendingMode = ImageBlendingMode.WebTier Then Map1.Refresh() Else If Map1.ImageBlendingMode = ImageBlendingMode.Browser Then '***Exercise 5 Step 3.f: Refresh the Graphics Resource Map1.RefreshResource(gResource.Name) End If End If 'Dim drow As DataRow If (Not datatable Is Nothing) Then 'For Each drow In drs ' drow("NGS_PHOTOS.NGS_PHOTOS.FLORIDA_FOOTPRINTS.State") = "" & drow("NGS_PHOTOS.NGS_PHOTOS.FLORIDA_FOOTPRINTS.State") & "" 'Next 'GridView1.DataSource = datatable 'Session("datatable") = datatable 'GridView1.DataBind() For Each c As DataColumn In datatable.Columns c.ColumnName = c.ColumnName.Replace("NGS_PHOTOS.NGS_PHOTOS.FLORIDA_FOOTPRINTS.", "") Next Session("datatable") = "" Me.RadGrid1.DataSource = datatable Session("datatable") = datatable ' Me.RadGrid1.DataBind() End If 'This part is not working to copy the resultsset to the gridresults. 'the gridresults is not displayed Dim gds As New DataSet Dim gResults As esri_samples.gridResults = esri_samples.Utils.FindControl(Of esri_samples.gridResults)(Map1.Page, "GridResults1") Dim pTaskRes As ITaskResultsContainer = TryCast(gResults, ITaskResultsContainer) If datatable.Rows.Count > 0 Then Dim layer = ESRI.ArcGIS.ADF.Web.Converter.ToGraphicsLayer(datatable, System.Drawing.Color.Empty, System.Drawing.Color.Black) If Not (layer Is Nothing) Then gds.Tables.Add(layer) pTaskRes.StartTaskActivityIndicator(Nothing, "") pTaskRes.DisplayResults(Nothing, "", Nothing, gds) Else gds.Tables.Add(datatable) End If End If Map1.CallbackResults.CopyFrom(pTaskRes.CallbackResults) pTaskRes.CallbackResults.Clear() End If Return Map1.CallbackResults.ToString() End Function
Friday, February 01, 2008 10:38 AM by Nipa Parikh

# re: Displaying task results in a table

Hi Nipa, Can you please send the complete code in Zip format to my mail ID (surender_karanam@hotmail.com).. I will fix the error and send to you back. According to me there should some small issue which should get fixed quickly. I was also able to solve the Export to Excel from Grid last day. Regards, Surender rao k
Monday, February 04, 2008 1:09 AM by Sureder

# re: Displaying task results in a table

Hi Surender,

  I was looking at your code and trying to compare with mine and I see two differences.

I'm using dropdown list to build my query and hit a submit button that actually calls the function and then display the result in the grid results.

Can you please tell me how should I have my button_click event display the gridresults.

Map1.CallbackResults.ToString() has the whole gridresults content but just not displaying it.

I can really use some help because I'm stuck and can't move forward.

Nipa

Monday, February 04, 2008 8:42 AM by Nipa

# re: Displaying task results in a table

Nipa, I am not able to idenify what exactly the error you are getting..Can you send your code so that I can fix it an send you back.. my email id is surender_karanam@hotmail.com (+4407809562342) Regards, Surender rao k
Monday, February 04, 2008 8:59 AM by Surender

# re: Displaying task results in a table

Hi Powell, As requested please find the code for Export to Excel. I have added one more Case called "gridiewExport" in the GridTool Code in c#... this works Great for me. Code below -----------------------------------------
case "gridViewExport":
//This is the Export Link above the Grid Resutls and
//below code exports the gridview results to Excel file
GridView gv = (GridView)Page.Session["gview"];
// this for loop is to hide the Zoom,Pan, Report, Check box fields
// while exporting the excel sheet
foreach (TemplateField dColumn in gv.Columns)
{
if (dColumn.HeaderText == "Selected")
{ dColumn.Visible = false;
break;
}
dColumn.Visible = false;
}
string strFileName = String.Empty, strFilePath = String.Empty;

strFileName = (HttpContext.Current.Session["HttpSessionID"] + "Report.xls");
strFilePath = HttpContext.Current.Server.MapPath("./ExportData/") + strFileName;
if (File.Exists(strFilePath))
{
File.Delete(strFilePath);
}
System.IO.StringWriter oStringWriter = new StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter);
StreamWriter objStreamWriter;
////string strStyle = @" .text { mso-number-format:\@; }";
objStreamWriter = File.AppendText(strFilePath);
//Utils.ClearControls();
// Utils.PrepareGridViewForExport(gv);
gv.RenderControl(oHtmlTextWriter);
//objStreamWriter.WriteLine(strStyle);
objStreamWriter.WriteLine(oStringWriter.ToString());
objStreamWriter.Close();

string strScript = "window.open('./ExportData/" + strFileName + "','Export');";
CallbackResults.Add(new CallbackResult(Parent, "javascript", strScript));
break;
Tuesday, February 05, 2008 3:54 AM by Surender

# re: Displaying task results in a table

It works fine but in the data table , I still get 3 first columns: GeometryElement, FID, Shape, that I do not need to be shown.

I use ArcMap to make these fields invisible but still in the application, they are still there.

Could you please tell me how to limit the fields and do not have these 3 fields displaying in the table?

I try to read all the comments here but could not make it.

Thanks for your help !

Thursday, February 07, 2008 4:44 AM by LParson

# re: Displaying task results in a table

Hi I have trouble using this control. To me it displays result in gridview but when I click zoomto selected feature it zooms to full extent. Anybody knows why it is happening.
Monday, February 11, 2008 6:59 PM by Satya

# re: Displaying task results in a table

I was able to get this working all the way through. However my problem is with the selection portion. Whenever I try to select any results, it gives me the "An unhandled exception has occured: There was an error in the callback." I do not have Zoom to Results anywhere in the app and only have the GridResults as the ending task container. Any help?
Tuesday, February 12, 2008 5:24 PM by Fernando

# re: Displaying task results in a table

Hallom LParson, look in the gridResults.cs file, line 590-593 look like this: if (dc.ColumnName != pGl.GraphicsIDColumn.ColumnName && dc.ColumnName.ToUpper() != "IS_SELECTED" && dc.ColumnName.ToUpper() != "SHAPE" && dc.ColumnName != c_sTableIdColumnName) here the colums "IS_SELECTED" and "SHAPE" are set to unvisible. Add your columns there to hide them. Does nobody knows how to solve the scroll problem? Bye
Tuesday, February 12, 2008 11:14 PM by Andreas Roelovs

# [转载]关于自定义任务(Tasks)的心得

Wednesday, February 13, 2008 6:17 AM by 【曾华清】

# re: Displaying task results in a table

Has anyone added "run task again" or "remove" context menu items to the gridresults like it comes with the out-of-box taskresults container?

Nipa

Thursday, February 14, 2008 5:49 AM by Nipa

# re: Displaying task results in a table

First of all, excellent tool and code for Grid Results; thank you!

Second, I get the following error when trying to access it online from the host machine (NOTE: Line 37 is marked in red):

Line 35: <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

Line 36: <add assembly="ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer, Version=9.2.4.1420, Culture=neutral, PublicKeyToken=8FC3CC631E44AD86"/>

Line 37: <add assembly="gridResults, Version=1.3.0.0, Culture=neutral, PublicKeyToken=4117B0729E6AE73A"/>

Line 38: <add assembly="ESRI.ArcGIS.ADF.Web.UI.WebControls, Version=9.2.3.1380, Culture=neutral, PublicKeyToken=8FC3CC631E44AD86"/>

Line 39: <add assembly="ESRI.ArcGIS.ADF.Web, Version=9.2.3.1380, Culture=neutral, PublicKeyToken=8FC3CC631E44AD86"/>

I can view it using "View in Browser," but not when entering the full URL.

Thursday, February 14, 2008 12:06 PM by tesladaman

# re: Displaying task results in a table

never mind, I figured it out, missed a step:)

Friday, February 15, 2008 12:15 PM by tesladaman

# re: Displaying task results in a table

Since I didn't get any reply so thought to bring it again. I having trouble using 'ZoomTo' funtion in Grid view. Whenever I select any result and click 'ZoomTo' it zooms far beyond full extent. I tried adjusting zoom property in Gridview but of no use, any clue, idea how to solve. Thanks.
Saturday, February 16, 2008 11:54 PM by Satya

# re: Displaying task results in a table

Thanks for the tool. I have a question about using it with Identify. I altered my code to have it work with the Identify tool. Is it true that this tool only works with one map resource? I have two resources in my map resource manager. A graphics selection (0) and a map service (1). When I do an identify, I get the following error at this line of code: m_resultsDisplay.DisplayResults(null, null, null, gdsList[i]); "You must set the Map property to a valid map" Any ideas??
Tuesday, February 19, 2008 1:43 AM by Darren

# re: Displaying task results in a table

Tom, thanks for putting up such a great tool.

I'm having a bit of trouble getting the Identify to work.  I have set up as you instructed above, however, in the Identify.cs file, I get the following error when I do an identify click on the map at the following code line:

m_resultsDisplay.DisplayResults(null, null, null, gdsList[i]);

"You must set the Map property to a valid map"

Any ideas??

Tuesday, February 19, 2008 2:52 AM by wherewhy

# re: Displaying task results in a table

Satya, i am having the same problem with one of my published mxd. i can swap this published mxd for another mxd (within the same web app)and get the "zoom to all" and "zoom to feature" to work fine. the zoom problem only exists on that one mxd. i suspect that its within how i set the mxd up, a projection problem or my layers (GDB). i haven't had time to look further into it. Let me know if you find a fix.
Tuesday, February 19, 2008 5:55 AM by Bryan

# re: Displaying task results in a table

I am getting an error on this particular piece of the code; Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: The server tag is not well formed. Source Error: Line 109: Line 110: Line 111:
Wednesday, February 20, 2008 3:22 PM by Ken Carrier

# re: Displaying task results in a table

Jason, Looks like the control works with ArcGIS Server. I tried changing projection, featurecoodsys and filtercoordsys but of no use.
Sunday, February 24, 2008 7:49 PM by Satya

# Summing the Shape_Length field..???

I'm wondering if there is a way to display the total of all the Shape_Length in a label or so? This would be pretty nice to have.. Any ideas?
Monday, February 25, 2008 10:43 AM by Josh

# PLEASE HELP... Displaying task results in a table

Hello-  I know all the developers get busy but I really need to know how and where to add code to this application that will "Total" the Shape_Length field and display it in a label..

Thanks for any help...

Regards,

Monday, February 25, 2008 8:14 PM by jvickrey79

# re: Displaying task results in a table

Getting the total of any field to display in the gridresults control will require that you modify the web control . check out addResultsGridToPanel in the web control. That is where I add controls to the display panel. A simpler option may be to just create a custom task that executes your query. See Bryan's post on extending the QueryAtributes task: http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2007/05/03/Follow_2D00_up-to-Extending-the-QueryAttributes-Task_3A00_-Zooming-to-selected-features.aspx
Tuesday, February 26, 2008 8:15 AM by Tom Brenneman

# re: Displaying task results in a table

All,

I fixed a problem with the gridResults control where sorting didn't work right when there are multiple results.  This problem is most evident  when you use the gridResults control with the identify tool.  This new control is available on ArcScripts here: http://arcscripts.esri.com/details.asp?dbid=15452 .

Tuesday, February 26, 2008 8:38 AM by tbrenneman@esri.com

# re: Displaying task results in a table

Josh, to do this with the GridResults control you are going to need to modify the addResultsGridToPanel function. This is where I add the web controls to the panel to display the results. there is a lot going on here with template controls and the like to get sorting and stuff like that but you can add whatever summary controls you want after the grid. But this is pretty advanced development and you will have to make the control respond appropriately when the field you are summarizing on is not available (like with points). Since this is probably a specific kind of query that you are doing, I'd recommend dealing with this in a custom task. Bryan has a good example here: http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2007/02/12/Extending-the-QueryAttributesTask-to-highlight-selected-features.aspx. For you, instead of highlighting the features you are going to do a summary and display your results somewhere on the page. You'll likely need to build a custom callback to get your results to display in the page so check out the documentation for building a custom callback. I hope this helps. Tom
Tuesday, February 26, 2008 8:48 AM by Tom Brenneman

# re: Displaying task results in a table

Can someone explain in a little more detail where to put the hyperlink for GridResults code. New to VS 2005 and Server. Any help would be greatly appreciated!
Tuesday, February 26, 2008 1:49 PM by Ken Carrier

# re: Displaying task results in a table

Is it possible to get same for JAVA ADF? This is beautiful.
Tuesday, February 26, 2008 9:28 PM by Mostafa Ghanem

# re: Displaying task results in a table

Can someone tell me how to read the checkbox results from the gridresults and open a new window with those results display in the gridview. I can do this above with the server side button but that refreshes the whole page and I like to do this on the client side so it doesn't refresh the whole page. Any help is appreciated. Nipa Parikh
Wednesday, February 27, 2008 9:38 AM by Nipa Parikh

# Showing Aliases with Query attributes task

Hi all! Great tool. I was wondering if anyone figured out how to display the Alias instead of the actual field name when using the Query attributes task with GridResults. The search attributes for the same dataset displays the Alias name properly when used with GridResults Thanks, P
Wednesday, February 27, 2008 10:35 AM by Perry

# re: Displaying task results in a table

Surender - I get an error in the callback when trying to implement your code for the excel export. Can you tell me why this might be happening? Bryan
Wednesday, February 27, 2008 2:03 PM by Bryan

# Displaying task results in a table - Max records returned

Hi, First of all, I want to express my enthusiasm from this control. Good job ! Second, I want to ask about the number of records returned. No matter what I define in the QueryAttributesTask MaxRecords attribute, I always get 500 records as a result. I tried to look at the code of the control but couldn't find the place. Another question is how can I allow paging ? Thanks a lot, Miri
Thursday, February 28, 2008 12:42 AM by Miri Eshel

# re: Displaying task results in a table

Can someone send the recompiled GridResults that has the Export To Excel built into it. I downloaded the new GridResults that was compiled with SP4 and was surprised to find that this functionality had not already been built into the new version.
Thursday, February 28, 2008 6:07 AM by Ken Carrier

# re: Displaying task results in a table

Miri- Are you trying to get more or fewer than 500 records returned? You may have some success by changing the MaxRecordCount tag in the service configuration file. Go to your ArcGIS Server install directory\server\user\cfg and you will see the configuration files. You can edit them in Notepad. Notice that the MaxRecordCount value is 500 by default. You can edit this as needed and restart the ArcGIS Server Object Manager service to apply the changes.

Thursday, February 28, 2008 9:00 AM by sterlingdq

# re: Displaying task results in a table

Hi Tom or anyone that knows.. I have already installed the previous version of GridResults and have it added in my visual studio IDE custom items dropdown. I just now downloaded the new source code that I wanted to make a few changes to. What are the proceedures to properly registering this new dll? I'm fairly new to this. Thanks,
Thursday, February 28, 2008 2:42 PM by Josh

# re: Displaying task results in a table

Ken - please let me know if you get this. I keep getting callback errors when trying to implement the code above for the excel export. MightyZum@aol.com.
Friday, February 29, 2008 6:41 AM by Bryan

# re: Displaying task results in a table

Sterling - Thanks for your reply. 1. You are right about the configuration file, although when I changed the value to 5000, it got stucked. The layer is in SDE so I wonder why it got stucked. 2. I still wonder how can I use the paging capability of the gridview so I can bring less records each time. Thanks again, Miri
Monday, March 03, 2008 1:11 AM by Miri Eshel

# re: Displaying task results in a table

I would also like to get exporttoexcel built into the gridresults. Has anyone done that. Please let me know.
Monday, March 03, 2008 6:30 AM by Nipa Parikh

# re: Displaying task results in a table

Satya, Were you able to fix the following problem? If so, can you please tell me what exactly did you do? I having trouble using 'ZoomTo' funtion in Grid view. Whenever I select any result and click 'ZoomTo' it zooms far beyond full extent. Thanks in advance. Nipa Parikh
Monday, March 03, 2008 6:32 AM by Nipa Parikh

# re: Displaying task results in a table

I have implemented the Export to Excel in GridView and it works great
Tuesday, March 04, 2008 10:05 AM by Surender

# re: Displaying task results in a table

Do you have a new gridresults that has this built-in functionality?
Tuesday, March 04, 2008 10:45 AM by Nipa Parikh

# re: Displaying task results in a table

+1 From above, or where did you get it?
Tuesday, March 04, 2008 11:09 AM by Fernando

# re: Displaying task results in a table

Hi Tom, thanks for your great work for excellent tool. It helped me a lot. I am integrating your gridResults controls with my custom search task.Every thing is worked fine until I added more than one  search tasks to my application. I added 2 search tasks and 2 gridResults to display the results of each search task in separate gridResults. when I executed the first search task it worked fine and displayed the results in associated gridResults. However when I executed the second search task, it successfully return the result and displayed in the 2nd gridResults, but results in 1st gridResults is replaced with the new results. Basically i want separate results for each search task.

I would be thankful, if someone can help me.

Thanks in advance.

Krishna

Wednesday, March 05, 2008 4:27 AM by pragada_rk

# re: Displaying task results in a table

Need some help here... Tom posted some code in December that allows someone to access the GridResults for tool purposes (posted below). How do I access "ds" (the dataset containing the results). I'm fairly new to AGS but if I can access this that would be a big help.. Thanks to anyone for helping..
//Get the GridResults from the page
       esri_samples.gridResults gResults = esri_samples.Utils.FindControl<esri_samples.gridResults>(pMap.Page, "GridResults1");
       ITaskResultsContainer pTaskRes = gResults as ITaskResultsContainer;
       //Start the activity indicator to get the floating panel to expand.
       pTaskRes.StartTaskActivityIndicator(null, "");
       //Send the dataset to the DisplayResults method
       pTaskRes.DisplayResults(null, "", null, ds);
       //Add the callbacks of the GridResults to the callback of the map (referenced by pMap).
       //since all tools are processed through the map control, the map control
       //itself is in a callback and will take care of updating the grid for us.
       pMap.CallbackResults.CopyFrom(pTaskRes.CallbackResults);
       //Clear the callbacks in the grid so they don't get sent twice
       pTaskRes.CallbackResults.Clear();
</esri_samples.gridResults>
Wednesday, March 05, 2008 6:40 AM by J

# re: Displaying task results in a table

This is a great tool, and perfect for my purposes! The only trouble that I'm encountering is incorporating a hyperlink that was previously working. In the MapIdentify.cs, I have incorporated a hyperlink into one of my table rows (see code below) that places a hyperlink for that particular field in the identify results. This still works with the Grid Results view, but only for the first record returned. How do I apply this for all of the records returned from this table?? Thanks in advance...
                    string tieURL = "";
                    if (table.TableName == "Projects")
                    {
                        tieURL = "<a href="http://mywebpage/basic.aspx?selProjectID=%22" table.rows[0][="" project="" id="" ]="" +="" target="_blank">" + table.Rows[0]["Project ID"] + "</a>";
                        table.Rows[0]["Project ID"] = tieURL;
                    }
Wednesday, March 05, 2008 9:30 AM by L.T.

# re: Displaying task results in a table

When you click on "Selected" in the gridresults, I would like to change the aqua color and fill pattern to transparent, not fill pattern. Has anyone done that? If so, where do you make that change? Nipa
Wednesday, March 05, 2008 11:34 AM by Nipa Parikh

# multiple results issue in gridResults 1.3.1.0

A truly amazing tool, thank you Tom. Just installed the new version 1.3.1.0 but multiple results problem remains: I use gridResults to display results of out-of-the-box Identify tool and it shows only data from the topmost map resource under mouse cursor. It turned to be impossible to display results from the several map resources at the time. The same issue I've experienced with version 1.3.0.0 I've experimented setting up gridResult control on clean out-of-the-box Web Mapping Application doing just necessary corrections mentioned above (MapIdentify.cs, Default.aspx.cs, display_mapidentify.js) -- no success, results are given just for one map resource. With TaskResult it works for all resources in application. Any help to sort it out will be appreciated.
Wednesday, March 05, 2008 1:53 PM by Alexander

# re: Displaying task results in a table

Nipa- No I couldn't fix the problem. It is still same. Thanks.
Wednesday, March 05, 2008 7:12 PM by Satya

# re: Displaying task results in a table

I want to implement "Cancel" functionality for GridResult control as provided in TaskResult control. Anyone have ideas how to do this? Thanks
Thursday, March 06, 2008 1:34 PM by Niem Tang

# EXCEL export

I am having problems building the solution with the code for excel export. Is it possible to get a compiled version with the excel export inlcuded. Thank you.
Monday, March 10, 2008 1:33 AM by fabhatti

# re: Displaying task results in a table- exporting to excel format

Tom Brenneman,

I tried appending the additional case statement to the gridresults.cs file and recompiling a new dll.

However, I get the following error:

Unable to cast object of type 'System.Data.DataColumn' to type 'System.Web.UI.WebControls.TemplateField'

Is there anyway you can send me your edited/updated gridresults.cs file s othat I can use this feature in my web application?

My email is nelsonrj@hotmail.com.

Thank you.

Wednesday, March 12, 2008 11:21 AM by josh5000

# re: Displaying task results in a table

Tom Brenneman, Actually, I can use the exporttoexcel built in functionality in GridResults too. Can you please put the new gridresults.cs here? Thanks. Nipa
Wednesday, March 12, 2008 11:58 AM by Nipa Parikh

# re: Displaying task results in a table

Hi All,

I have implemented the Export 2 Excel and please find the code

case "gridViewExport":                    //This is the Export Link above the Grid Resutls and                     //below code exports the gridview results to Excel file   GridView gv = (GridView)Page.Session["gview"];                    // this for loop is to hide the Zoom,Pan, Report, Check box fields                     // while exporting the excel sheet                                        foreach (TemplateField dColumn in gv.Columns)                     {                       if (dColumn.HeaderText == "Selected")                       {   dColumn.Visible = false;                           break;                       }                       dColumn.Visible = false;                     }                                      string strFileName = String.Empty, strFilePath = String.Empty;                                        strFileName = (HttpContext.Current.Session["HttpSessionID"] + "Report.xls");                                       strFilePath = HttpContext.Current.Server.MapPath("./ExportData/") + strFileName;                    if (File.Exists(strFilePath))                    {                        File.Delete(strFilePath);                    }                    System.IO.StringWriter oStringWriter = new StringWriter();                    System.Web.UI.HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter);                    StreamWriter objStreamWriter;                   ////string strStyle = @' .text { mso-number-format:\@; }';                    objStreamWriter = File.AppendText(strFilePath);                    //Utils.ClearControls();                   // Utils.PrepareGridViewForExport(gv);                                        gv.RenderControl(oHtmlTextWriter);                    //objStreamWriter.WriteLine(strStyle);                    objStreamWriter.WriteLine(oStringWriter.ToString());                    objStreamWriter.Close();                                        string strScript = 'window.open('./ExportData/' + strFileName + '','Export');';                                     CallbackResults.Add(new CallbackResult(Parent, 'javascript', strScript));                                       break;

Thursday, March 13, 2008 8:20 AM by Surender

# re: Displaying task results in a table

In case Any of you want to export the Results from GridResults to excel follow this code below.  I simply made a button in the floating panel and included the code.

Dim gvs As New GridView

       Dim ds As New DataSet()

       Dim dt As New DataTable

       Dim gResults As esri_samples.gridResults = esri_samples.Utils.FindControl(Of esri_samples.gridResults)(Map1.Page, "GridResults1")

       Dim pTaskRes As ITaskResultsContainer = TryCast(gResults, ITaskResultsContainer)

       ds = gResults.ResultsGraphicsDataset

       dt = ds.Tables(0)

       'gvs.DataSource = dt

       dt.AcceptChanges()

       gvs.DataSource = dt.DefaultView

       gvs.DataBind()

       Response.Clear()

       Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")

       Response.Charset = ""

       ' If you want the option to open the Excel file without saving than

       ' uncomment the line below

       ' Response.Cache.SetCacheability(HttpCacheability.NoCache);

       Response.ContentType = "application/vnd.xls"

       Dim stringWrite As New System.IO.StringWriter()

       Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)

       gvs.RenderControl(htmlWrite)

       Response.Write(stringWrite.ToString())

       Response.End()

Thursday, March 13, 2008 8:37 AM by Josh

# re: Displaying task results - how to write results to an access or sql table

Hello,

Can anyone help me with some code on how to write the selected rows from the gridresults to an access or sql table?

Thanks.

Friday, March 14, 2008 11:35 AM by josh5000

# re: Displaying task results in a table - exporting to excel

Does anyone know how to rewrite these lines from Josh to C#:

Dim pTaskRes As ITaskResultsContainer = TryCast(gResults, ITaskResultsContainer)

Dim gResults As esri_samples.gridResults = esri_samples.Utils.FindControl(Of esri_samples.gridResults)(Map1.Page, "GridResults1")

Friday, March 14, 2008 12:31 PM by josh5000

# re: Displaying task results in a table

Hi josh5000- Try this- esri_samples.gridResults gResults = esri_samples.Utils.FindControl(pMap.Page, "GridResults1"); ITaskResultsContainer pTaskRes = gResults as ITaskResultsContainer;
Monday, March 17, 2008 10:31 AM by Josh

# re: Displaying task results in a table

Hi Josh- Try this.. Just snagged it from some code Tom posted earlier //Get the GridResults from the page esri_samples.gridResults gResults = esri_samples.Utils.FindControl(pMap.Page, "GridResults1"); ITaskResultsContainer pTaskRes = gResults as ITaskResultsContainer;
Wednesday, March 19, 2008 8:08 PM by Josh

# re: Displaying task results in a table

Hi Tom, I'm getting the following error: 'the given key was not present in the dictionary'. I've searched msdn forums and didn't come across anything helpful. I also searched ESRI support and didn't find much. Now...I'm really only 'pretending' to be a .NET developer trying to do some prototyping. Here's the code that's failing: trc = GridResults1 If qdatatable.Rows.Count > 0 Then ds.Tables.Add(qdatatable) trc.DisplayResults(Nothing, "", Nothing, ds) Else dg.DataSource = qdatatable dg.DataBind() dg.Visible = True End If The code throws the exception on the 'trc.displayresults' line. Thanks for any help!
Thursday, March 20, 2008 6:08 AM by Aaron in Madison, WI

# re: Displaying task results in a table

Josh, how did you implement that code for exporting to Excel?  I am confused on where to exactly put it since I am very inexperienced with coding.  If you can email me at fernandol@burienwa.gov witht he steps?  Thanks!

Thursday, March 20, 2008 10:19 AM by dynamic80

# re: Displaying task results in a table

Could not load file or assembly 'gridResults, Version=1.3.1.0, Culture=neutral, PublicKeyToken=4117b0729e6ae73a' or one of its dependencies. The system cannot find the file specified

It wants me to make a registry change - but I don't want to do that to all my users?

Thursday, March 20, 2008 3:13 PM by bcales

# re: how to find the gridview control embedded or nested within the gridresults control

Josh - thanks for the help.

I am also looking to directly get a grasp of the gridview that is within this control so that I can iterate through each row/record returned.

Does anyone know how to get to the gridview control? Looks like it's nested right?

Thanks.

Monday, March 24, 2008 3:02 PM by josh5000

# re: Displaying task results in a table - export to excel

Surender,

I am unable to use your sample to get the excel export to work.

Is there anyway you can email me your gridresults.cs file (nelsonrj@hotmail.com).

Please let me know.

Thanks.

Monday, March 24, 2008 3:15 PM by josh5000

# Displaying task results in a table - Zoom in and Pan Buttons

Hi Tom, Nice work. This is a nice tool. I try to use that tool but I am facing a problem with the Zoom in, Pan and Selection buttons. There is no any button and the Option button for the selection is disabled. Also the Choices about the zoom to selected features are not available. Can you help me in order to activate that buttons? Thanks a lot, pit pap
Monday, March 24, 2008 6:21 PM by Pit Pap

# re: Displaying task results in a table

Josh,

 Here is the code I use to loop thru gridresults gridview and get the value of selected checkbox.  I'm creating a session variable and pass that list to the next page.

I hope this helps.

Function SubsetSelectionFromGridResults()

If Not Me.GridResults1.ResultsGraphicsDataset Is Nothing Then

           Dim recMumView As DataView = GridResults1.ResultsGraphicsDataset.Tables(0).DefaultView

           Dim recNumDataTable As DataTable

           Dim i, j As Integer

           Dim tmp As String = ""

           Dim selected As Boolean

           Dim recNumList As New ArrayList

           Dim SelRecnum As String = ""

           recNumDataTable = recMumView.Table

           For i = 0 To recNumDataTable.Rows.Count - 1

               selected = recNumDataTable.Rows(i)("IS_SELECTED")

If selected = True Then

                   recNumList.Add(recNumDataTable.Rows(i)("RecNum"))

               End If

           Next

           If recNumList.Count > 0 Then

               For j = 0 To recNumList.Count - 1

                   tmp &= recNumList(j).ToString + ","

               Next

           End If

            If tmp.Length >= 2 Then

               SelRecnum = Left(tmp, tmp.Length - 1)

           End If

           Session("SelRecnum") = SelRecnum

           Dim aURL As String = "buildOrderform.aspx"

           Dim returnstring As String

           Dim sw As New System.IO.StringWriter()

           Dim htw As New HtmlTextWriter(sw)

   htw.Flush()

           returnstring = sw.ToString()

           Dim sb As New System.Text.StringBuilder

           sb.Append("OpenWindow=window.open('" + aURL + "', 'CustomPopUp',")

           sb.Append("'width=800, height=800, menubar=yes, resizable=1,scrollbars=1');")

           Dim cr As New CallbackResult(Nothing, Nothing, "javascript", sb.ToString)

           Map1.CallbackResults.Add(cr)

           Dim jsChangeCursor As String = "map.divObject.style.cursor = map.cursor"

           Dim cursorCallbackResult As ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult = New ESRI.ArcGIS.ADF.Web.UI.WebControls.CallbackResult(Nothing, Nothing, "javascript", jsChangeCursor)

           Map1.CallbackResults.Add(cursorCallbackResult)

           Return Map1.CallbackResults.ToString()

       End If

Tuesday, March 25, 2008 6:20 AM by Nipa

# re: Displaying task results in a table

I'm still waiting for someone to give me export to excel function built in with gridresults.

I would really appreciate.

My email id:  parikhnipa@hotmail.com

Tuesday, March 25, 2008 6:22 AM by Nipa

# re: Displaying task results in a table

I'm trying to add a bottom panel below the map that will automatically expand when results are posted - similar to the side panel

Tuesday, March 25, 2008 2:58 PM by bcales

# re: Displaying task results in a table

I'm trying to display the query results in a new window using gridResults control, just like the sample Common_QueryNewWindow. But can't buddy the map control in the parent window. Anyone help me?
Friday, March 28, 2008 1:51 AM by Tony

# re: Displaying task results in a table

Sorry I'm just now checking this post again. Some folks have asked about exporting to excel and I have emailed them the VB code for this. Hope that helped.
Friday, March 28, 2008 6:04 AM by Josh

# re: Displaying task results in a table

Could not load file or assembly 'gridResults, Version=1.3.1.0, Culture=neutral, PublicKeyToken=4117b0729e6ae73a' or one of its dependencies. The system cannot find the file specified.

Do I have to install it on the server?  I added the .dll as a resource, but that didn't do it.

Friday, March 28, 2008 2:37 PM by bcales

# re: Displaying task results in a table

This comment relates to the following entries relating to attempting to zoom to a feature by selecting the hyperlink in the gridView results table and the map responds by zooming *out* to (or beyond) the full extent: - Michael, 1/18 - Satya, 2/16 - Nipa, 3/3 - Satya, 2/11 - Bryan, 2/19 - Satya, 3/5 This exact behaviour was happening to me as well and I was able to overcome it. I actually ended up making a few changes at once (not good form, I know) so I've listed them all here: 1) Control configs: - Use a very low setting for 'MidWidthOfZoom' (I used '1') - Use a lower-than-default setting for 'ZoomExtentExpansionPercent' (I used '5'). In the end this is probably what fixed it for me, in particular the 'MidWidthOfZoom' of 1 seems to produce the expected results. 2) Upgrade the control to v1.3.1. Not sure if this made a difference or not since I was able to reproduce the 'zoom out beyond full extent' behaviour w/ this version as well. *** IMPORTANT NOTE IF YOU UPGRADE YOUR CONTROL: Make sure you change the following lines in your project files (updating the version string from '1.3.0' to '1.3.1') or MS VS (I'm using 2005) will hang up on you: - web.config: - Default.aspx: <%@ register assembly="gridResults, Version=1.3.1.0, Culture=neutral, PublicKeyToken=4117b0729e6ae73a" namespace="esri_samples" tagprefix="esri_samples" %> It probably can't hurt to completely remove the control from your toolbox and re-add the newer version, and/or restore your toolbox to the default (if you don't have too many custom controls on it) by selecting 'Reset Toolbox', and then re-adding the new version of the control. 3) Changed the theme config for the table styles using the instructions at the top of this thread; requires changes to web.config and ...\App_Themes\\Default.skin. In the end, this likely had no effect on the 'zoom to' behaviour, but it was a change nonetheless. And it sure looks perty. Other notable things: - I did *not* make any changes to my .mxd file. The changes noted above worked for me w/o changing the mxd file. - RE Bryan's entry of 2/19/2008, 'i can swap this published mxd for another mxd (within the same web app)and get the "zoom to all" and "zoom to feature" to work fine': Bryan, how do you 'swap the published mxd for another mxd within the web app'? Are you doing this during run-time, or design-time? If in run-time, are you programmatically modifying/toggling your MapResourceManager?? If so, how are you doing it? Just curious... - This gridView was very nearly exactly what I was looking for, and I'm very grateful for it. The only things I'd like to add/mod are things already mentioned in the thread above: 'zoom to selected items only', various right-click functionality available in default TreeView control (remove, pan-to, zoom to, re-run, refresh, etc.), additional hyperlinks.
Monday, March 31, 2008 5:00 PM by crb

# re: Displaying task results in a table

Any resolution to those trying to use the Export to Excel in the source code?  I tried that also and cannot get it to work.  Other than the code pasted here, are there missing steps?

I was able to get the other code to run during runtime and outside form modifying the source code, and am still battling how to truly make it user friendly with the help from Josh. But tearing my hair out the past few days to get a simple thing as exporting to a spreadheet is getting frustrating.

Hope someone found something with some documentation on how to implement so that the community can take advantage of it. :)

Monday, March 31, 2008 5:41 PM by dynamic80

# Export to Excel

Please check the code I have pasted earlier in this link for export to excel..it works fine for me Note: you need to create a required session variable with the Gridview data Surender
Tuesday, April 01, 2008 12:52 AM by Surender

# Validating..

Tom, Bryan, or anyone that knows.. I placed a session variable inside the gridresults.cs and I want to call this session variable to see if it's set to true immediately after the GridResults displays the data. Is there a property I can "handle" in a Sub procedure to check for this? I tried FloatingPanel1.PanelExpanded but that wasn't exactly what I needed. Any other thoughts? None of the properties in Floatingpanel or GridResults seem to help unless I'm missing something?? Regards,
Wednesday, April 02, 2008 10:47 AM by Josh V

# re: Displaying task results in a table

essential. because the customers want to have the same functionality in the adf client as they had in the arcims client. selection, query-builder, table-results and so on. keep on providing these essential samples.
Thursday, April 03, 2008 1:42 AM by ManInTheMiddle

# Re: Validating..

To reword my question directly above- How do you check to see if the GridResults1 control has results or not WITHOUT using a button? It's hard to make my question more clear than that. If anyone has an idea, just let me know. Thanks for any help in advance.. Regards,
Thursday, April 03, 2008 7:35 AM by Josh1

# re: Displaying task results in a table

bcales: I was getting the same error, but fixed it by running the install on my server instead of my local machine.
Friday, April 04, 2008 9:15 AM by Renee

# re: Displaying task results in a table

Great component!. I use it on various projects, adding the export capability. But, How i can add the paging capability whitout recharging the page?. Looking the source-code i find the GridView instance, but at the moment i add the sorting and paging property, its return me an error.

I think, it's like the sorting functionality, but i don't find the way.

Thanks at all.

Thursday, April 10, 2008 1:42 AM by pvcuervas

# re: Displaying task results in a table

Anyone able to get the results to display below the map in a panel that can be hidden, similar to the side panel.

Or like Tony asked about having the results show in a new window

Tuesday, April 15, 2008 11:57 AM by bcales

# re: Displaying task results in a table

I have created a buffer tool which selects parcels based on a buffer polygon. I do a query using a spatialfilter and dump my results into a datatable. I then pass the datatable to the gridresults. That part works great. The problem happens when I attempt to use the datatable to render the select parcels from the buffer. They are defaulting to a read color with a transparency and I if I give it a new color that is displayed as well. I have had an incident open with ESRI and they decided it had to do with the gridresults. I hoping not to have to go into the source code to try and fix this. What I would like to do is change the red color to clear and just get rid of it so that when I send the shapes to my graphicslayer for display the display with the specified color of aqua. Has anyone encountered this? Here is a portion of my code. The first chunk is my grabbing of the parcel shapes to be displayed in my graphics layer. The second is the part where I cycle threw the rows in my datatable and change their color to aqua with a 70% transparency. Like I said The aqua works, but something is happening where my datatable is already rendering in red. ### First Part of Code ### Polygons That Fall Within It and throw then into a Data Table (dtBufferedPolygons) ESRI.ArcGIS.ADF.Web.SpatialFilter sfBufferPolygons = new ESRI.ArcGIS.ADF.Web.SpatialFilter (); sfBufferPolygons.MaxRecords = 1000; sfBufferPolygons.Geometry = newBufferPolygon; sfBufferPolygons.ReturnADFGeometries = true; dtBufferedPolygons = qfunc1.Query (null, lids[layer_index1], sfBufferPolygons); #### Second Part #### foreach (System.Data.DataTable dt in sResource.Graphics.Tables) { if (dt is ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer) { slayer = (ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer)dt; break; } } if (slayer == null) { slayer = new ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer (); sResource.Graphics.Tables.Add (slayer); } slayer.Clear (); ESRI.ArcGIS.ADF.Web.Geometry.Geometry geoSelectionPolygon = (ESRI.ArcGIS.ADF.Web.Geometry.Geometry)geoSelect; ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol sss = new ESRI.ArcGIS.ADF.Web.Display.Symbol.SimpleFillSymbol (); sss.Color = System.Drawing.Color.Transparent; sss.Transparency = 25; sss.Color = System.Drawing.Color.Aqua; ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement geSelectionPolygon = new ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement (geoSelectionPolygon, sss); slayer.Add (geSelectionPolygon); #endregion foreach (System.Data.DataTable dt in spResource.Graphics.Tables) { //Draw Selection Polygon on Selection Graphics Layer if (dt is ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer) { splayer = (ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer)dt; break; } } if (splayer == null) { splayer = new ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer (); spResource.Graphics.Tables.Add (splayer); } splayer.Clear (); System.Data.DataRowCollection drs = dtBufferedPolygons.Rows; drs = dtBufferedPolygons.Rows; for (int i = 0; i < dtBufferedPolygons.Columns.Count; i++) #region Find Index # for Geometry Field for SelectedParcels { if (dtBufferedPolygons.Columns[i].DataType == typeof (ESRI.ArcGIS.ADF.Web.Geometry.Geometry)) { shpind = i; break; } } #endregion try { foreach (DataRow dr in drs) { ESRI.ArcGIS.ADF.Web.Geometry.Geometry sgeom = (ESRI.ArcGIS.ADF.Web.Geometry.Geometry)dr[shpind]; ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement sge = new ESRI.ArcGIS.ADF.Web.Display.Graphics.GraphicElement (sgeom, System.Drawing.Color.Aqua); sge.Symbol.Transparency = 70.0; splayer.Add (sge); } } catch { throw new Exception ("No geometry available in datatable"); }
Wednesday, April 16, 2008 7:50 AM by Michelle Mestrovich

# re: Displaying task results in a table

Intro - ArcGIS Server and ArcObject beginner I would like to know how to create a Table Result at the bottom of the map, instead of the left pannel or new window? anybody?
Wednesday, April 16, 2008 4:40 PM by Kyung Lee

# re: Displaying task results in a table

How do you initiate the gridViewExport - I see the code, but there is no button

Thursday, April 17, 2008 7:15 AM by bcales

# error invoking Manager after modifying gridResults

I loaded the gridResults project source into my own map viewer project so that I could customize it. I was able to do so and can compile as a new version (1.3.1.1), make changes, etc. and they are reflected in my map viewer.  However to avoid any version conflicts with the version provided in this blog (v1.3.1.0), I uninstalled v1.3.1.0 first and then added v1.3.1.1 to my VS Toolbar. Again, everything in my project works fine.

<br>

However, when I try to start the ArcGIS Manager console (the compiled web app that gets installed w/ ArcGIS Server and which runs on the same dev machine) I get the following exception:

<br><hr><br>

An error has occurred at: http://localhost/ArcGIS/Manager/login.aspx?ReturnUrl=/ArcGIS/Manager/GISServer/Default.aspx.

<br>

Could not load file or assembly 'gridResults, Version=1.3.1.0, Culture=neutral, PublicKeyToken=4117b0729e6ae73a' or one of its dependencies. The system cannot find the file specified.

<br>

For more details, check Manager's web server application event log.

<br><hr><br>

The IIS logs contain no additional information (at least not anything helpful). The Manager app is pre-compiled and contains no references to gridResults in the web.config or anywhere else, so I'm not sure where it's picking up this dependency.

<br>

Has this happened to anyone else?

Tuesday, April 22, 2008 10:39 AM by sahale

# Removing unwanted Fields

Rocky or Tink0519 I have seen several post on removing unwated fields (i.e. "Shape"). Quoted text below "Add any column names you do not want displayed to that if statement: && dc.ColumnName.ToUpper() != "ADF GEOMETRY" Make sure you completely remove gridResults from your website before you try to use your newly compiled version, including removing the assembly reference in the web.config file" I can not get this to work. I have made the changes in gridResults.cs and recompiled the dll. Completely removed it from the website and added it back in. I don't know what the problem is. Is there a trick I am missing. Could someone give a step by step method that worked for them. One other thing, has anyone figured out how to get hyperlinks in a column of the table? Thanks, Aaron
Tuesday, April 22, 2008 3:45 PM by Aaron

# re: Removing unwanted Fields

Aaron:

Here's what I did (I may have the order slightly off since I'm going off of memory but overall it should work for you):

1. Remove the grid from your toolbar: right-click in toolbar and select 'Choose Items...', then uncheck 'gridResults' box in 'Choose Toolbox Items' window

2. Uninstall the version of the control on your dev server using the uninstaller that was laid down when you installed the control, e.g. <INSTALL_ROOT>\GridResultsInstall\Debug\setup.exe (I might have the name wrong since I've already uninstalled and the uninstaller itself was removed, so there might be an uninstall program named something other than 'setup.exe').  BEWARE:  If your dev server also hosts your ArcGIS Manager web app, it may break Manager. This happened to me and I've yet to find a fix (see 'error invoking Manager after modifying gridResults' post immed. above yours).

3. Download the latest (v1.3.1) source from the ArcScripts link above or here:  http://arcscripts.esri.com/details.asp?dbid=15452

4. In Visual Studio in your map viewer project, select 'File > Add > Exiting Project...', browse to your gridResults source and add the project 'gridResults.csproj'.  The 'gridResults' project should appear in Solution Explorer.

5. Compile the project (you can do so either by right-clicking the 'gridResults' and selecting 'Build' or by building your whole project).

6. Add the control to your toolbox using the steps in #1 above and selecting 'Browse', browse to gridResults.dll.  This step may not be necessary since you may not need the control in your toolbox to add it to your project if you've added the gridResults to the same solution where you're using it.

Thursday, April 24, 2008 11:06 AM by sahale

# re: Removing unwanted Fields

Aaron:

Here's what I did (I may have the order slightly off since I'm going off of memory but overall it should work for you):

1. Remove the grid from your toolbar: right-click in toolbar and select 'Choose Items...', then uncheck 'gridResults' box in 'Choose Toolbox Items' window

2. Uninstall the version of the control on your dev server using the uninstaller that was laid down when you installed the control, e.g. <INSTALL_ROOT>\GridResultsInstall\Debug\setup.exe (I might have the name wrong since I've already uninstalled and the uninstaller itself was removed, so there might be an uninstall program named something other than 'setup.exe').  BEWARE:  If your dev server also hosts your ArcGIS Manager web app, it may break Manager. This happened to me and I've yet to find a fix (see 'error invoking Manager after modifying gridResults' post immed. above yours).

3. Download the latest (v1.3.1) source from the ArcScripts link above or here:  http://arcscripts.esri.com/details.asp?dbid=15452

4. In Visual Studio in your map viewer project, select 'File > Add > Exiting Project...', browse to your gridResults source and add the project 'gridResults.csproj'.  The 'gridResults' project should appear in Solution Explorer.

5. Compile the project (you can do so either by right-clicking the 'gridResults' and selecting 'Build' or by building your whole project).

6. Add the control to your toolbox using the steps in #1 above and selecting 'Browse', browse to gridResults.dll.  This step may not be necessary since you may not need the control in your toolbox to add it to your project if you've added the gridResults to the same solution where you're using it.

7. Modify your map viewer project so that it reflects the new version (which should be 1.3.1.0 if you haven't changed it in Assembly.cs):

- Default.aspx:

<%@ register assembly="gridResults, Version=1.3.1.0, Culture=neutral" namespace="esri_samples" tagprefix="esri_samples" %>

- web.config:

<add assembly="gridResults, Version=1.3.1.0, Culture=neutral"/>

Thursday, April 24, 2008 11:09 AM by sahale

# An unhandled exception has occurred... error

Aaron, Rocky, Jeff and Tom: I get "An unhandled exception has occurred: Object reference not set to an instance of an object" message when I click on Zoom/Pan buttons on the table result using QueryAttributeTask. Funny thing is that I dont get this error if I use Search task. How did you guys fix this issue? Seems like I'm not the only one who's having this problem, any help would be great! Thanks, Kyung
Monday, April 28, 2008 9:31 AM by Kyung

# re: Displaying task results in a table

Kyung, If I remeber correctly you get the "unhandled exception error" when you have the shape field turned off in your map document. You need to have it turned on.
Monday, April 28, 2008 1:49 PM by Aaron

# re: Export to Excel using gridViewExport

Surrender - Thank you for the code you posted on the blog. However, I'm having a small difficulty w/ this. I added the code and re-created the dll, but I dont see how the export works. I dont see any button or link to perform the export click event. (I'm new to programming as you can tell) Thank you, appreciated!
Tuesday, April 29, 2008 11:14 AM by Kyung

# re: Displaying task results in a table

Aaron - Thank you, that worked!
Tuesday, April 29, 2008 11:14 AM by Kyung

# re: Displaying task results in a table

sahale Thanks for you detailed description, however I am still not getting it to work. I noticed that the new version is different && dc.ColumnName.ToUpper() != pGl.IsSelectedColumn.ColumnName.ToUpper() versus && dc.ColumnName.ToUpper() != "IS_SELECTED" I have tried adding several column names && dc.ColumnName.ToUpper() != "Shape Area" && dc.ColumnName.ToUpper() != "Shape" && dc.ColumnName.ToUpper() != "SHAPE" && dc.ColumnName.ToUpper() != "Shape_Area" I continue to get the fields "Shape Area" and "Shape Length" showing up. What do I need to type to have them not appear. I have tested this with other common fields and that does not work either. Thanks for all your help. If I could get this figured out that would be great.
Wednesday, April 30, 2008 6:28 AM by ammielke

# re: Export to Excel using gridViewExport

Anybody got Surender's Export to Excel code to work? If so, can anybody send me the gridResults.cs file? or Help me to get it to work? I really appreciate your help! thanks, Kyung
Thursday, May 01, 2008 3:27 PM by Kyung

# re: Displaying task results in a table

I have implemented the gridResults control with a custom task I've developed. The gridResults displays the records, however, the zoom, pan, and select commands cause the "unhandled exception" error mentioned throughout this blog. I have check and the shape field is visible. Are there any other suggestions for getting these controls functional? Thanks.
Friday, May 02, 2008 6:57 AM by Philip

# re: Displaying task results in a table

Is there a maximum number of results that gridResult can handle? Some of my results will be well over 10,000. Anybody know if the gridResult can handle that many? if not, any way to modify the code to make it work? thanks
Tuesday, May 06, 2008 11:40 AM by Kyung

# re: Displaying task results in a table - hyperlinks

I figured out a quick hyperlink fix for the grid results and thought I'd share. This is a really long thread so I'm not sure if a solution was found yet. I need to wrap all my zoning and land use codes within my parcel layer with links to site to look up the codes:

   // Create hyperlink for parcel data on zoning & land use fields

                   if (dt.TableName == "Parcels")

                   {

                       foreach (DataRow dr in dt.Rows)

                       {

                           foreach (DataColumn dc in dt.Columns)

                           {

                               switch (dc.ToString())

                               {

                                   case "Zoning":

                                       dr[dc] = "<a href=\"http://municipalcodes.lexisnexis.com/codes/sonomaco/ \" onClick=\"window.open(this.href); return false \" title=\"External Link: opens web site in a new browser window. \" target= \"_blank \">" + dr[dc].ToString() + "</a>";

                                       break;

                                   case "Land Use":

                                       dr[dc] = "<a href=\"http://www.sonoma-county.org/prmd/docs/gp/index.htm\" onClick=\"window.open(this.href); return false \" title=\"External Link: opens web site in a new browser window. \" target= \"_blank \">" + dr[dc].ToString() + "</a>";

                                       break;

                                   default:

                                       break;

                               }

                           }

                       }

                   }

I place this in the addResultsGridToPanel method. = )

Thursday, May 08, 2008 11:10 AM by sphelps

# Non-spatial data

Is there a way to use this tool with non-spatial data?  I need to query a non-spatial database, return the results, and somehow allow the user to zoom to the point features that are related to the non-spatial records.  I do have a field in common in both my spatial and non-spatial data to use as a relate.  And, no, I cannot create a spatial view, these datasets are on two different servers.    I'm doing this using a custom task I developed.  Can I simply add the spatial information to my non-spatial dataset?  i.e. - add x and y fields?

Thursday, May 08, 2008 3:10 PM by stiggy

# QUery Attribute Task

Im trying to post the Query Attibute Task to my GridResults1 but im getting the following Error:AN UNHANDLED EXCEPTION HAS OCCURRED:YOU MUST SET THE MAP PROPERTY TO A VALID MAP. This error comes twice at a time and also my map disappears!!!!! Please Guide.... Thanks
Monday, May 12, 2008 7:07 AM by NewKid

# re: Displaying task results in a table

sphelps, I saw your post about adding a hyperlink field. I can't seem to get it to work. I am new to programming so this might take some time. After updating the code do I need to rebuild the .dll? If so how do I do this. In general what steps do I need to take to get this updated version to work? Thanks, Aaron
Monday, May 12, 2008 7:30 AM by Aaron

# re: Displaying task results in a table

How can I refer to the gridresults inside a floating panel? I need to display the selected features in (via SelectFeatures.vb) in the gridresults. Following is how I try to bind the two but I just get an image of a grid. Note that if I do not have the gridresult inside a floating panel, I can see the results. Dim relPanel As FloatingPanel = CType(mapctrl.Page.FindControl("FPGridResults"), FloatingPanel) Dim gResults As esri_samples.gridResults = esri_samples.Utils.FindControl(Of esri_samples.gridResults)(relPanel, "GridResults1") Dim pTaskRes As ITaskResultsContainer = TryCast(gResults, ITaskResultsContainer) Thanks for any help!
Monday, May 12, 2008 8:41 AM by Madhavi

# re: Displaying task results in a table

Never mind, I dropped the floating panel and created another one with the gridview inside. Now the above code works perfectly. Thanks!
Tuesday, May 13, 2008 7:42 AM by Madhavi

# Alias names

Did anyone figure out the issue with alias names? It works fine with SearchAttributesTask but when used with QueryAttributesTask it doesn't show the alias names. The same thing works fine with both the tasks if we use the out of the box taskresults panel.
Tuesday, May 13, 2008 9:05 AM by jokri

# re: Displaying task results in a table

Aaron,

Yes, any changes to the gridResults project code requires that you rebuild the dll. Make the changes I suggested, then follow the below steps:

1. Change the Assembly and File Version:

a. In Visual Studios right click on the "Properties" folder in your solution. Choose "Open". This will open the properties window for your project.

b. You will see several tabs on the left. Find and click on the tab called "Application".

c. In the Application section there is a button called "Assembly Information..." Click on this. This will open another little window.

d. There are four boxes next to "Assembly Version" and "File Version". You need to change one of the numbers. I beleive the original build numbers are 1.3.1.0. So if this is right, you would want to change the numbers to 1.3.1.1, for both the assembly and file version.

e. Build the solution.

2. Register with the gac utility.

a. Open the Visual Studio command prompt. (This is located in the "Visual Studio Tools" in your Programs Menu under Microsoft Visual Studio 2005).

b. When you built your project the dll was created in the "bin\Release" directory of your project directory. You will need to find that path for the following command. For example, I stored my project on my D drive: "D:\VisualStudioProjects\GridResults\bin\Release"

c. Use the following command in the VS command prompt to register your dll (gacutil -i <path>\<dll name>):

gacutil -i D:\VisualStudioProjects

\GridResults\bin\Release\gridResults.dll

If successful you should recieve the following message:

Microsoft (R) .NET Global Assembly Cache Utility.  Version 2.0.50727.42

Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

3. Point your application to use the new dll version.

a. Change the version number of the dll. in the Default.aspx file. Assemblies are registered at the top of the default.aspx file. Change the version to the number you used in step one. My last build number was 1.3.1.33 as seen below:

<%@ Register Assembly="gridResults, Version=1.3.1.33, Culture=neutral, PublicKeyToken=4117b0729e6ae73a"

   Namespace="esri_samples" TagPrefix="esri_samples" %>

b. Change the version number of the dll in the web.config file. The <add assembly.../> tags in the web.config need to be changed as well. Look for the gridResults and chnage the version number to the number from step one, also.

<add assembly="gridResults, Version=1.3.1.33, Culture=neutral, PublicKeyToken=4117B0729E6AE73A"/>

4. Recomplie your web application. Your web application is now using the new version of the dll.

Each time you make a change to the gridResults code, you have to go through these steps using a different build number each time. Also, if you want to load your application on another ArcGIS Server you will have to copy your new version of the dll (the file itself) up to the new server, then follow step 2 to register it with the GAC.

=) Hope these directions are clear. If not, let me know where your hung up and I'll try to expand more. Shawna.

Tuesday, May 13, 2008 4:42 PM by shawnaphelps

# re: Displaying task results in a table

We're happy to see that many of you are making use of this control. Also, the community that has grown around this thread is impressive. We have no wish to break it up. However, since this thread has grown a little unweildy we would like to ask that you continue discussion of this GridResults control on the ArcGIS Server ESRI User Forums at http://forums.esri.com/Forums.asp?c=158. We suggest that you post your threads about this control in the ArcGIS Server .Net: Web ADF category.

If there's more information about the control that becomes available, we'll post it here. But new comments to this particular post have been disabled.

Thanks and hope to see you on the forums,

-The ArcGIS Server Development Team

Tuesday, May 13, 2008 5:04 PM by sterlingdq
New Comments to this post are disabled