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

































































No comments:

Post a Comment