Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Thursday, August 05, 2010

I’m getting data using LINQ to SQL, then showing on the front end.  If I want a null coming from the database to default to something:

<telerik:GridTemplateColumn HeaderText="Image" UniqueName="Image">  
<ItemTemplate>
<asp:Label ID="asdf" runat="server" Text='<%# String.IsNullOrEmpty(Convert.ToString(Eval("Image1"))) ? "noImage.jpg" : Eval("Image1")%>'></asp:Label>
<a href="<%=VirtualPathUtility.ToAbsolute("~/")%>showFrontEndMaterialDetail.aspx?materialId=<%# Eval("Id")%>">
<img src="<%=VirtualPathUtility.ToAbsolute("~/")%>Images/Uploaded/Thumbs/<%# Eval("Image1") ?? "noPhoto.jpg" %>"></img></a>

</ItemTemplate>
</telerik:GridTemplateColumn>


Thanks to these people:
 

http://stackoverflow.com/questions/3410942/linq-to-sql-default-value-nullable

Comments [0] | | # 

When displaying a repeater on an aspx page:

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "FileName")%>
</ItemTemplate>
</asp:Repeater>

or shorter:

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<%#Eval("FileName")%>
</ItemTemplate>
</asp:Repeater>

It is important to remember to make FileName a property and not just a public field ie this works

public class ImageThing
{
public string FileName {get; set; }
}

private void DisplayThumbnailImages()
{
ImageThing imageThing1 = new ImageThing();
ImageThing imageThing2 = new ImageThing();
imageThing1.FileName = "asdf.jpg";
imageThing2.FileName = "aaa.jpg";

List<ImageThing> imagesToRender = new List<ImageThing>();
imagesToRender.Add(imageThing1);
imagesToRender.Add(imageThing2);

Repeater1.DataSource = imagesToRender;
Repeater1.DataBind();
}

this doesn’t

public class ImageThing
{
public string FileName;
}

A property encapsulates a field.

Comments [0] | | # 
# Wednesday, August 04, 2010

31mins.  He took a template from freecsstemplates.org and put it into SiteFintiy

http://www.sitefinity.com/devnet/webinars/designing-skinning-with-sitefinity.aspx

Comments [0] | | # 
# Monday, July 26, 2010

EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"

Be careful you are in the correct db!  I had to manually drop some tables in the correct order due to FK’s

Comments [0] | | # 
# Monday, July 12, 2010

A web application testing system

http://seleniumhq.org/download/

Selenium Remote Control runs tests in multiple browsers.. can do in C#

Selenium Grid can distribute tests across multiple servers.

http://thetestingblog.com/2010/02/02/selenium-rc-in-console-app/

Here is a console, running in C# calling the Selenium libraries, which call a java webserver

To start the server dowloads\selenium-remote-control-1.0.3   java -jar selenium-server.jar

There did seem to be an issue with the include statement of the Selenium core.. I got it working by deleing the using statement, then Ctrl . somewhere..  code in C:\code\SeleniumTest

image

It is easy to put in a rough speed test (8secs here.. was 45 secs with no caching and having to start up the webserver after having left it).

To explore soon:

- Fill out forms

- Actual assertions (can use nUnit)

- Handle ‘test’ edition of sitefinity gracefully

- Force no cache on browser

- Test functionality of site on different browsers

Comments [0] | | # 
# Tuesday, July 06, 2010
( ASP.NET MVC | Moq )

While using Moq to test an MVC app, and Scott Hanselman’s NerdDinner app, I kept getting these strange errors.

Problem was permissions on:

C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys

In Windows XP Pro, you need to disable simple file sharing.. from http://www.windowsbbs.com/windows-xp/52502-cannot-change-permissions-folder.html

image

Then I set perms to be full control to everyone:

image

More granular perms are in here: http://groups.google.co.uk/group/RhinoMocks/browse_thread/thread/26df68ff01567509/5ddebf407228edc4

Now this code works:

image

On Win7: C:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys

Takes some messing around with granting ownership of the directory, then setting full control to everyone.

Comments [0] | | # 
# Friday, July 02, 2010

Useful if you want the ASPNETDB to be in your local SQL Server instance rather than a flat file (which can be troublesome).

image

Use trick of connection via server explorer, then F4 properties, then can copy and paste connection string into web.config.

image

Comments [0] | | # 
# Tuesday, June 29, 2010

see about half way down this article for the first working MVC1 app connecting to the db.

http://wag.codeplex.com/

Using the EntLib5

image

Music Store App (Mar 23rd)

image

Hello World sample bits of code from MS:

image

 

Transferring data up to SQL Azure.. using Script Manager in SQL Man Studio 2008..

http://www.msteched.com/2010/NorthAmerica/COS311

 

Doing a Simple MVC Application and Publishing up to the Cloud (no DB)

This is a simple new project, Cloud Service, ASP.NET MVC2 Web Role

Right click on the VoucherMVC project, then publish.  Upload via the Web Interface.

image

NerdDinner

http://www.marcmywords.org/post/NerdDinner-hosted-on-Windows-Azure-and-SQL-Azure.aspx

Failed to generate a user instance due to a failure in starting the process… DB Error:  Solved by deleting a directory on my local machine (Win 7).

http://www.aspdotnetfaq.com/Faq/fix-error-Failed-to-generate-a-user-instance-of-SQL-Server-due-to-a-failure-in-starting-the-process-for-the-user-instance.aspx

 

Populating the Database

http://azurefeeds.com/post/923/Migrating_an_Existing_ASP.NET_App_to_run_on_Windows_Azure.aspx

Showing how to export a SQL script into SQL Azure format:

image

Ok, have got nerddinner database up there. 

ASP.NET Membership Provider..

http://blogs.msdn.com/b/jnak/archive/2009/11/24/asp-net-provider-scripts-for-sql-azure.aspx

http://www.marcmywords.org/post/NerdDinner-hosted-on-Windows-Azure-and-SQL-Azure.aspx

Details how to get the asp.net membership provider scripts working, using modified scripts.

http://support.microsoft.com/kb/2006191/en-gb

 

Issue with NerdDinner MVC2

Came across realm issue with regard to OpenID code, so reverted back to MVC1 code.

NerdDinner MVC1 Migrate to Azure – This Worked

Get it working normally in MVC (with 2 databases running SQLExpress in AppData folder)

Getting the Phone# does not match country error in nerddinner.

hacked the Helper/PhoneValidator.cs to always return true.

image

Deleted the unit test project for simplicity

Added a CloudService project into the solution

Right clicked on Role in CloudService, and added in the existing NerdDinner project

Added back in ConnectionStrings.config into the NerdDinner project

image

Coppied the database to SQL Azure using Management Studio 2008R2

Coppied Membership Provider to SQL Azure using special sql scripts

Added in ConnectionStrings.config into the project, and put in SQL Azure string.

Uploaded to Azure..

**problem goes between stopping and initializing… after 20mins?

Try recreating Service in Asia, and DB is in Asia too.

Try uploading again.. and putting one in staging too ( a simple MVC no database, includes test project, worked before).  9:50pm started.

image

App does work from local using SQL Azure as storage..

image

After sleeping on it, the problem was that copy local wasn’t set to true on the System.Web.Mvc reference.

image

Comments [0] | | #