Community Blogs

Browse by Tags

Related Posts

  • Using Provider Model with Unit Testing

    We are going to look at the Provider model and Offloader/Worker model and how we use this approach for our Test Driven Development (TDD) and Unit Testing. For this Demo we will be using the Northwind Database, and developing this in VB. To start off we need to set up 3 projects in the same solution: TCNorthwindClass: This is were we will place our class files for the BLL, DAL, and Interface. TCNorthwindWeb: For this demo we will be creating a webservice. TCNorthwindTest: For our Unit Tests. Now lets look at what the provider model is and how we use it with in our application. Provider Model We are going to define the provider model as a model in which the provider (access to the DAL) is passed in as an argument to the worker methods. When developing...


  • Reading file content from different webserver using HttpWebRequest

    I was replying to one of the post on the ASP.Net forum in which the requirement was like reading txt file contents from different webservers. When he got satisfied with the solution then I thought to put the piece of code in my blog as well for others and my future reference. --- .vb file if VB.Net is the language --- If Not (IsPostBack) Then Try Dim fr As System.Net.HttpWebRequest = DirectCast(System.Net.HttpWebRequest.Create(New Uri(" http://weblogs.asp.net/farazshahkhan ")), System.Net.HttpWebRequest) 'In above code http://weblogs.asp.net/farazshahkhan is used as an example it can be different domain with different filename and extension If (fr.GetResponse().ContentLength > 0) Then Dim str As New System.IO.StreamReader(fr...


  • Passing value from popup window to parent form's TextBox

    Once again seen lot of questions on the forum related to passing values from popup window to the parent form textbox. Specially when they have some GridView type control in the popup. In the following example I will be using two forms, parent form will be parent.aspx and popup will be popup.aspx. Also note that my parent.aspx form is derived from some MasterPage. Code is provided both in VB.Net and C#.Net. --- .aspx of parent form --- <script type="text/javascript"> function OpenPopup() { window.open("popup.aspx","List","scrollbars=no,resizable=no,width=400,height=280"); return false; } </script> . . . <asp:TextBox ID="txtPopupValue" runat="server" Width="327px"><...


  • Javascript to display time on Web page

    Javascript to display continuous time on the Web page. By continuous it means that it will be displayed second by second. <script type="text/javascript"> function ShowTime() { var dt = new Date(); document.getElementById("<%= TextBox1.ClientID %>").value = dt.toLocaleTimeString(); window.setTimeout("ShowTime()", 1000); } </script> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> If you are using normal Webform then it can be called on Body load event. If you are using MasterPage then it can be called within ContentTemplate at the end afte all the controls will be rendered. Read More...


  • Check/Uncheck checkboxes in GridView using javascript

    Seen a lot of questions regarding how to check/uncheck CheckBoxes within a GridView control using JavaScript. So I thought to put it on my blog for quick reference for others and for myself. Following is the code: ------------------------------------------- .aspx code --------------------------------------------- <script type="text/javascript"> function SelectAll(id) { var frm = document.forms[0]; for (i=0;i<frm.elements.length;i++) { if (frm.elements[i].type == "checkbox") { frm.elements[i].checked = document.getElementById(id).checked; } } } </script> <!-- assuming that SqlDataSource1 is the datasource for my GridView --> <asp:GridView ID="GridView1" runat="server" DataSourceID...


  • How-To: Use ClickOnce to deploy your Applications

    Part 1 - What is ClickOnce? CickeOnce, is a technology for deploying smart-client applications. When we talk about smart-client application that deployed with ClickOnce, we want that the application will: Provide automatic installation in one click. Install updated automatically Can be installed from local file, or from the WEB. ClickeOnce, give us this options out of the box, and all we need to do is to write two XML manifest files (one for the application, and one for the ClickOnce engine). If you use Visual Studio, you have a wizzard for this. In this post, I'll show how to work with ClickOnce from Visual Studio, and from your code too. Part 2 - How to use ClickOnce in your application? First of all, ClickOnce supports deployment of Windows...


  • Use C# 3 features from C# 2 and .NET 2.0 code

    Visual Studio 2008 and .NET 3.5 are already here, but some of us, sometimes, still need to use .NET 2.0. Visual Studio 2008, support in a new feature called “Multi Targeting”. You can use Visual Studio 2008 ad IDE for .NET 2.0 and .NET 3.0 too. Simply, in the “New Project” form, choose the version you want. The common between all this versions you can use VS2008 to develop for it, is that this entire versions are actually based on the same version of CLR – CLR 2.0. .NET 3.5 based in the same version of CLR that .NET 2.0 uses. Of course, there are a lot of new features, new C# and VB.NET versions, but under the covers the same CLR works. Why is it so important? Because theoretically, you can use some of the mew features...


  • Setting The Record Straight - My Thoughts On The MVP Variants (for web applications)

    Having received a bunch of emails in the past couple of weeks from people who have been asking me questions with regards to Passive View/Supervising controller patterns for web applications. I needed to let people know that for the last couple of months I have been developing web apps in a completely MVC style which eliminates the need for patterns like Passive View/ Supervising Controller. For the people who are using the MVP pattern in their (web) applications I personally would now lean to the Supervising Controller style as it eliminates a lot of necessary chattiness between the view and the presenter. It also lends itself to much more simple unit tests. Having gotten back into the Smart Client realm, I am once again reminded of the importance...


  • code.google.com/p/jpboodhoo!!!

    I finally set up a googlecode project to host source code for the various things I have been doing over the last year. The first major significant contribution is of course the code drop that I promised a week ago now!! The application is the start of what I hope will evolve to be a great learning resource for lots of things related to .Net development. The application does not currently cover any of the “extra” topics that I did not have time to get covered in the course. This is perfect because as request come in from people (including past students) asking how to tackle a certain problem, I will use this application as the demonstration area where I can tackle the problem, and update the code base, and you will be able to update...


  • ReSharper Templates

    Since I have been asked for these quite a few times, I thought I would oblige and give these out. You can find below the links for both my Resharper Live Templates and File templates. Enjoy: Live Templates File Templates Read More...


Page 1 of 6 (53 items) 1 2 3 4 5 Next > ... Last ยป
Page view counter