<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://serverx.esri.com/ESRIBlogs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx</link><description>James Goodrich, a developer on the .NET Web ADF team, contributed this information about some Service Pack 2 enhancements to the Editor task: When the Editor task was released at version 9.2 of the Web ADF for the .NET Framework, a common question was</description><dc:language>en</dc:language><generator>CommunityServer 2.1 (Build: 60809.935)</generator><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#185</link><pubDate>Wed, 02 May 2007 19:45:22 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:185</guid><dc:creator>BRayo</dc:creator><description>I have been working with the Editor task and the Editor Task Discussion is great but when I followed the code for filtering attributes I would get an error at runtime (VS2005 informed me that An AttributeDispayInfos is already set for the specified layer).  

I don't know if this is the same for everyone but I had to add EditorTask1.AttributeDisplay.AttributeDisplayInfos.Clear();
before I declared the AttributeDisplayInfo adi = new AttributeDisplayInfo(0,AttributeDisplayMode.Hidden);
to actually filter the attributes</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#186</link><pubDate>Wed, 02 May 2007 20:07:09 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:186</guid><dc:creator>James Goodrich</dc:creator><description>The code for specifying the filtering of attributes is only applied once using the line 

    if (!Page.IsPostBack)

in Page_Load(). Are you by chance missing this line? You can later retrieve this AttributeDisplayInfo by calling EditorTask1.AttributeDisplay.GetAttributeDisplayInfo(&lt;layerID&gt;) and then modify the settings, but it is an error to try to add multiple AttributeDisplayInfo objects for a given layer.</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#187</link><pubDate>Wed, 02 May 2007 21:04:03 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:187</guid><dc:creator>Mitch </dc:creator><description>We are trying to use the PreAttributeEditEventHandler as a hook into the editor task to modify the value of fields entered by the user when adding/editing points. 

ESRI.ArcGIS.ADF.ArcGISServer.Editor.PreAttributeEditEventArgs contains the property NewValue that holds the value we need to set, but it is read only. Is there a way to set this property?


We have also tried to replace the arguments like so with no success.

    public void editor_PreAttributeEditEventHandler(object sender, ESRI.ArcGIS.ADF.ArcGISServer.Editor.PreAttributeEditEventArgs e)
    {

        ESRI.ArcGIS.ADF.ArcGISServer.Editor.PreAttributeEditEventArgs x = 
            new ESRI.ArcGIS.ADF.ArcGISServer.Editor.PreAttributeEditEventArgs(e.FeatureLayer,e.Feature,e.Field,"test value");
}


Any ideas would be appreciated. Thanks.</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#188</link><pubDate>Wed, 02 May 2007 22:45:55 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:188</guid><dc:creator>James Goodrich</dc:creator><description>Hi Mitch,
Currently the NewValue property is read-only, but we will consider making it read-write at Service Pack 3 if the demand is high enough.</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#190</link><pubDate>Thu, 03 May 2007 15:27:31 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:190</guid><dc:creator>Mitch</dc:creator><description>Is there a way to set default values of fields at runtime before the PreAttributeEditEventHandler? Our customer just purchased ArcGIS enterprise server, and this functionality is essential to thier neeeds. Any other ideas for a possible workaround?

Thanks,

Mitch</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#191</link><pubDate>Thu, 03 May 2007 18:56:43 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:191</guid><dc:creator>BRayo</dc:creator><description>James, I have my 'filterAttributes()' function inside the if (!Page.IsPostBack) block in the Page Load 

I am also interested in Mitch's problem of  setting values by code rather than allowing the user to do it</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#192</link><pubDate>Thu, 03 May 2007 23:55:08 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:192</guid><dc:creator>James Goodrich</dc:creator><description>Mitch, 
The preferred method of setting default field values is through the geodatabase (http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?id=1991&amp;pid=1986&amp;topicname=Associating_default_values_and_domains_with_tables_and_feature_classes). Features created with the EditorTask will have the initial field values set to the defaults defined in the geodatabase.  Will that solve your problem?</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#195</link><pubDate>Fri, 04 May 2007 15:42:19 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:195</guid><dc:creator>Mitch</dc:creator><description>That might come in handy in the future, but the values we need to assign are based on the user. For example, we want to set DATE_CREATED, CREATED_BY,MODIFIED_BY, etc, based on session information.

I was thinking that we might be able to workaround the read-only NewValue property by setting a default value at runtime and then hiding the field as described in the article.

Thank for you help, hopefully we can find a way to make this work. 

