Writer and Programmer

Uncategorized

In VS2008, I set up a SQLDataSource and bound it to a GridView. The Gridview row had five editable fields and several read-only fields. I set up the SQLDataSource to use a stored procedure for database updates. I had some trouble binding the fields to the stored procedure, checking data types etc but eventually that was all resolved and the sp stopped returning errors such as ‘Too many parameters’.

All seemed to be going well, but the sp was not actually updating my record.

The problem was (ahem) that the sp was a shell I’d thrown together earlier and didn’t actually have an update statement yet…

Once that was fixed I assumed my troubles were over, but no, still no update visible in Management Studio.

I only used this sodding data binding because it’s suppose to save trouble, I thought, should’ve hand-coded the blooming thing like in the old days.

However, I fired up SQL Server Profiler. Things rapidly improved. I realised that my sp was indeed being called, but all my read-only values except one were being passed in as NULL. (Earlier, I had resorted to passing in all my grid columns to the sp to get around the ‘too many parameters’ problem. The unneeded ones were simply ignored).

Hmm.

After some more poking I discovered that the lucky field that was being passed correctly had been set as the DataKeyName on my GridView.

I changed the DataKey name on my GridView to the two fields that I actually needed for my sp’s where clause, and bingo!

It worked.

I think the DataKey may have been set automatically. The select might have picked up the issue, except I was using an sp for that too, with parameters read from textboxes.

I know, I know, RTFM.

In VS2008, I created a new file but it had no code-behind. Chose ‘File – New File – Web Form’. Several times. Tried loads of stuff. No code-behind – the aspx top line was: <%@ Page Language=”VB” %>.

I was thrown because I haven’t used VS2008 for ages. I’d only just installed it and a trawl of Google threw up all kinds of suggestion such as a VS reinstall.

Which wasn’t needed. It turns out you have to add the file via the Solution Explorer to get the code-behind. As in, right-click on the project and choose ‘Add – New Item’.

I stumbled across this while experimenting. Having no code-behind in files added from the File menu is probably a ‘feature’, and so well-known that no-one has bothered documenting it anywhere. Which is why I’ve mentioned it here – hope this helps someone.

 

I want to allow eager readers to sign up on my website to receive emails from me. I have a MailChimp account and my WordPress expert told me it would take five minutes to install a plugin that uses it.

Yeah, right. Not for me! I installed the plugin and supplied my API key and got this message:

“Uh-oh, we were unable to verify your API Key. Please check them and try again!
The server said:Could not connect (ERR 13: Permission denied)”

Frustratingly, a couple of people logged the same issue on the WordPress forum over a year ago but never received a reply.

I tried another MailChimp plugin – same problem.

The solution lay with my hosting provider. They block outgoing connections by default, but you can add them to a whitelist. Once I did this the problem went away.

If you compete in the TopCoder SRMs, the TZTester plugin is very useful. It calls all the tests for you and displays the results, saving valuable minutes in the arena.
I used it with my old computer but couldn’t get it working on my new one, and with the clock counting down, sod’s law was against me.
$RUNTEST$ and $TESTCODE$ sat in my template, stubbornly refusing to become useful C++ code.
The solution was simple – I found it here.
Just make CodeProcessor your default editor, instead of (in my case) popsEdit.

If your TinyMCE control isn’t appearing and just looks like an ordinary text area, check the tinyMCE.init({ syntax. Missing or extra commas or other syntax errors here will cause the init to fail.

When calling the MailChimp listBatchSubscribe method via PerceptiveMCAPI in ASP.NET, I got the followng error:
“A parameter is of, or contains an instance of, type CookComputing.XmlRpc.XmlRpcStruct which cannot be mapped to an XML-RPC type”
I panicked, thinking that the PerceptiveMCAPI, which up to now I’ve found flawless, might be broken for this one, vital method. Was it unable to process the Dictionary it required as input?
After looking closely at my merge vars I commented out one that had a Decimal value. Everything magically worked. Replaced with a double and I’m back on track.

My ASP webpage containing a TinyMCE control worked in Chrome but was broken in IE9. Clicking the ‘Send’ button simply didn’t trigger the sendnow_click event, which I verified by putting a breakpoint in the debugger.
The solution was to remove a superfluous ‘form’ from the page.
I hope this post helps a fellow sufferer.

When trying to start my server in SQL Server Configuration Manager as usual, I got the message:
“The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details.”

I couldn’t consult the log because no log was generated today.

So, the solution was a bit embarrassing. I removed the password from my logon this morning. Apparently, SQL Server doesn’t like Windows logons with no passwords.
Once I added a password again, and typed it into the properties for the SQLExpress server, everything went back to normal. Phew.

So I wanted a vertical menu on www.kellsbaycomputing.com that just lists the pages (of which there are only two).

This is a simple website. I don’t want it to look fancy, I just want it to showcase the other websites we’ve done.

Well ok, I do want it to look fancy but I can’t spare the time so looking error-free will have to do.

I designed a simple vertical menu as part of my Artisteer theme. Installed it. The vertical menu remained unstyled.

The following message appeared on the WordPress admin menu screen: “The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.”

Ok, well I thought it did natively support menus, but whatever. I spent a bit of time fooling about with the Custom Menu widget. Eventually found this Artisteer help page. (Read the “Creating Vertical Menu” bit.)

To summarise: For a simple vertical menu like mine you need to choose ‘Pages’ as the Vertical Menu Source in the Export Options. You also – and this is the bit I missed – need to use a ‘Vertical Menu’ WordPress widget in the Widgets screen. Ignore the ‘Custom Menu’ suggestion made by WordPress.

Oh, I’m using WordPress 3.4.2 and Artisteer 3.1. I’m looking forward to upgrading to Artisteer 4 but with a client demo today, I don’t want to risk breaking anything.

Ita Ryan

Shopping Cart

Loading...

Newsletter

I only send out an email when I publish something new, have a big event coming up, or publish in a new format. So if you sign up to my mailing list you might get one or two mails close together occasionally, but then nothing for months.

I take my readers' privacy very seriously, and will never pass on your email address - Ita