connectseekers.com

Wednesday, 1 October 2014

Stylish RadioButton, DropdownList, ListBox and TextBox Control In Asp.Net Using Css

10/01/2014 - By Pranav Singh 0

This article will show you how you can create a stylish and change the style sheet of  radiobutton, textbox, dropdownlist and listbox controls in asp.net using css style sheet.


So for this article first we will create a new asp.net application and add the radiobutton, textbox, dropdownlist and listbox control in your page after adding controls your page will look as shown below.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Stylish RadioButton, DropdownList, ListBox and TextBox Control In Asp.Net Using Css</title>
    <link href="Styles/Site.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="100%" class="content">
            <tr>
                <td>
                    Radio Button<br />
                    <input type="radio" name="1" value="male" class="rediobutton" runat="server">Item
                    1
                    <input type="radio" name="1" value="male" class="rediobutton" runat="server">Item
                    2
                </td>
            </tr>
            <tr>
                <td>
                    Dropdown List<br />
                    <asp:DropDownList ID="DropDownList1" runat="server" CssClass="selectbox">
                        <asp:ListItem>Item 1</asp:ListItem>
                        <asp:ListItem>Item 2</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    ListBox
                    <br />
                    <asp:ListBox ID="ListBox1" runat="server" CssClass="selectbox">
                        <asp:ListItem>Item 2</asp:ListItem>
                        <asp:ListItem>Item 1</asp:ListItem>
                        <asp:ListItem>Item 3</asp:ListItem>
                    </asp:ListBox>
                </td>
            </tr>
            <tr>
                <td>
                    TextBox<br />
                    <asp:TextBox ID="TextBox1" runat="server" CssClass="textbox"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

Now we will add a style sheet in our page. Add the below css style in style sheet page.

.selectbox
{
    width: 98%;
    height: 27px;
    background-color: #FFF;
    font: 400 12px/18px 'Open Sans' , sans-serif;
    color: #000;
    font-weight: normal;
    border: 1px solid #ccc;
    margin: 5px 0 0 0;
    padding: 5px;
}
.textbox
{
    width: 30%;
    height: 15px;
    background-color: #FFF;
    font: 400 12px/18px 'Open Sans' , sans-serif;
    color: #000;
    font-weight: normal;
    border: 1px solid #ccc;
    margin: 5px 0 0 0;
    padding: 5px;
}
.rediobutton
{
    width: 30px;
    height: 18px;
    background-color: #FFF;
    font: 400 12px/18px 'Open Sans' , sans-serif;
    color: #000;
    font-weight: normal;
    border: 1px solid #ccc;
    margin: 5px 0 0 0;
    padding: 5px;
}
.content
{
    border: 1px solid #BDBDBD;
    width: 91%;
    padding: 5px;
    margin: 0px 0 0 5px;
}

Now we have done run the application to check the output.


About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com
Email Id : contact@aspdotnet-pools.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Top jQuery Plugins

Global Classified : Connectseekers.com
© 2014
back to top