ToolBox HTML Control HTMLRadio

HTML Radio Web Server Control

In ASP.NET environment,This article describes you how to work with HTML Radio Control.In HTML environment, Radio is an object that represents a Radio in an HTML form. The Radio control in a HTML form contains all instance of an <input type="radio"> tag.

The primary mechanism of the Radio control is to selecting the optional item. For instance, there are two items called male and female that any one can be choosen by radio button.

There are several functions available to access the HTML Radio.some of its funtions are as follows,

  • document.getElementById()
  • document.getElementByName()
Radio Objects Properties
  • id -Sets or returns the id of a Radio
  • form -Returns a reference to the form that contains the Radio
  • accessKey -Sets or returns the keyboard key to access a Radio
  • alt -Sets or returns an alternate text to display if a browser does not support Radio
  • disabled -Sets or returns whether or not a Radio should be disabled
  • tabIndex -Sets or returns the tab order for a Radio
  • name -Sets or returns the name of a Radio
  • type -Returns the type of form element a Radio is
  • checked -Sets or returns whether or not a Radio should be checked
  • defaultchecked - Returns the default value of the checked attribute
  • value -Sets or returns the text that is displayed on the Radio
  • title -Sets or returns an element's advisory title
  • lang -Sets or returns the language code for an element
  • dir -Sets or returns the direction of text
  • className -Sets or returns the class attribute of an element
Radio Objects Methods
  • blur() -Performs focus when leave from the control
  • click() -Simulates a mouse-click on a Radio
  • focus() -Performs focus when enter into the control

The following code snippets explains you the HTML Radio in the web form.

in .aspx.cs page,

void Button1_Click(object sender, EventArgs e) 
      {

         if (rb1.Checked == true)
            Span1.InnerHtml = "Option 1 is selected";
         else if (rb2.Checked == true)
            Span1.InnerHtml = "Option 2 is selected";
         else if (rb3.Checked == true)
            Span1.InnerHtml = "Option 3 is selected";
      }
        

in .aspx page,

<form id="Form2" runat=server>
      <h3>HtmlInputRadioButton Sample</h3>
      <input type="radio" 
             id="rb1" 
             name="Mode" 
            runat="server"/>
      Option 1<br>
      <input type="radio" 
             id="rb2" 
             name="Mode" 
            runat="server"/>
      Option 2<br>
      <input type="radio" 
             id="rb3" 
             name="Mode" 
             runat="server"/>
      Option 3
      <p>
      <span id="Span1" runat="server" />
      <p>
      <input type="button" 
             id="Button1" 
             value="Enter" 
             OnServerClick="Button1_Click" 
             runat="server">
   </form>
 
Related Links

Posted by: Admin
Posted on: 9/18/2009 at 4:53 PM
Tags: , ,
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (31) | Post RSSRSS comment feed

ToolBox HTML Control HTMLPassword

HTML Password Web Server Control

In ASP.NET environment,This article describes you how to work with HTML Password Control.In HTML environment, Password is an object that represents a HTML Password in an HTML form. The Password control in a HTML form contains all instance of an <input type="password"> tag.

The Value property of the Password control is posted to the server each time the form is submitted. The Value property for the HtmlInputPassword control is not available in view state.All of these characters are represented as asterisk(*). The MaxLength property specifies the maximum number of characters that can be entered in the text box. The Size property allows you to specify the width of the text box.

There are several functions available to access the HTML Password.some of its funtions are as follows,

  • document.getElementById()
  • document.getElementByName()
Password Objects Properties
  • id -Sets or returns the id of a Password
  • form -Returns a reference to the form that contains the Password
  • accessKey -Sets or returns the keyboard key to access a Password
  • alt -Sets or returns an alternate text to display if a browser does not support Passwords
  • disabled -Sets or returns whether or not a Password should be disabled
  • tabIndex -Sets or returns the tab order for a Password
  • name -Sets or returns the name of a Password
  • type -Returns the type of form element a Password is
  • maxLength - Sets or returns the maximum number of characters in a text field
  • readOnly -Sets or returns whether or not a text field should be read-only
  • value -Sets or returns the text that is displayed on the Password
  • title -Sets or returns an element's advisory title
  • lang -Sets or returns the language code for an element
  • dir -Sets or returns the direction of text
  • className -Sets or returns the class attribute of an element
