| Name | Description | |
|---|---|---|
| CallingDataMethods | Occurs when data methods are being called. (Inherited from DataBoundControl.) | |
| CreatingModelDataSource | Occurs when the ModelDataSource object is being created. (Inherited from DataBoundControl.) | |
| DataBinding | Occurs when the server control binds to a data source. (Inherited from Control.) | |
| DataBound | Occurs after the server control binds to a data source. (Inherited from BaseDataBoundControl.) | |
| Disposed | Occurs when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested. (Inherited from Control.) | |
| Init | Occurs when the server control is initialized, which is the first step in its lifecycle. (Inherited from Control.) | |
| Load | Occurs when the server control is loaded into the Page object. (Inherited from Control.) | |
| PageIndexChanged | Occurs when one of the pager buttons is clicked, but after the GridView control handles the paging operation. | |
| PageIndexChanging | Occurs when one of the pager buttons is clicked, but before the GridView control handles the paging operation. | |
| PreRender | Occurs after the Control object is loaded but prior to rendering. (Inherited from Control.) | |
| RowCancelingEdit | Occurs when the Cancel button of a row in edit mode is clicked, but before the row exits edit mode. | |
| RowCommand | Occurs when a button is clicked in a GridView control. | |
| RowCreated | Occurs when a row is created in a GridView control. | |
| RowDataBound | Occurs when a data row is bound to data in a GridView control. | |
| RowDeleted | Occurs when a row's Delete button is clicked, but after the GridView control deletes the row. | |
| RowDeleting | Occurs when a row's Delete button is clicked, but before the GridView control deletes the row. | |
| RowEditing | Occurs when a row's Edit button is clicked, but before the GridView control enters edit mode. | |
| RowUpdated | Occurs when a row's Update button is clicked, but after the GridView control updates the row. | |
| RowUpdating | Occurs when a row's Update button is clicked, but before the GridView control updates the row. | |
| SelectedIndexChanged | Occurs when a row's Select button is clicked, but after the GridView control handles the select operation. | |
| SelectedIndexChanging | Occurs when a row's Select button is clicked, but before the GridView control handles the select operation. | |
| Sorted | Occurs when the hyperlink to sort a column is clicked, but after the GridView control handles the sort operation. | |
| Sorting | Occurs when the hyperlink to sort a column is clicked, but before the GridView control handles the sort operation. | |
| Unload | Occurs when the server control is unloaded from memory. (Inherited from Control.) |
Showing posts with label event handler. Show all posts
Showing posts with label event handler. Show all posts
Friday, September 13, 2013
GridView Events
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview_events.aspx
Thursday, March 17, 2011
SharePoint's DateTimeControl.DateChanged Event BUG
Ok. So you want something to happen (e.g. update another DateTimeControl) when you change the value in the DateTimeControl.You realise that the DateTimeControl.DateChanged event could do the trick.
But NO...
Bugs I have identified:
1) The DateChanged Event does not get fired when you change the time
2) This snippet of code within the DateChangedEvent does not seem to work:
dtEnd.SelectedDate = dtStart.SelectedDate
* Bug 1 is known and so far here's the only workaround that I know (compliments to myself):
Insert a Jquery hack to "catch" the time change event:
$(document).ready(function() {
//Hour drop down list
$("#ctl00_PlaceHolderMain_dtStart_dtStartDateHours").change(function() {
var idx = $("#ctl00_PlaceHolderMain_dtStart_dtStartDateHours option").index($("option:selected"));
if (idx < 24) idx++;
$("#ctl00_PlaceHolderMain_dtEnd_dtEndDateHours option:eq(" + idx + ")").attr("selected", "selected");
});
//Minute drop down list
$("#ctl00_PlaceHolderMain_dtStart_dtStartDateMinutes").change(function() {
var idx2 = $("#ctl00_PlaceHolderMain_dtStart_dtStartDateMinutes option").index($("option:selected"));
$("#ctl00_PlaceHolderMain_dtEnd_dtEndDateMinutes option:eq(" + idx2 + ")").attr("selected", "selected");
});
});
The change event for the minute drop down list doesn't seem to work as yet. It is returning idx2 as -1. Will continue exploring on this.
A/N: Still not sure why it's not working, but here's another workaround:
$("#ctl00_PlaceHolderMain_dtEnd_dtEndDateMinutes").val($("#ctl00_PlaceHolderMain_dtStart_dtStartDateMinutes option:selected").val());
I realise that I don't need to get the index of the selected option as I can just replicate the values in the end date drop down.
* Bug 2 is less well-known, can't seem to find any solutions on google. Here's my current workaround (compliments to myself as well):
Add a "OnValueChangeClientScript" property to the DateTimeControl which calls "javascript:updateDates();".
function updateDates() {
$("#ctl00_PlaceHolderMain_dtEnd_dtEndDate").val($("#ctl00_PlaceHolderMain_dtStart_dtStartDate").val());
}
But NO...
Bugs I have identified:
1) The DateChanged Event does not get fired when you change the time
2) This snippet of code within the DateChangedEvent does not seem to work:
dtEnd.SelectedDate = dtStart.SelectedDate
* Bug 1 is known and so far here's the only workaround that I know (compliments to myself):
Insert a Jquery hack to "catch" the time change event:
$(document).ready(function() {
//Hour drop down list
$("#ctl00_PlaceHolderMain_dtStart_dtStartDateHours").change(function() {
var idx = $("#ctl00_PlaceHolderMain_dtStart_dtStartDateHours option").index($("option:selected"));
if (idx < 24) idx++;
$("#ctl00_PlaceHolderMain_dtEnd_dtEndDateHours option:eq(" + idx + ")").attr("selected", "selected");
});
//Minute drop down list
$("#ctl00_PlaceHolderMain_dtStart_dtStartDateMinutes").change(function() {
var idx2 = $("#ctl00_PlaceHolderMain_dtStart_dtStartDateMinutes option").index($("option:selected"));
$("#ctl00_PlaceHolderMain_dtEnd_dtEndDateMinutes option:eq(" + idx2 + ")").attr("selected", "selected");
});
});
The change event for the minute drop down list doesn't seem to work as yet. It is returning idx2 as -1. Will continue exploring on this.
A/N: Still not sure why it's not working, but here's another workaround:
$("#ctl00_PlaceHolderMain_dtEnd_dtEndDateMinutes").val($("#ctl00_PlaceHolderMain_dtStart_dtStartDateMinutes option:selected").val());
I realise that I don't need to get the index of the selected option as I can just replicate the values in the end date drop down.
* Bug 2 is less well-known, can't seem to find any solutions on google. Here's my current workaround (compliments to myself as well):
Add a "OnValueChangeClientScript" property to the DateTimeControl which calls "javascript:updateDates();".
function updateDates() {
$("#ctl00_PlaceHolderMain_dtEnd_dtEndDate").val($("#ctl00_PlaceHolderMain_dtStart_dtStartDate").val());
}
Tuesday, August 3, 2010
Attaching Event Receivers to Content Types
When you define a content type with a feature, you create 2 XML files as shown below:
- Feature.xml – Use this XML file to define the metadata for the new feature. The ElementManifests element points to the location of the 2nd XML file storing all of the detailed information on the feature itself.
- Elements.xml – Use this file to define the assembly that encapsulates the event handler, the class itself, and also a sequence number that specifies the order.
Note: Event receivers in content types are defined in a different section of the elements file. The Receiver XmlDocument resides in the http://schemas.microsoft.com/sharepoint/events namespace.
Related post: Writing Event Receiver Class in Code
References:
http://download.microsoft.com/download/b/d/4/bd45c0a8-74bc-4e3a-9735-a715b902f89c/03-EventHandlers.docx
Monday, November 23, 2009
.NET Event Handler Definition
DropDownList
GridViewDropDownList1_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.
Button1_Click(object sender, EventArgs e)
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.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)
CustomValidator1_ServerValidate(Object source, ServerValidateEventArgs e)
- Use this method to validate form and set appropriate control properties (e.g. Visibility)
Subscribe to:
Posts (Atom)