object is binded with the winform controls. there datasource is not updating on the controls value
is updated as part of the Windows Forms Control validation process when a control is exited
so select your update mode according to your requirment.
Thoughts on C#, .NET, programming, software development and productivity. Tips and tricks to solve various programming problems.
URL: http://dotnetblogengine.net
Source Code: Grab the source code here
Project Description
BlogEngine.NET may be the simplest and most light weight ASP.NET blog at the moment,
but still full featured. Here are some of the features:
- Multi-author support
- Pingbacks and trackbacks
- Event based for plug-in writers
- Theming directly in master pages and user controls
- Gravatar and coComments implemented
- Live preview on commenting
- Comment moderation
- BlogML import/export
- Extension model
- Code syntax highlighting
- Mono support
- Full editing and creation of pages that are not posts
- Extended search capabilities
- Tag cloud
- Self updating blogroll
- Runs entirely on XML or SQL Server. Your choice.
YAF is a Open Source discussion forum or bulletin board system for web sites running
ASP.NET. The latest production version runs on ASP.NET v2.0 with a Microsoft SQL
Server backend.
URL: http://www.yetanotherforum.net/
Source Code: Grab the source code here
DotNetNuke is an open source web application framework ideal for creating, deploying and
managing interactive web, intranet, and extranet sites securely.
URL: http://www.dotnetnuke.com
Source Code: Grab the source code here
URL: http://www.mojoportal.com/
Source Code: Grab the source code here
Running on C# nopCommerce is a fully customizable shopping cart. It's stable and highly
usable. nopCommerce is a open source e-commerce solution that is ASP.NET 3.5 based
with a MS SQL 2005 backend database.
URL: http://www.nopcommerce.com/
Source Code: Grab the source code here
Enumerations are simple value types that allow developers to choose from a list of constants.
Behind the scenes, an enumeration is just an ordinary integral number where every value has
a special meaning as a constant. However, because you refer to enumeration values using their
names, you don’t need to worry about forgetting a hard-coded number, or using an invalid
value.
To define an enumeration, you use the block structure shown here:
public enum FavoriteColors
{
Red,
Blue,
Yellow,
White
}
This example creates an enumeration named FavoriteColors with three possible values:
Red, Blue, and Yellow.
Once you’ve defined an enumeration, you can assign and manipulate enumeration values
like any other variable. When you assign a value to an enumeration, you use one of the predefined
named constants. Here’s how it works:
// You create an enumeration like an ordinary variable.
FavoriteColors buttonColor;
// You assign and inspect enumerations using a property-like syntax.
buttonColor = FavoriteColors.Red;
In some cases, you need to combine more than one value from an enumeration at once.
To allow this, you need to decorate your enumeration with the Flags attribute, as shown here:
[Flags]
public enum AccessRights
{
Read = 0x01,
Write = 0x02,
Shared = 0x04,
}
This allows code like this, which combines values using a bitwise or operator:
AccessRights rights = AccessRights.Read | AccessRights.Write | AccessRights.Shared;
You can test to see if a single value is present using bitwise arithmetic with the & operator
to filter out what you’re interested in:
if ((rights & AccessRights.Write) == AccessRights.Write)
{
// Write is one of the values.
}
Enumerations are particularly important in user-interface programming, which often has
specific constants and other information you need to use but shouldn’t hard-code. For example,
when you set the color, alignment, or border style of a button, you use a value from the appropriate
enumeration.
It’s important to remember that although all classes are created in more or less the same way
in your code, they can serve different logical roles. Here are the three most common examples:
• Classes can model real-world entities. For example, many introductory books teach
object-oriented programming using a Customer object or an Invoice object. These
objects allow you to manipulate data, and they directly correspond to an actual thing in
the real world.
• Classes can serve as useful programming abstractions. For example, you might use a
Rectangle class to store width and height information, a FileBuffer class to represent a
segment of binary information from a file, or a WinMessage class to hold information
about a Windows message. These classes don’t need to correspond to tangible objects;
they are just a useful way to shuffle around related bits of information and functionality
in your code. Arguably, this is the most common type of class.
• Classes can collect related functions. Some classes are just a collection of static methods
that you can use without needing to create an object instance. These helper classes are the
equivalent of a library of related functions, and might have names like GraphicsManipulator
or FileManagement. In some cases, a helper class is just a sloppy way to organize code
and represents a problem that should really be broken down into related objects. In
other cases, it’s a useful way to create a repository of simple routines that can be used in
a variety of ways.
Understanding the different roles of classes is crucial to being able to master object-oriented
development. When you create a class, you should decide how it fits into your grand development
plan, and make sure that you aren’t giving it more than one type of role. The more vague a
class is, the more it resembles a traditional block of code from a non-object-oriented program.
public bool FtpDirectoryExists(string directoryPath, string ftpUser, string ftpPassword)
{
bool IsExists = true;
try
{
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(directoryPath);
request.Credentials = new NetworkCredential(ftpUser, ftpPassword);
request.Method = WebRequestMethods.Ftp.PrintWorkingDirectory;
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
}
catch (WebException ex)
{
IsExists = false;
}
return IsExists;
}
I have called this method as:
bool result = FtpActions.Default.FtpDirectoryExists( "ftp://domain.com/test",
txtUsername.Text, txtPassword.Text);
/// <summary>/// File Type Enum - The extensions that our application/// support to work.. check at the time of work with the
/// file.. e.g. read the file and save to database etc.
/// </summary>
enum FileTypes
{
BMP ,
JPG ,
JPEG,
GIF,
TIFF
}
string fileExtension = Path.GetExtension(filePath).ToUpper();
if (Enum.IsDefined(typeof(FileTypes),fileExtension.Trim('.')))
{
//convert string to enum
FileTypes c = (FileTypes) Enum.Parse(typeof(FileTypes), "MOV", true);
}
When CSS was introduced to web technologies in order to separate design from content,
a way was needed to refer to groups of page elements from external style sheets.
The method developed was through the use of selectors, which concisely represent
elements based upon their type, attributes, or position within the HTML document.
Those familiar with XML might be reminded of XPath as a means to select elements
within an XML document. CSS selectors represent an equally powerful concept,
but are tuned for use within HTML pages, are a bit more concise, and are generally
considered easier to understand.
For example, the selector
p a
refers to the group of all links (<a> elements) that are nested inside a <p> element.
jQuery makes use of the same selectors, supporting not only the common selectors
currently used in CSS, but also some that may not yet be fully implemented by all
browsers, including some of the more powerful selectors defined in CSS3.
To collect a group of elements, we pass the selector to the jQuery function using
the simple syntax
$(selector)
or
jQuery(selector)
Although you may find the $() notation strange at first, most jQuery users quickly
become fond of its brevity. For example, to wrap the group of links nested inside any
<p> element, we can use the following:
$("p a")
The $() function (an alias for the jQuery() function) returns a special JavaScript
object containing an array of the DOM elements, in the order in which they are defined
within the document, that match the selector. This object possesses a large number of
useful predefined methods that can act on the collected group of elements.
In programming parlance, this type of construct is termed a wrapper because it
wraps the collected elements with extended functionality. We’ll use the term jQuery
wrapper or wrapped set to refer to this set of matched elements that can be operated on
with the methods defined by jQuery.