Friday, February 27, 2009

Microsoft Surface - Physics Engine

Thursday, February 26, 2009

Avoid Multiple Form Submits

Multiple form submits is a serious issue in web applications because it’ll result in unexpected behavior like multiple entries in database .I have spent some time for the same in Google and I got some solutions for that.
If you are submitting the page only once then you can use,

<form onsubmit="return Submit();">
And the method is like,
<script type="text/javascript">
var flag = false;
function Submit() {
if (flag) {
return false;
}
else {
flag = true;
return true;
}
}
</script>
For a single button you can use,
btnSubmit.Attributes["onclick"] = "this.disabled=true;" + GetPostBackEventReference(btnSubmit);
For pages with update panels multiple submit is a serious issue as page is posting asynchronously or partially.In that scenario you can use Sys.WebForms.PageRequestManager for fixing the issue,
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequest);
function BeginRequest(sender, e) {
e.get_postBackElement().disabled = true;
}
</script>

Wednesday, February 18, 2009

Microsoft Surface Promo


Surface Promo from IdentityMine on Vimeo.

IdentityMine Wine Guide Solution - Tesco Wine Fair


IdentityMine Wine Guide Solution - Tesco Wine Fair from IdentityMine on Vimeo.

Microsoft PDC 2008 Surface App by IdentityMine

Monday, February 16, 2009

Fixing Problem with long Text in TextBox when width as percentage.

Usually when we set width as percentage for textboxes, we'll face an issue in IE. ie,while displaying long text, the length of the textbox will increase as according to the text length.So the whole design will collapse.Here is the solution,

Use css class for the table which contains the textbox,

        .table
{
table-layout: fixed;
}

Friday, February 13, 2009

Moonlight 1.0 Released

Moonlight 1.0 enables linux users to use silverlight applications.

Check links,

http://tirania.org/blog/archive/2009/Feb-11.html

http://weblogs.asp.net/scottgu/archive/2009/02/11/moonlight-1-0-release.aspx#6899578

:-)

Thursday, February 12, 2009

Sharepoint Webpart Development Part 1

Here we can discuss about Sharepoint web part development.

  • Open Visual Studio.Add new project.
  • Either you can use Web Part Template in Visual Studio by selecting WebPart project while adding new project or alternatively you can simply create a class library and inherit class from System.Web.UI.WebControls.WebParts.WebPart or Microsoft.SharePoint.WebPartPages.WebPart(Needs Microsoft.Sharepoint.Dll).

  • public class TestWebPart : Microsoft.SharePoint.WebPartPages.WebPart
    {
    public string FirstName{ get; set; }

    protected override void Render(System.Web.UI.HtmlTextWriter htmlTextWriter)
    {
    base.Render(htmlTextWriter);

    //Custom Render Code comes here.//
    }
    }
    So property FirstName will be showed in the property grid editor with a textbox.If you have a boolean property it'll be showing as checkbox in the property grid of the web part.For enumeration it'll be DropDownlist.So it have default Tool Part behavior.But we can create custom Tool Part in web part.

    That I'll show in the next post.

    Monday, February 2, 2009

    Export Word Document in ASP.NET

    Here we are exporting the data from a grid to word,


    Response.Clear();
    Response.Buffer = true;
    Response.AddHeader("Content-Disposition", "attachment;filename=Test.doc");
    Response.ContentType = "application/ms-word";
    StringWriter stringWriter = new StringWriter();
    HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
    gvwEmployeeGrid.RenderControl(htmlTextWriter);
    Response.Output.Write(stringWriter.ToString());
    Response.Flush();
    Response.End();


    Make EventValidation to false for the page and also override VerifyRenderingInServerForm in code behind,


    public override void VerifyRenderingInServerForm(Control control)
    {

    }

    Sunday, February 1, 2009

    How to Work With Microsoft Surface Simulator

    Microsoft Surface is a new emerging technology developed by Microsoft through which we can process objects through hand in a real user interaction.

    About Microsoft Surface,

    http://www.microsoft.com/surface/en/us/default.aspx

    http://en.wikipedia.org/wiki/Microsoft_Surface

    After installing the Surface SDK you can see a Simulator installed in your Vista machine.

    I think it’s really nice to test your application in that which acts much like a surface table.

    Add New Project by using Surface Application template in Visual Studio which is installed through Surface SDK. After developing your surface application start the simulator and then run the application so that you can see and test the application in the same. Ensure that Simulator is running when your application runs. Otherwise you won’t get the tools from simulator as it’ll launch in some other way. And also all part of the simulator panel should be visible above all other windows/taskbar Otherwise simulator will display a message like “simulation is disabled because the simulator is partly obscured”.

    Surface Simulator has tools like a Contact Selector, Finger, Resizable Blob, Tag & Identity Tag.

    If you want to produce a two finger object action like resizing an image you can simply do that by fixing a finger tool by clicking right mouse button along with pressing down left mouse button. And then do the second finger object action by using second finger tool. If you scroll the mouse wheel then you can see the tools rotating in clockwise or anticlockwise.

    I tried some samples in this simulator which gives a much near real experience.

    Left Outer Join in LINQ

    var result = from accountDetails in context.AccountDetails
    join payment in context.PaymentDetails
    on accountDetails.AccountID equals payment.AccountID into temp
    from resultDetails in temp.DefaultIfEmpty()
    select new { temp.PayeeName,temp.AccountType };