</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#197</link><pubDate>Fri, 04 May 2007 16:24:53 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:197</guid><dc:creator>James Goodrich</dc:creator><description>Mitch,
You could do something like this in your event handler to set a field value: 

        int index = e.Feature.Fields.FindField("DATE_CREATED");
        e.Feature.set_Value(index, DateTime.Now.ToString());
        e.Feature.Store();
</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#199</link><pubDate>Fri, 04 May 2007 18:42:54 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:199</guid><dc:creator>Mitch</dc:creator><description>James, Thank you - you've made my day. One last question, and we will have a really happy ESRI customer. In the editor panel, is there a way to tell .net to display a textarea instead of an input? Thanks again.</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#200</link><pubDate>Fri, 04 May 2007 19:40:24 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:200</guid><dc:creator>James Goodrich</dc:creator><description>You're welcom Mitch. And in response to your last question, there is currently no way to display a textarea instead of an input. I'll put it on the wish list and see about adding this in as a future enhancement.</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#201</link><pubDate>Fri, 04 May 2007 20:32:57 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:201</guid><dc:creator>Mitch</dc:creator><description>Thank you. This blog is great. I'll be watching for any updates.</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#203</link><pubDate>Tue, 08 May 2007 15:17:43 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:203</guid><dc:creator>Adam</dc:creator><description>I'll first state that I'm a beginner but I want to dive in head first to developing with ArcGIS Server and blogs like this are very helpful aside from standard documentation. So Thanks!

My question:  These comments seem to be discussing accessing the text boxes and text values associated with an editing task.  Where would code like this be placed?  For example, I have had a hard time trying to figure out where a calendar control would go when entering a date value in a text box.  This would give the editor a very straight forward way to enter the date to minimize error, etc.

Thanks!</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#204</link><pubDate>Tue, 08 May 2007 16:17:57 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:204</guid><dc:creator>Mitch</dc:creator><description>Adam,

Add OnPreAttributeEdit="editor_PreAttributeEditEventHandler" to your editor task and the code below. Every time a user edits a field, this event is fired. I'm not an expert, but hope this helps. - Mitch

------------------------------------------------------------------------------------------------

    public void editor_PreAttributeEditEventHandler(object sender, ESRI.ArcGIS.ADF.ArcGISServer.Editor.PreAttributeEditEventArgs e)
    {


     
        if (e.Feature.get_Value(e.Feature.Fields.FindField("Created_On")).ToString().Trim().Length == 0)
        {
            e.Feature.set_Value(e.Feature.Fields.FindField("Created_By"), User.Identity.Name);
            e.Feature.set_Value(e.Feature.Fields.FindField("Created_On"), DateTime.Now.ToString());
        }
        e.Feature.set_Value(e.Feature.Fields.FindField("Modified_By"), User.Identity.Name);
        e.Feature.set_Value(e.Feature.Fields.FindField("Modified_On"), DateTime.Now.ToString());



        e.Feature.Store();
    }</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#205</link><pubDate>Tue, 08 May 2007 17:19:46 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:205</guid><dc:creator>Adam</dc:creator><description>Mitch,

Thanks for replying.  I first converted the code to VB since that's what i'm most familiar with.  I added the OnPreAttributeEdit value to the editor task and then put the code in the Default.aspx.vb file at the very end as a Public sub and changed the field names to what I was using in my database. The web app still functions normally but the text boxes do not populate with any value.

I also tried to place a break point at the beginning of the sub routine to see if I could step through it and the program did not break.

Am I placing the code in the correct spots?Thoughts?  Thanks again for your help.</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#206</link><pubDate>Tue, 08 May 2007 17:30:56 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:206</guid><dc:creator>Mitch</dc:creator><description>Adam,

The text boxes don't populate until you save. Try running the code, saving, and viewing the result with the info tool. The fields I'm using are being hidden, so this isn't a problem. It may be a problem for you.
------ I am also trying to add calendar componets, textareas, etc, to the editor task. I have had no luck thus far. We may have to wait until they realse the next update (or the source code). 
-Mitch</description></item><item><title>re: Customizing the Web Editor task</title><link>http://serverx.esri.com/ESRIBlogs/blogs/arcgisserver/archive/2007/05/02/Customizing-the-Web-Editor-task.aspx#207</link><pubDate>Tue, 08 May 2007 18:12:23 GMT</pubDate><guid isPermaLink="false">b60b3f0a-e2bd-4be5-8a18-822c697649ab:207</guid><dc:creator>Adam</dc:creator><description>I see now that the code executes after the values are entered.  I get an error message saying that object reference is set to a null value now.

I sure hope there are some improvements like what we are talking about here.  It would definitely help with maintaining data integrity on large-scale data entry projects with AGS.

Thanks a lot Mitch!</description></item></channel></rss>