Archive for the ‘C#’ Category

Control inside repeater row ASP.NET

Control inside repeater row ASP.NET Hello All Few days back I was struggling with a repeater problem , where I have to get a value of dropdown list on a button click event which is inside repeater. Eventually I come up with a solution through googling. What I have faced was get the value of appropriate dropdown list while clicking the button of a particular repeater’s row. It’s being hard to describe rather that visualize isn’t it ! ( proposed solution should be as image bellow) My aspx markup...

Dependency Injection with Ninject in .NET

Hello All From last few months I was not working on .NET platform so haven’t get enough time to write something fruitful on .NET technology. But from last few few days I was thinking to do something with IoC . There are many DI tools to perform DI in .NET but I found Ninject useful as well as light waited and easily implementable. So lets start to make our hand dirty with the Ninject (there are many advanced level use of Ninject library but in this article I will simply...

LinkButton ,Label inside Repeater – ASP.NET

Hello All Today I will show you how to fire  Link Button’s event with argument and initialize a label inside of a repeater. To do that first we have to take LinkButton and a Label control inside the ItemTemplate of the repeater. Then we have to initialize the the Label from OnItemDataBound event of the repeater. In the following code blocks its shown how to perform the job. Following is my Default.aspx file: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"...

Print C# properties in aspx,ascx page from code behind file.

Hello all Today I will show you how to print something in aspx or ascx page from code behind file.In this example I have taken a “Web User Control” named “WebUserControl.ascx”. What I wanted to do was, print a value of a variable in “.ascx” page where the variable has been initialize from “.ascx.cs” better to say code behind file. To do that we have taken a property in “WebUserControl.ascx.cs” code behind file named “PrintValue” and make it a...

File streaming in .NET

Hello All Today i will focus on simple file steaming in .NET which I have to implement it in one of my project.Though it’s not optimize but its OK for serve small purpose. In the project I have to read a PDF file from the server and with FileStream and Flash it with Response to the client side. the code is as bellow. private void generateRequestedPDF(){ try { string file = Path.GetFileName(Request.QueryString["RefID"]);// get file name from query...

Consume WCF Service

Hello all Today I will show how to consume a WCF service. To go through this before, I have created a WCF service [ Creating WCF Service ] , which I will consume for my project in this article. Consuming WCF Service is as simple as consuming a simple webservice through Visual Studio 2008. First I am taking an empty Web project named ConsumedWCF. Now I will add a service reference which I have created before [ Creating WCF Service ] in this ConsumedWCF project as...

Creating WCF Service

Hello all Today I will try to demonstrate how to create simple web service through WCF. To get into WCF first we have to know some basic principal of WCF and its "ABC". Address : the location of the service. Bind: how to get service. Contract: service action. In this tutorial I will not describe details about WCF.My basic focus will be on creating a WCF service through Visual Studio 2008 First open a new WCF project: In my sample project I have named "TestWCFService"...

Custom Event in .NET

Hello All, Today I will try to deliberate my experience on custom event creation in .NET , Actually I was trying to find something like hands on for event creation in .NET application, suddenly I got a quick help from one of my brother Sadique, who helped me out to resolve the thirst. We are going to create a custom control where we will define our event class and event handler.To do that first take a  user control named InputControl.ascx  . The ascx page is...

Namespace in ASP.NET

Commonly Used Types and Namespaces in ASP.NET System.Web HttpApplication HttpCookie HttpRequest HttpResponse HttpRuntime HttpServerUtility System.Web.ApplicationServices *NEW AuthenticationService NEW ProfileService NEW RoleService NEW System.Web.Caching Cache System.Web.ClientServices *NEW ClientFormsIdentity NEW ClientRolePrincipal NEW ConnectivityStatus NEW System.Web.ClientServices.Providers *NEW ClientFormsAuthenticationMembershipProvider...

Isolated Unit Test of Business Logic With NMock in TDD

Hello All In test driven development its always needed to test a particular project tested with make it isolate ( test with removing dependency from other projects ), In this scenario we virtually create the input set which will be produced from other projects(class,methods etc) and test whether our testable methods are functioning with that input set or not. To do that we have to make mock of the dependent objects. In the example bellow I have shown how to test a business...
Page 1 of 1712345NextLast »