Monday, November 23, 2009

.NET Event Handler Definition

DropDownList
DropDownList1_Init(object sender, EventArgs e)
  • Use this method to initialise the items in the drop down list
DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
  • DropDownList1.SelectedValue to get selected value

RadioButtonList
RadioButtonList1_DataBound(object sender, EventArgs e)
  • Use this method to set "selected" property of radio button list items.
Button
Button1_Click(object sender, EventArgs e)

GridView
GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  • e.Row to get the row that is being bounded by data
  • e.Row.Cells to get the collection of cells inside the row
  • Note that the content has not been rendered, so use "FindControl"
GridView1_SelectedIndexChanged(object sender, EventArgs e)
  • GridView1.SelectedValue to get the selected value.
GridView1_RowUpdating(object sender, EventArgs e)
  • This method is called when grid view row is updated (useful to set the UpdateParameter values)
CustomValidator
CustomValidator1_ServerValidate(Object source, ServerValidateEventArgs e)
  • Use this method to validate form and set appropriate control properties (e.g. Visibility)

No comments:

Post a Comment