Password Objects Methods
  • blur() -Performs focus when leave from the control
  • click() -Simulates a mouse-click on a Password
  • focus() -Performs focus when enter into the control

The following code snippets explains you the HTML Password in the web form.

in .aspx page,

<html  >
  <body>
    <form id="Form2" runat="server">
          
        <p></p><div>Email</div> <br />
        <input id="Text1" type="text" runat="server" />
        <p></p><div>Email</div> <br />
        <input id="Password1" type="password" runat="server" />
        <p></p><input id="Submit1" type="submit" runat="server" value="Submit" />
    </form>
  </body>
</html>
 
Related Links

Posted by: Admin
Posted on: 9/18/2009 at 4:52 PM
Tags: , ,
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (56) | Post RSSRSS comment feed

ToolBox HTML Control HTMLImage

HTML Image Web Server Control

In ASP.NET environment,This article describes you how to work with HTML Image Control.In HTML environment, Image is an object that represents an embedded Image in an HTML form. The Image control in a HTML form contains all instance of an <img> tag.

The HTML Image control can be used to rendering the image onto the web page.and which can be supporting the file types such as .gif, .jpg, .png, etc.

There are several functions available to access the HTML Image.some of its funtions are as follows,

  • document.getElementById()
  • document.getElementByName()
Image Objects Properties
  • id -Sets or returns the id of a Image
  • border -Sets or returns the width of the Image border
  • align -Sets or returns how to align an image according to the surrounding text
  • alt - Sets or returns an alternate text to be displayed, if a browser cannot show an image
  • complete - Returns whether or not the browser has finished loading the image
  • height -Sets or returns the height of an image
  • width -Sets or returns the width of a Image
  • hspace -Sets or returns the white space on the left and right side of the image
  • isMap -Returns whether or not an image is a server-side image map
  • longDesc -Sets or returns a URL to a document containing a description of the image
  • lowsrc -Sets or returns a URL to a low-resolution version of an image
  • src -Sets or returns the URL of an image
  • useMap -Sets or returns the value of the usemap attribute of an client-side image map
  • vspace -Sets or returns the white space on the top and bottom of the image
  • title -Sets or returns an element's advisory title
  • className -Sets or returns the class attribute of an element

The following code snippets explains you the HTML Image in the web form.

in .aspx.cs page,

    
       void Image2_Click(object sender, EventArgs e) 
       {
          img1.Src="orange.jpg";
          img1.Height=300;
          img1.Width=250;
          img1.Border=7;
          img1.Align="left";
          img1.Alt="Image 2";
       }
        

in .aspx page,

 
<form id="Form2" runat="server">
        <h3>Example</h3>
        <center>
           <button id="btn1"
                  OnServerClick="img1_Click" 
                  runat="server">
          Image 1
          </button>
        </center>
        <br><br>
        <img id ="img1"
            Src="apple.jpg"
            Width="200"
            Height="150"
            Alt="Image 1"
            Border="5"
            Align="center" 
            runat=server/>
    </form>
 
Related Links

Posted by: Admin
Posted on: 9/18/2009 at 4:51 PM
Tags: , ,
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (16) | Post RSSRSS comment feed

ToolBox HTML Control HTMLHidden

HTML Hidden Web Server Control

In ASP.NET environment,This article describes you how to work with HTML Hidden Control.In HTML environment, Hidden is an object that represents a Hidden control in an HTML form. The Hidden control in a HTML form contains all instance of an <input type="hidden"> tag.

The HtmlInputHidden control can be used to comprised information that is concealed from the user that means user unable to view the information. This information is sent when the Web page is posted back to the server.

There are several functions available to access the HTML Hidden.some of its funtions are as follows,

  • document.getElementById()
  • document.getElementByName()
Hidden Objects Properties
  • id -Sets or returns the id of a Hidden
  • form -Returns a reference to the form that contains the Hidden
  • alt -Sets or returns an alternate text to display if a browser does not support Hiddens
  • name -Sets or returns the name of a Hidden
  • type -Returns the type of form element a Hidden is
  • value -Sets or returns the text that is displayed on the Hidden
  • title -Sets or returns an element's advisory title
  • lang -Sets or returns the language code for an element
  • dir -Sets or returns the direction of text
  • className -Sets or returns the class attribute of an element
