I Need Help

I need help.

I'm stuck on this ASP.Net application. I have a few controls on the page that all link up to 2 tables. The one I am stuck on is the Ajax Reorderlist. The Reorderlist is a list that has drag-and-drop capability. You can drag each item in the list and reorder it. For a demo of the Reorderlist, see this link: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ReorderList/ReorderList.aspx

My reorderlist is hooked up to a SQL datasource and it displays a list of items. The client wants to be able to change the order of the items so that the items appear on the main page of the website in a particular order. At first glance, the Reorderlist seems to be just the answer.

This is my problem: how do I add new records and still be able to reorder them? I have the datasource connected to the Reorderlist and it all works great, as long as I don't add new records to the database. Here's the thing: when you set up the table that holds the items you are going to reorder, you have to add a column to the table with a datatype of INT and this column will hold the Sort Order. This column cannot contain Null values. When you drag and drop the list items on the page, the Sort Order is posted back to the server and the values in the Sort Order column of the table are updated.

So, for instance, if I have 3 items in my table and they start out like this:









ItemIDSortOrderID
11
22
33

And if I drag and drop them, then check the table after the post-backs occur, I will see something like this:









ItemIDSortOrderID
13
21
32

Now, if I add a new record, what the heck do I put in the SortOrderID field for a value? I can't auto-increment that column for 2 reasons: #1, ItemID is already an Identity column and I can't have 2 Identity columns; and #2, the values in an identity column keep their value even if you try to reorder them - they don't update.

I could query for the largest SortOrderID value just before I insert a new record and then add "1" to it, which will give me the next available value, then insert that number into the table. But that is my last choice. It's too risky to do that -- what happens when 2 people are adding new records at the exact same time and they pull that value at exactly the same time? It'll screw up the Reorderlist and I'll get a call telling me that it's not working. And then I'll be right back where I am now.

I tried to make the default value zero (0) on inserting, which does technically work but it is extremely sloppy. When I added a few records in a row and then tried to reorder them, the reorderlist got really funky and confused and things started falling out of order.

If I add a null, then the items won't reorder at all - they just snap back in place on the screen.

One more option I tried was putting the Insert screen (see screenshot below) into the InsertItemTemplate of the reorderlist. When you add new rows through this template, the SortOrderID is automatically calculated for you. Brilliant, right? Not exactly. Once I'm in the template I can't access some of the controls, like the dropdown list I use to select a category for the new item.

I know I am not the only person who is doing this. When I google this issue, so many people are connecting their SQL Datasource to a Reorderlist, and I have to believe that they are adding new records to those databases.

Please, if you have any words of wisdom for me, I am all ears....

I am going to post on the ASP.Net message boards, and maybe EXPERT SEXCHANGE.com too. Yes, Jeff, I threw that one in there for you! Jeff likes to point out that Experts Exchange actually spells Expert Sexchange.

Thanks!




it's the weekend!


I have a lot of things to be happy about today. First, I am ALMOST done with the website I have been working on and I am so happy about it. Happy, because it's been taking up a lot of my time and energy, and also because I am really proud of myself for plunging head-first into a new technology and making it work.

Second, I am happy because it's a great time of year to sit back and appreciate our yard and our house. Jeff is almost done painting the family room and today we put things back on the walls and filled up the bookcase. It's looking really nice!


I will tell you this: if I take on any more work, I am going to do 2 things differently. I am getting regular child care for my kids; and I am going to write in C#, not VB. I went with VB for this project because I've been doing sites with ASP in vbscript and VB for a few years and it seemed like a natural transition, but after I started, I realized that everyone is writing in C#. I think I can pick it up OK - years ago, when I first started to think that I might like programming, I took classes at UConn and learned C++. It seems like C# is similar to C++, and it also seems similar to java, which is what I used to build the US Computer Connection shopping cart (although now I would never build a cart in java, or anything else in java for that matter). These past few weeks, I have been a little crazy about the fact that all of the help on the web for .NET applications is in C#, not VB.


It's raining now, so we are staying inside this afternoon and we are going to hang up the *new* mirror in 'A's room and move her mirror to 'H's room. This new mirror was actually a frameless one that was in our bathroom, and when we replaced it with a nicer one, my stepfather took me to the hardware store to pick out some moulding so we could make a frame for it and hang it in 'A's room. It's a wonderful $17 framed mirror! After we hang it, I'll paint it and it will look great. It's heavy - 50 lbs. - so Jeff gets to do the majority of the work.

Have a great weekend!

Sahti and Ba


It's official: our girls have given each other nicknames. 'A' calls 'H' "Sahti", and 'H' calls 'A' "Ba." It all started when 'H' was first born, and 'A' wanted to call her "My Sweetie," but couldn't say the whole thing, so she tried and tried, but could only say, "My Sweet Sahti." It stuck, and Jeff and I refer to 'H' as Sweet Sahti from time to time. This weekend, 'H' started talking more and one day she was looking for 'A', and looked around and looked around, then started yelling, "Ba! Ba!" and it was really clear that she was calling for 'A'. Funny!









a dozen extra houseguests


This is what was waiting for my mother when she got home from the store yesterday. A mama duck and her 11 ducklings! There were very gentle and allowed us to get close. By dinnertime, they had moved on to someone else's wading pool.





















goodnight...


mmmm, I'm sleepy. I had a lot of sunshine and fresh air today, and I thoroughly enjoyed it. I haven't gone to bed before midnight in weeks... so I'm treating myself to an early night! Goodnight and enjoy these shots from today!









Recovering from my recovery


