Thursday, June 14, 2007

ASP.NET 2.0 Data Controls Not Updating - Solution

Couple of extra hooks for searches: GridView, DetalsView, FormView, ASP.NET 2.0, Not Updating, Problem

Please keep in mind these solutions were put into use after much trial & effort and a LOT of google/msdn searching. Also, I suggest these solutions because they worked for me, NOT because I have a deep understanding of why they work (I have a passing understand, but nothing worth writing about).

Solution: The DataKeyNames property of the data control you're using should be set to the Primary field key of the table you're updating. Found the obscure reference here.

Alt Solution: I'm not particularly fond of this solution. It involves making a change to the properties of the (SQL Server) database you're using. In SQL Server 2005 Management Studio, setting ANSI NULLS Enabled = true seems to remove the updating problem as well, but this effects the database and potential pre-written logic on a much larger scale. Make sure you understand the repercussions of changing DB options. Why this works might be discerned from here.

Labels: , , ,

Thursday, March 22, 2007

Ajax Control Toolkit 10301 Fun

And by fun I actually mean a searing pain in the ass.

As much as I'd love to vent about MS's tendency to over complicate the simplest of tasks, I've chosen my poison and need to deal with it.

The problem: Updated my Ajax Control Toolkit to version 10301 and nothing worked. Got some Sys is not defined error.

Path to solution: Google is becoming decreasingly helpful with code problems. Either their algorithms are getting rusty or sites/forums (*cough* Microsoft *cough*) are purposefully hiding data from them. If true, the former is disturbing and the latter is deplorable. Then there's the remote possibility that my search skills are withering... no.

Solution: Cut and paste sections from the web.config that came with the latest toolkit to see if anything would magically make things work again.

This did it:

<system.web>
<!--Other stuff-->
<httphandlers>
<remove verb="*" path="*.asmx">
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false">
</httphandlers>
<httpmodules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
</httpmodules>
</system.web>

What this really comes down to is that I don't understand .NET innards... yet. I do however think the trip is unnecessarily painful (for something they''re just going to dump in a few years anyway). I still remember when RDO was the wave of the future.

A.D.D.-Techno-schizophrenic bastards. Wouldn't be so bad if I didn't so closely resemble them.

Labels: , , ,