Hidden Objects Methods
  • blur() -Performs focus when leave from the control
  • click() -Simulates a mouse-click on a Hidden
  • focus() -Performs focus when enter into the control

The following code snippets explains you the HTML Hidden in the web form.

in .aspx.cs page,

void Page_Load(object sender, EventArgs e) 
      {

         if (Page.IsPostBack) 
         {
            Span1.InnerHtml="Hidden value: " + hid1.Value + "";
         }
      }

      void SubmitBtn_Click(object sender, EventArgs e) 
      {
         hid1.Value=StringContents.Value;
      }
        

in .aspx page,

 <form id="Form2" runat=server>
      <h3>HtmlInputHidden Sample</h3>
      <input id="hid1" 
             type=hidden 
             value="Initial Value" 
             runat=server>      
      <input id="StringContents" 
             type=text 
             size=40 
             runat=server>
      <p>
      <input id="Submit1" type=submit 
             value="Enter" 
             OnServerClick="SubmitBtn_Click" 
             runat=server>
      <p>
   </form>
 
Related Links

Posted by: Admin
Posted on: 9/18/2009 at 4:51 PM
Tags: , ,
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (28) | Post RSSRSS comment feed

ToolBox HTML Control HTMLFile

HTML File Web Server Control

In ASP.NET environment,This article describes you how to work with HTML File Control.In HTML environment, File is an object that represents a FileUpload in an HTML form. The FileUpload control in a HTML form contains all instance of an <input type="file"> tag.

The HtmlInputFile control can be used to uploading binary or text files from a browser client to the server. which was implemented and works with Microsoft Internet Explorer version 3.02 or Higher. HtmlInputFile controls requires the full path of the uploading file.for example ,"d:\Photos\img1.jpg" in the text box of the control.

There are several functions available to access the HTML File.some of its funtions are as follows,

  • document.getElementById()
  • document.getElementByName()
File Objects Properties
  • id -Sets or returns the id of a File
  • form -Returns a reference to the form that contains the File
  • accessKey -Sets or returns the keyboard key to access a File
  • alt -Sets or returns an alternate text to display if a browser does not support Files
  • disabled -Sets or returns whether or not a File should be disabled
  • tabIndex -Sets or returns the tab order for a File
  • name -Sets or returns the name of a File
  • type -Returns the type of form element a File is
  • defaultvalue - Sets or returns the initial value of the FileUpload object
  • value -Sets or returns the text that is displayed on the File
  • title -Sets or returns an element's advisory title
  • lang -Sets or returns the language code for an element
  • dir -Sets or returns the direction of text
  • className -Sets or returns the class attribute of an element
File Objects Methods
  • blur() -Performs focus when leave from the control
  • click() -Simulates a mouse-click on a File
  • focus() -Performs focus when enter into the control

The following code snippets explains you the HTML File in the web form.

in .aspx.cs page,

void btn1_Click(object Source, EventArgs e)
  {

    if (txt1.Value == "")
    {
      Span1.InnerHtml = "file name required";
      return;
    }

    if (File1.PostedFile.ContentLength > 0)
    {
      try
      {
        File1.PostedFile.SaveAs("d:\\apppath\\" + txt1.Value);
        Span1.InnerHtml = "File uploaded successfully to c:\\temp\\"
         + txt1.Value + " on the Web server.";
      }
      catch (Exception ex)
      {
        Span1.InnerHtml = "Error saving file d:\\apppath\\" + txt1.Value + "
" + ex.ToString() + "."; } } }

in .aspx page,

<body> 
    <h3>Example</h3>
     <form id="Form2" enctype="multipart/form-data" 
          runat="server">
       Select File to Upload: 
       <input id="File1" 
              type="file" 
              runat="server">
      <p>
       <input id="txt1" 
              type="text" 
              runat="server">
       </p>
       <p>
       <span id=Span1 
             style="font: 8pt verdana;" 
             runat="server" />
       </p>
       <p>
       <input type=button 
              id="btn1" 
              value="Upload" 
              onserverclick="btn1_Click" 
             runat="server">
       </p>
   </form>
 </body>
 
Related Links

Posted by: Admin
Posted on: 9/18/2009 at 4:50 PM
Tags: , , ,
Categories: Asp.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (22) | Post RSSRSS comment feed