Last week I resigned from a job I have had for the past 9.5 years, today is my final day there, I have two weeks with my lovely family then I start a new job with an exciting company and one of my good friends who played a major part in me getting hired.
I started my day coming across this speech that Steve Jobs gave at a Stanford graduation ceremony and you found the three stories he tells to be particularly moving. If you have a spare 15 minutes then listen to the stories for yourself, you can even put it on in the background.
Way back in 2006 I created one of the many affiliate marketing sites that have been giving a handy modest return (not easy when your a one man band, with a full time job, and enjoy spending time with your family!). The site was Bingo Tonight and I wanted to learn from the headaches of a previous site Financeland on how to publish database driven content in a url re-write friendly manner from a handful of templates (views) so I could put new offers, reviews up and have them easily crawled with keywords in the URL for SEO juice.
So instead of the httphandlers and component installed on IIS to handle the financeland article redirects the simple use of a custom 404 page using server.execute served my purposes, detecting from the first part of the URL after the domain what the type of request was (controller), then using backslash separated parameters “folders” to select the records (parameters).
So as I’m here in 2011 going through the MVC 3 music store tutorial application… it’s not entirely that unfamiliar to grasp the concept of turning URLs into dynamic pages through a limited set of classes.
Edit: ahhhh most of the way through the music store tutorial now and I’m seeing the power of MVC scaffolded views… yep.. that’s a very nice timesaver indeed!, the razor engine is very nice and clean to code with by the look of it.
If you want to add records to your database using a gridview (the gridview should already have at least one record with this method), you can use the GridView FooterRow as a container to hold the controls for the user to enter new data.
You will then use the InsertParameters collection and InsertCommand of the SqlDataSource, which you populate with FindControl methods in your codebehind in the SqlDataSource Inserting event which is initally fired by something like a LinkButton command.
Nice class with a couple of methods to handle execution of a stored procedure with an array of parameters or a regular query and return a dataset object, all you need do is pass in the connection string when creating the connection.
Connect Conn =new Connect(WebConfigurationManager.ConnectionStrings["NAMEOFCONNECTIONSTRING"].ConnectionString);
Conn.ExecuteProc("AddRecord", new SqlParameter[]{new SqlParameter("@Name", txtName.Text),
new SqlParameter("@Address", txtAddress.Text),
new SqlParameter("@Telephone", txtTelephone.Text),
new SqlParameter("@Comments", txtComments.Text),
new SqlParameter("@CodeField", ddlCodeField.SelectedValue),
});