Yesterday morning I went back to the dentist and had some work done. A crown on one side and a replacement filling on the other. It wasn't a bad visit, but he did "forget" to warn me that I might be in a little pain later in the day. Oh boy! By the time we arrived at my mom's house 5 hours later, I was begging for something to numb my jaw. Luckily, she had the fixings for my favorite pain-killer cocktail: Advil and wine. Mmmm, that made me feel good.... until this morning. So today I am spending a little time recovering from my recovery.


When you walk along the beach here at low tide, you can see large patches of grass in the sand. When the tide comes in, the water covers the grass completely. The grass is important because it helps break up the force of the water coming in from the bay and you can see that there is considerably less sand dune erosion in front of the homes that have grass growing in the water.


When we were little, the grass was a neat place to play during low tide because all kinds of creatures live in it, and we liked to pick through it. But when the tide was higher, and on it's way in or on it's way out, the grass became a nuisance. There you were, swimming along, or kicking against a raft with your sisters, and all of a sudden the grass would come up and brush against your belly and it felt really gross and scary. Now that I am an adult, I do a better job of keeping an eye on where the grass might be during high tide and I stay away from it. During low tide we stay away too, because we have learned in recent years that the grass is part of a fragile little eco-system and if you play in it, it can be easily damaged.


Jeff and I did not have ice cream last night and despite what we thought might happen because of the (lack of) dessert situation, we still lived through the night. Our kids woke up sickeningly early today (5:18 am) and since the sun was already pouring through the windows at full speed, it was hard to explain that it was still the middle of the night and sound convincing.


I've been coming to the Cape my whole life. My mother was gifted this property by her parents, who bought a bunch of land here in North Eastham years and years ago. They sold it all over the years except for a few lots on the water, which they kept for their children. For years this house was rented out during the summer. My mother moved here about 15 years ago with her husband (who is originally from Chatham), and they have lived here full-time ever since. Two of my mother's siblings converted their rental homes here to full-time, winterized homes, and now they live next door.

Hi... finally I'm back!


I'm here at the Cape for a much-needed vacation. I haven't been very good at posting my photos lately. I've had a lot going on and I am really looking forward to having some time to dig into my creative self again.

My current computer project is almost done -- it's a website administration tool for an antiques dealer in Connecticut. I wrote it all in ASP.NET 2.0 and AJAX and it's pretty cool.


One of my goals for this weekend is to learn more about taking sunset photos. I suppose it would help if I could be around for sunset, instead of taking care of sleepy children at that time... but anyway, I am going to make an effort to learn how to do it. Stay tuned for a bunch more sunset photos these next few days!


Jeff and I are the only ones up now - and it's still early in the evening. My mom and Dick go to bed SO early. We're craving Ben & Jerry's and we can't go there now because no one is up to keep an eye on our kids! I suppose it's a message from the Universe that we're not supposed to be eating ice cream tonight.


Have I mentioned lately that 'H' is SO DARN CUTE??? She has started to truly communicate with us and it's very refreshing. "Would you like some more?" "No." "Are you all done?" "Yes." It's so much nicer to communicate with words rather than speaking the Scream Language all the time. Not only is it nicer for us, but she's such a cute talker too!

Garlic Scapes!


I'll tell you how much of a food dork I really am. I've been waiting for this second week in June since the middle of June last year. Two words: Garlic Scapes. I was introduced to them 2 summers ago when we did the CSA with a local farm here in Saratoga County (community-supported agriculture: it's a food share, where you pay a farm at the beginning of the season and you get a share of the harvest for the whole summer). When I first saw the garlic scapes, I was a little freaked out. They don't look like something you can really cook with. But oh my, are they fabulous! They taste like garlic, but aren't as strong as garlic. So, what are they? A "scape" is the green stalk that grows out of the garlic, above ground. As it grows taller, it curls, and when it curls, the farmers cut them off so that the garlic growing underground will grow better. The scape is often thrown away.


I make 2 dishes with them and I will share the recipes. If you're looking for scapes, you have one week left, and they are hard to find. I found one table at the Ballston Spa farmer's market and I bought all they had left. OK, maybe that's one reason they're hard to find - I buy all of them! Anyway, after next week, they're gone. Get them while you can.


Garlic Scape Pesto
Chop up a lot of scapes and put them in your food processor. Add a handful of nuts (pine nuts or walnuts). Grind in some Parmesan cheese. Add some salt. Then add a whole bunch of olive oil. More olive oil. And you know what? Lemon juice would probably be good too. I forgot to do that tonight.

There you go, you now have Garlic Scape Pesto! Parse it out into the freezer tray and when they are cold and solid, pop them into a ziploc bag and you have portion-sized sauce ready to go.

Garlic breath, here we come!


Pasta with Garlic Scapes
Cut up the fat part of the scapes into 1-inch lengths. Discard the narrow ends. Heat up some olive oil in a pan. Add the scapes, saute for a minute or two. Pour over pasta. Mix in some tomatoes, and serve. Delicious!


Oh, one more -- if you like to eat crusty bread with your dinner, you can add some finely chopped scapes to a plate of olive oil and use that as a dipping oil.

Beware, I did try to make scape hummus last year and it was a miserable failure.


Here are some links about Scapes: Scapes and More Scapes.











About Me

My name is Jillian. I started this blog as a way to experiment with my camera and it's a become a nice little spot where I enjoy spending time. I'm a mother to 6 and 4 year old daughters, wife to a cool computer guy, and mama to a cuddly cat. We enjoy eating local, organic food; managing several food allergies; homeschooling with love; spending time in nature; and we love to take time each day to be creative. You can also find me over at From Scratch Club from time to time. Welcome!