Skip to main content

Posts

Showing posts from June, 2013

Featured Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

How to use ImageButton Control in ASP.NET

Introduction The ImageButton control is a Button control that displays an image instead of text . The ImageButton control exists within the System.Web.UI.WebControls namespace . This control is specifically useful when you want to create image maps . Image maps are clickable regions on images and can initiate various actions depending on part of the image that you click. Public Properties of the ImageButton Class: CauseValidation : Obtains or set a value showing whether or not validation is performed when the ImageButton control is clicked. CommandArgument : Obtains or sets a argument that provides information about the CommandName property CommandName : Obtains or sets the command name related to the ImageButton control Enabled : Obtains or sets a value indicating whether the ImageButton control can be clicked to perform a PostBack operation to the server. GenerateEmptyAlternateText : Obtains or sets a value showing whether the control generates an alternate-text att

Find a control in windows forms

When we drag-n-drop controls in our designer file then we can easily access those controls in our code file directly by its name. But when we dynamically add some controls either in constructor or in load event of form then we can't access them directly in our code. Let's have an example Add a textbox and a button using drag-n-drop operation on our form i.e. Form1 . Leave the name of controls i.e. textBox1 and button1 as they are. Now in constructor add a new textbox dynamically having name "txtBox" with some properties like: TextBox txtBox = new TextBox(); txtBox.Name = "txtBox"; txtBox.Text = "dynamically added control"; txtBox.Width = 250; txtBox.Location = new Point(10, 10); this.Controls.Add(txtBox); In above code the Name property will be used to find this control. All the remaining properties are familiar to you as in our designer file. At the last we have added this textbox to the form, here the keyword this is pointi

Online Voting System Project in ASP.NET

Introduction: Online voting system is a web based solution.It removes traditional voting system problems such as : Take more time and human resources Does not give instant poll result False voter  Inefficient Those problem are major problem in traditional system . If you want to remove such types of problem in traditional system then you will use web-based solution. Features of Online voting system: Detect false voter Instant poll result Easy method for vote count keep global information System Requirements :  Visual studio 2010  SqlServer 2008 Internet connection Mail_id  How to run this project : Open website folder in Visual studio 2010 Run your project by selecting green triangle button Open voter register page  Fill some required filled and click on submit button Login in Admin panel by username and password Approve Voter by changing flag bit (0 to 1) After approval login in your mail id and copy your secure code Login in voter

How to use ValidationSummary Control in ASP.NET

Introduction The ValidationSummary control collects all the validation control error message (known as summary) and displays it collectively on the screen . The display of the summary , which can be a list , a bulleted list , or a single paragraph , can be set by using the DisplayMode property . You can also specify whether the summary should be displayed in the web page or in a message box by setting the ShowSummary and ShowMessageBox properties respectively . The validationSummary control exists within the System.Web.UI.WebControls namespace. Public Properties of  ValidationSummary Class DisplayMode : Obtains or set the display mode of the ValidationSummary Control. EnableClientScript : Obtains or set a value indicating whether the ValidationSummary  control updates itself using the client-side script. ForeColor : Obtains or sets the foreground color of the control. HeaderText : Obtains or sets the header text displayed at the top of the summary. ShowMessageBox :

How to use RegularExpressionValidator Control in ASP.NET

Introduction Regular expression are used to check whether or not the text matches a certain pattern . The RegularExpressionValidator control validates whether the value in the input control (text box) matches the format specified by the regular expression , such as a US telephone number or a date format . The RegularExpressionValidator control exists within the System.Web.UI.WebControls namespace. In general , regular expression are made up of text within an embedded code listing that starts with a backslash (\) as well as other control code listing . The following is an example: \b[A-Za-z]+\b The code for a word boundary (where a word ends or starts ) is \b and a character class is a set of characters surrounded by [ and ] . This allows you to specify what character you want to accept . So , this regular expression matches a word consisting of uppercase or lowercase letters only. The + sign stands for one or more of , so we matching one or more uppercase and / or lowercase letter

How to use RequiredFieldValidator Control in ASP.NET

Introduction The Required FieldValidator control is the simplest control , and is used to ensure that the user has entered the data into the input control, such as TextBox to which it is bound. For example , if you are entering data, for buying a T-shirt , in an input control , it is necessary to enter the size of the T-Shirt that you want to buy. If you do not enter a value , the validation control displays an error message . Public property of the RequiredFieldValidator Class initialValue : Handles the initial value of the associated input control. Example <% @ Page Language = "C#" AutoEventWireup = "true" CodeFile = "requiredfield.aspx.cs" Inherits = "requiredfield" %> <! DOCTYPE html > < html xmlns = "http://www.w3.org/1999/xhtml" > < head runat = "server" > < title ></ title > </ head > < body > < form id = "for