h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Find existing Item in ComboBox in C#.net

Today we will see "Find Existing Item in ComboBox in C#.net"

Code
private void ComboBox1_Leave(System.Object sender, System.EventArgs e)
{
int resultIndex = -1;
resultIndex = ComboBox1.FindStringExact(ComboBox1.Text);
if (resultIndex > -1) {
MessageBox.Show("Found It");
}
else
{
MessageBox.Show("Did Not Find It");
}
}

Find existing item in ComboBox in Vb.net

Today we will discuss about Find existing item in Combobox in VB.Net

Private Sub ComboBox1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.Leave
Dim resultIndex As Integer = -1
resultIndex = ComboBox1.FindStringExact(ComboBox1.Text)
If resultIndex > -1 Then
MessageBox.Show("Found It")
Else
MessageBox.Show("Did Not Find It")
End If
End Sub

Define ViewBag in MVC

Define ViewBag in MVC
ViewBag is used to pass data from a controller to the view.ViewBag object holds the data.

Define Helper Classes

Define Helper Classes
There are several Helper classes in MVC frame work. 
1.Form Helper- Radio buttons, textboxes,list boxes etc.
2.URL helpers
3.HTML helpers- Encode, Decode, AttributeEncode, and RenderPartial.

Define Non-Action Methods

Define Non-Action Methods

  • All action methods in a Controller are defined as public method.
  •  If you want some method as non action method,mark the method with NonAction Attribute.

Define Action Methods Parameters

Define Action Methods Parameters

  • Request and Response methods can be called from the action method of the controller.
  • If the parameter to an action method is passing through the URL, there are several ways to access it into our action method.

Define MVC Attributes

Define MVC Attributes

  1. Attribute is a class which inherites from the abstract class System.Attribute.
  2. All attributes should end with the name "Attribute".

Define ActionResult Return Type

Define ActionResult Return Type

  1. Creating new controllers, they will come with one or more actions by default.
  2.  The Empty controller includes an Index action with a return value of type ActionResult.
  3.  ActionResult class is the base class for all action results.

Define Action methods

Define Action methods

  • User gives request to the controller via URL. 
  •  The Controller processes the requests using the action methods defined by the Controller. 

Define Types of Action Filters

Define Types of Action Filters
1. Authorization filters 
       Implements the IAuthorizationFilter attribute. This filter is always executed first. 
2. Action filters
       Implements the IActionFilter attribute. You can use this filter to modify the viewdata that an action returns.
3. Result filters 
       Implements the IResultFilter attribute. Eg You might want to modify the view result before view is redered to the browser.
4. Exception filters
       Implements the IExceptionFilter attribute. Can be used to log errors, raised by your controller action or controller action results.