Skip to main content

Button Control in Asp.net



Button Controls:

ASP .Net provides three types of button controls: buttons, link buttons and image buttons. As the names suggest a button displays text within a rectangular area, a link button displays text that looks like a hyperlink. And an Image Button displays an image.
When a user clicks a button control, two events are raised Click and Command.
Basic syntax for button controls:
<asp:Button ID="Button1" runat="server" 
            onclick="Button1_Click" Text="Click" />
 


Common Properties of the Button control:
Property
Description
Text
The text displayed by the button. This is for button and link button controls only.
ImageUrl
For image button control only. The image to be displayed for the button.
AlternateText
For image button control only. The text to be displayed if the browser can't display the image.
CausesValidation
Determines whether page validation occurs when a user clicks the button. The default is true.
CommandName
A string value that's passed to the Command event when a user clicks the button.
CommandArgument
A string value that's passed to the Command event when a user clicks the button.
PostBackUrl
The URL of the page that should be requested when the user clicks the button.
 

Comments

Popular posts from this blog

Export html table to csv using javascript

<table>     <tr><th>Name</th><th>Age</th><th>Country</th></tr>     <tr><td>MANOJ</td><td>26</td><td>INDIA</td></tr>     <tr><td>KRISHAN</td><td>19</td><td>INDIA</td></tr>     <tr><td>SUSHEEL</td><td>32</td><td>INDIA</td></tr> </table> <button onclick="Export_CSV ()">Export HTML table to CSV file</button> function download_csv(csv, filename) {     var csvFile;     var downloadLink;     csvFile = new Blob([csv], {type: "text/csv"});     downloadLink = document.createElement("a");     downloadLink.download = filename;     downloadLink.href = window.URL.createObjectURL(csvFile);     downloadLink.style.d...

Sql CharIndex Function

The CHARINDEX  function returns the starting position of the specified expression in a character string. Example: Search for "t" in string "DotNetReceipe", and return position: SELECT CHARINDEX( 't' , 'DotNetReceipe' ) AS Position;