Showing posts with label Button Control. Show all posts
Showing posts with label Button Control. Show all posts

How to use Button CommandName Property programmatically in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2.ToolBox->Drag and Drop  Button on design window->Right click on Button->select properties->(look for text property) change text property from Button to Next Button->Set CommandName Property to next













ToolBox->Drag and Drop  Button on design window->Right click on Button->select properties->change text property from Button to Back Button->Set CommandName Property to back

3.Right click on Button1(Next Button)->select properties->click Events->Double click on Command Event(to get the code behind)








And write this code

4.Right click on Button2(Back Button)->select properties->click Events->On Command event select Button1_Command from DropDownList(it is the event which we created in our button1 Command event)


5.Click F5 to run your project

































































How to Set or Change Button BackGroundColor(BackColor) Programmatically in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2.Click ToolBox-> Double Click on Button(or drag and drop Button on Design view)->Right click on Button->Select Properties->change Button Text Property to "The Example Button"

3.ToolBox->Drag and Drop Two Button on design window->Right click on Button one->select properties->(look for text property) change text property from Button to   BackColor Coral
->Also change Button two Text property to  BackColor Gold
Your Design Window should look like this 
asp.net Button BackgroundColor(BackColor) Example















4.Double click on Button2(BackColor Coral Button) to get the code behind->Write this code
5.Double click on Button3(backColor Gold Button) to get the code behind->Write this code
6.Click F5 to run your project.  




























 

How to Enable or Disable Button Control Programmatically in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2.Click ToolBox-> Double Click on Button(or drag and drop Button on Design view)->Right click on Button->Select Properties->change Button Text Property to "The Example Button"







ToolBox->Double Click on Label->Right click on Label->Select Properties->On Label Text Property Remove Label(Keep it blank)






3.ToolBox->Drag and Drop Two Button on design window->Right click on Button one->select properties->(look for text property) change text property from Button to   Disable Button
->Also change Button two Text property to  Enable Button
Your Design Window should look like this 
asp.net Enable or Disable Button Example









4.Double click on Button1(Hide Button) to get the code behind->Write this code
5.Double click on Button1(Show Button) to get the code behind->Write this code
6.Click F5 to run your project. 
asp.net Enable or Disable Button Example













asp.net Enable or Disable Button Example













asp.net Enable or Disable Button Example
 

How to Show or Hide Button Programmatically in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2.Click ToolBox-> Double Click on Button(or drag and drop Button on Design view)->Right click on Button->Select Properties->change Button Text Property to "The Example Button"

3.ToolBox->Drag and Drop Two Button on design window->Right click on Button one->select properties->(look for text property) change text property from Button to   Hide Button
->Also change Button two Text property to  Show Button
Your Design Window should look like this 
asp.net Button Show or Hide Example








4.Double click on Button1(Hide Button) to get the code behind->Write this code
5.Double click on Button1(Show Button) to get the code behind->Write this code
6.Click F5 to run your project.  
asp.net Button Show or Hide Example
























asp.net Button Show or Hide Example


























asp.net Button Show or Hide Example

How to change TextBox TextMode SingleLine to Password Programmatically

1.File->New->Website->(left side select visual c#) ASP.NET Web Site->ok

2.Now You will see a Default.aspx page.
To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add

3. Click Design->From ToolBox Drag and Drop a Label to Design window->Right click on label->select properties->(look for text property) change text property from label to "User Name".

4.Toolbox->drag and drop a TextBox to Design window(or Double click on Textbox) Beside label1.


5.Again Add a label and a TextBox following step 3 and 4->Name this label text to "Password"

6.Toolbox->Double click on Button and place it like the image.

Your Design should look like this.

 7.Click F5->Ok
Before Clicking The Button

After Clicking The Button

How to Change Button width Programmatically

 1.File->New->Website->(left side select visual c#) ASP.NET Web Site->ok

2.Now You will see a Default.aspx page.
To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add

3. Click Split(to see Design and code View simultaniously)->From ToolBox Drag and Drop a Label to Design window->Right click on label->select properties->(look for text property) change text property from label to "Button Width Example".

4.Drag and drop a button below label->Right click on Button->select properties->change text property from Button to "Width 300.Your window should look like this.