Thursday, November 22, 2007

Microsoft have release Visual Studio 2008 early (wow, is this a first).

Also available are the team editions and Team Foundation server of the professional, Team and Express edition is now available.

A 90 day free trial for non-MSDN subscribers is available at VS2008 trial 

For more information review Scott Guthrie's blog article - Visual Studio 2008 and .NET 3.5 Released - ScottGu's Blog

Enjoy and experience the new features of Windows Presentation Foundation, Windows Communication Foundation, Windows Workflow, CardSpace, , Silverlight, Ajax Extensions and many many more new features.

Again, for details of what is included within VS2008 see ScottGu's Blog.

Thursday, November 22, 2007 10:31:28 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Friday, November 09, 2007

Well, I dragged it out, and my lawnmower was just about cutting the grass but taking me forever, so what did I do.

Was really lucky and found a local company to fix it Power Equipment Repairs for lawn mowers in Yorkshire, what a job they done.  I cut my neighbors grass just for fun when it was returned and was so impressed, I even cut my own once more before the session ended.  Lets just hope my grass does not grow too much over the winter, but with these new blades I'm know it wont be an issue.

Friday, November 09, 2007 8:28:07 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Thursday, October 04, 2007

I wanted to test Windows Live Writer Beta 12 in association with my DasBlog site.

So this is just a test post to ensure that items are been raised correctly.

Thursday, October 04, 2007 12:01:44 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Saturday, July 07, 2007

Comment and links for recommendation to next meeting,

Feel free to share and discuss!

CrazyMan Miles

Friday, July 06, 2007 11:42:23 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  | 
Wednesday, July 04, 2007

I've wanted to link the following type of issues back to an article I've previously blogged about:

  • A web page back to an article I've previously written.
  • One article to another article using DasBlog.

but was unsure how to go about this, well it took me a while to figure out (but I'm stupid) so here goes my answer:

When you click on you blog, you can click on a date, and it will give you a link such as www.jtbarton.com/Blog/default,date,2007-07-04.aspx but this is not what you want to use, just imagine you posted 20 blog that day and you want to link to a single blog article, how do you find the specific item.

Well if you have an "On this page" category after clicking the required date, then click on the link from there and it will give you an absolute link such as http://www.jtbarton.com/Blog/default,month,2007-07.aspx#a126de405-8e0f-43c4-a8c6-17d9218f03d6 then just cut and paste this link from the address bar into the article you wish to write.

So to see my article on JavaScript update With Master And Content Page just click the previous link.

Wednesday, July 04, 2007 10:28:24 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Sunday, July 01, 2007

How do you update an asp.net controls via Java Script when working with Master and Content pages, to labels, textboxes and/or pure html controls?

I looked long and hard to find the answer to the abouve question.  The answer is out there if you can find it, but it took me in excess of 3 hours to get to the answer of the above question.  I also wanted to be able to determine the time of the client computer rather than the servers time.

So here goes with what I have learnt, by example: (if your like me and want to see an example first then click this text)

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"

CodeFile="JavaScriptUpdateWithMasterAndContentPage.aspx.cs" Inherits="JavaScriptUpdateWithMasterAndContentPage"

Title="JavaScript Update With Master And Content Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<script language="javascript" type="text/javascript">

// Get users current time

function getTime()

{

// Get client computers date and time

var today=new Date();

var h = today.getHours();

var m = checkTime( today.getMinutes() );

var s = checkTime( today.getSeconds() );

// Update content of HTML div, ASP:TextBox and asp:Label

document.getElementById("div1").innerText = h+":"+m+":"+s;

document.getElementById("<%=TextBox1.ClientID %>").value = h+":"+m+":"+s;

document.getElementById("<%=Label1.ClientID %>").innerText = h+":"+m+":"+s;

document.getElementById("<%=HiddenField1.ClientID %>").innerText = h+":"+m+":"+s;

return false;

}

// Ensure that minutes and seconds are 2 digits in length

function checkTime(i) { if (i<10) {i="0" + i} return i; }

</script>

<div id="div1">HTML div text here (text prior to a button press)</div>

<asp:TextBox ID="TextBox1" runat="server" Width="326px">asp:TextBox text here (text prior to a button press)</asp:TextBox><br />

<asp:Label ID="Label1" runat="server" Text="asp:Label text here (text prior to a button press)" Width="326px"></asp:Label><br />

<asp:HiddenField ID="HiddenField1" runat="server" />

<br />

<asp:Button ID="Button1" runat="server" Text="ASP Button" OnClientClick="getTime()" />

&nbsp; &nbsp;&nbsp;

<input id="Button2" type="button" value="HTML button" onclick="getTime()" />

</asp:Content>

 

The clever bits are in bold and "Red" or "BurlyWood".

 

The ("<%=TextBox1.ClientID %> works out the internal name of the control as its used by the page when view at source.

Getting the JavaScript to update the hidden field allows us to update the label on post back, see code behind below.

I deliberately have not made the HTML control div1 part of the "asp runat server" to demonstate the difference in the control style,

but it could be and there for the getElementById("div1") would need to be changed to getElementById("<%=div2.ClientID %>").

 

The other clever bit is to use a hidden field to allow the post back to pick up this value and re-apply to the required text,

this currently is just the Label1, but could also be the div1 when runat="server" is applied.

 

Heres the code behind for the update when the asp:Button1 is clicked, is just accepting that a post back that has been raised and using the hidden

field to apply the text back to the label (Label1).

 

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
 
public partial class JavaScriptUpdateWithMasterAndContentPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack)
        {
            Label1.Text = HiddenField1.Value;
         }
    }
}

 

And just for completeness (because I personally hate examples that cannot be run,

I've included a simple master page that relates to the above code):

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>ajax.jtbarton.com AJAX, JavaScript and Master / Content Pages</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<strong>Welcome to John T Barton's AJAX test page</strong><br />

<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>

</div>

</form>

</body>

</html>

 

There is no code behind for this master page file, I was keeping the sample simple.

 

Thats really how simple it is when you finally work out the solution.

 

I must reference the following link which some of the above code is based on:

      http://www.coveryourasp.net/Technical/ClientsideIDs

 

I'm thinking of writing a follow up article to show how these controls can be updated via an AJAX UpdatePanel and Timer, but unless I

get some feedback about this article I will not bother, the decision is yours.

 

Saturday, June 30, 2007 11:52:38 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Saturday, June 30, 2007

Well, I've been scared about starting to use these features and now I've bitten the bullet and started to use it.  What a fantastic set of features it has.

Anyone developing / has developed or intends to develop should visit the ajax.asp.com website.

If you were like me and unsure about installing or retro fitting AJAX into existing site, just watch the videos.

Saturday, June 30, 2007 7:21:31 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |