Monday 9 July 2012

FileUpload

FileUpload control is used to send a file to server from a client computer.

Some Commonly Used Properties of File Upload
FileBytes Property:
This property used to gets the array of bytes inwhich contents of the specified file is saved.
FileContent Property:
This is used to gets the stream object that points to a specified file uploaded by a fileupload control.
FileName Property:
This is used to gets the name of the file that is uploaded by the fileupload control.
HasFile Property:
This is used to check whether the fileupload control has a file or not.

Literal

Asp.net Literal control is used to display a static text on web page without adding any HTML element.You can display text programmatically with server side code.You can display your text static but literal control is used only when you need to you the contents in server side otherwise you can use simple html tags.Literal control is similar to Label control but the difference is that you cannot apply any style on literal control.

Sunday 8 July 2012

Panel

The asp.net panel control provides a container on small area within the web page inwhich we can use other controls.By adding controls into the panel we can handel them as a single unit for example hidding or showing them within web page.Simply asp.net panel control is used to create a distinct appearence for a group of controls within the panel control.

ImageButton

Image button is used to display a clickable image.We can set image on imagebutton by specifying the image path to ImageUrl property.

Some Commonly Used Properties For ImageButton

ImageUrl Property:
Gets the url of the image that is to be displayed on imagebutton.
AlternateText Property:
Gets or stes the alternate text that will be displayed when image cannot be shown or found.
ImageAlign Property:
ImageAlign property is to set the alignment of the image.
DescriptionUrl Property:
This property defines the url that contains the more detailed description of the image.
OnClientClick Property:
This property defines the client side script that will be executed on client side onclick.
Click Event:
This event fires when the image is clicked.

Saturday 7 July 2012

BulletedList

ASP.NET BulletedList control is used to create a list of items with bulleted format.You can set bulleted format as circle or rectangle and you can add items in bulleted list by using <asp:ListItem>.You can specify your bullet style by using BulleteStyle property.You can display your list of items in an organized or unorganized form.
How to Add Items Manually in BulletedLIst?
To add items manually in bulleted list, first double click on bulletedList control in toolbox.
After bulletedList is added into web page then click on the small tag on bulleted lis.then select Edit Items a new List Item Collection Editor box will appear.Now enter your item text that will appear in page and item's value.


How to Add Listitems programmatically?
You can add items programmatically by specifying the following at the server side.
At Client SIde:

    <asp:BulletedList ID="BulletedList1" runat="server">
        <asp:ListItem>Pakistan</asp:ListItem>
        <asp:ListItem>UK</asp:ListItem>
        <asp:ListItem>USA</asp:ListItem>
        <asp:ListItem>France</asp:ListItem>
    </asp:BulletedList>
At Server Side:
    protected void Page_Load(object sender, EventArgs e)
    {
        BulletedList1.Items.Add(new ListItem("Canada","Canada"));
        BulletedList1.Items.Add(new ListItem("Australia", "Australia"));
        BulletedList1.Items.Add(new ListItem("Russia", "Russian"));
        BulletedList1.Items.Add(new ListItem("Itly", "Itly"));
    }

How to display items from database?
To display list items from database simply provide the data source to the bulletedList control.To specify the data source to bulleted list first add you bulletedlist control into the web form and select it, a small tag will appear click on the small tag and select Choose Data Source option.
A new Data Source configuration wizard box.With the help of this box you can simply provide your data source.


How to specify bullets as Custom Image in BulletedList control?
You can specify the bullets as custom image in bulletedList by using the BulletIamageUrl property.
    <asp:BulletedList ID="BulletedList1" runat="server" 
        BulletImageUrl="~/bullet.png" BulletStyle="CustomImage" Width="71px">
        <asp:ListItem>Pakistan</asp:ListItem>
        <asp:ListItem>UK</asp:ListItem>
        <asp:ListItem>USA</asp:ListItem>
        <asp:ListItem>France</asp:ListItem>
    </asp:BulletedList>
How to display hyperlinks in BulledtedList control?
To display hyperlinks in bulleted list simply set DisplayMode is Hyperlink.
    <asp:BulletedList ID="BulletedList1" runat="server" 
        Width="71px" DisplayMode="LinkButton">
        <asp:ListItem Value="http://www.youtube.com/watch?v=gGiglVYd1b4">Pakistan</asp:ListItem>
        <asp:ListItem Value="http://www.youtube.com/watch?v=gGiglVYd1b4">UK</asp:ListItem>
        <asp:ListItem Value="http://www.youtube.com/watch?v=gGiglVYd1b4">USA</asp:ListItem>
        <asp:ListItem Value="http://www.youtube.com/watch?v=gGiglVYd1b4">France</asp:ListItem>
    </asp:BulletedList>
How to display LinkButton in BulledtedList control?
To display linkbutton in bullet list simpply set the Display property is linkButton.
   <asp:BulletedList ID="BulletedList1" runat="server" 
        Width="71px" DisplayMode="LinkButton">
        <asp:ListItem>Pakistan</asp:ListItem>
        <asp:ListItem>UK</asp:ListItem>
        <asp:ListItem>USA</asp:ListItem>
        <asp:ListItem>France</asp:ListItem>
    </asp:BulletedList>
 

Sunday 1 July 2012

ASP.NET Hidden Field

Hidden Field is used to keep information on a web page that is not to displayed on the client side user.Hidden field is normally used to keep state information of web page just like view state,session state and cookies are used to maintain state information but there are some places where these controls are not available then there we use a hidden field control.Note that we can access the value of hidden field control at client side that way we does not keep ant sensitive information in the hidden field.


<asp:HiddenField ID="HiddenField1" runat="server" />


Some Commonly Used Properties For Hidden Field
Value Property:
You can get or set value to hidden field.


ValueChanged Event:
This event fires when the value of the control changed.

ASP.NET Calender

Calendar control in asp.net is used to take a date as a input e.g. dob,hire date,birthday etc.
This control displays a full month at a time and you can select a single day or date from it.Similarly you can get single day,month,year,minutes,seconds and milliseconds etc.

Some Commonly Used Properties of Calendar
Caption Property:
This property set gets or sets the caption of the calendar control.
CaptionAlign Property:
This property gets or sets the alignment for caption of the calendar.
DaHeaderStyle Property:
This is used to gets the style properties for portion on the calendar that displays the day of the week.
DayNameFormat Property:
This is used to gets or sets the format of the day of the week.
DayStyle Property:
This is used to gets the style properties for the in displayed month.
FirstDayOfWeek Property:
This property define which day of week will be displayed in the first column of the calendar.
NextMonthText Property:
This is used to gets or sets the text of the next month navigation control.Usually it is >>.
NextPrevFormat Property:
This is used to gets or sets the format of the next ans previous month of the navigation control.
PrevMonthText Property:
This is used to gats or sets the text of the previous month navigation control.
SelectedDate Property:
This is used to gets or sets the selected date of the calendar.
SelectedDates Property:
This is used to gets or sets the list of selected dates.
SelectedDayStyle Property:
This is used to gets or sets the selected style properties of the date.
TodaysDate Property:
This is used to gets or sets the value for the today's date.

Some  Commonly Used Event For Calendar Control
SelectionChanged Event:
This event is raised when a single day,week or month is selected.
DayRender Event:
This event is raised when a single cell of the calendar is rendered.