1 out of 2 rated this helpful - Rate this topic

ObjectDataSource.Selecting Event

Occurs before a Select operation.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)
public event ObjectDataSourceSelectingEventHandler Selecting
<asp:ObjectDataSource OnSelecting="ObjectDataSourceSelectingEventHandler" />

Handle the Selecting event to perform additional initialization that is specific to your application, to validate the values of parameters, or to change the parameter values before the ObjectDataSource control performs the data retrieval operation. The parameters are available as an IDictionary collection that is accessed by the InputParameters property, which is exposed by the ObjectDataSourceMethodEventArgs object.

This event can be fired twice for a single call to the Select method, if the SelectCountMethod property is set. The ExecutingSelectCount property of the ObjectDataSourceSelectingEventArgs object is used to determine if select was called to retrieve data or retrieve the count.

For more information about handling events, see Consuming Events.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Not Fired during postback
I have a grid and objectDataSource in updatePanel.  ObjectDataSource.Selecting  gets fired when the page loads normally. But  during postback this event is not getting fired.  Following is the callstack from  IntelliTrace  and clearly we can see that this event is not getting called whereas when it is not a postback, the callstack shows OnSelecting method being called after ExecuteSelect.


mscorlib.dll!System.Number.StringToNumber(string str = {unknown}, System.Globalization.NumberStyles options = {unknown}, ref NumberBuffer number = {unknown}, System.Globalization.NumberFormatInfo info = {unknown}, bool parseDecimal = {unknown}) 
  mscorlib.dll!System.Number.ParseInt32(string s = {unknown}, System.Globalization.NumberStyles style = {unknown}, System.Globalization.NumberFormatInfo info = {unknown}) 
  mscorlib.dll!System.String.System.IConvertible.ToInt32(System.IFormatProvider provider = {unknown}) 
  mscorlib.dll!System.Convert.ChangeType(object value = {unknown}, System.TypeCode typeCode = {unknown}, System.IFormatProvider provider = {unknown}) 
  System.Web.dll!System.Web.UI.WebControls.Parameter.GetValue(object value = {unknown}, string defaultValue = {unknown}, System.TypeCode type = {unknown}, bool convertEmptyStringToNull = {unknown}, bool ignoreNullableTypeChanges = {unknown}) 
  System.Web.dll!System.Web.UI.WebControls.Parameter.GetValue(object value = {unknown}, bool ignoreNullableTypeChanges = {unknown}) 
  System.Web.dll!System.Web.UI.WebControls.ParameterCollection.GetValues(System.Web.HttpContext context = {unknown}, System.Web.UI.Control control = {unknown}) 
  System.Web.dll!System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(System.Web.UI.DataSourceSelectArguments arguments = {unknown}) 
  System.Web.dll!System.Web.UI.DataSourceView.Select(System.Web.UI.DataSourceSelectArguments arguments = {unknown}, System.Web.UI.DataSourceViewSelectCallback callback = {unknown}) 
  System.Web.dll!System.Web.UI.WebControls.DataBoundControl.PerformSelect() 
  System.Web.dll!System.Web.UI.WebControls.BaseDataBoundControl.DataBind() 
  System.Web.dll!System.Web.UI.WebControls.GridView.DataBind() 
  System.Web.dll!System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() 
  System.Web.dll!System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(System.EventArgs e = {unknown}) 
  System.Web.dll!System.Web.UI.WebControls.GridView.OnPreRender(System.EventArgs e = {unknown}) 
  System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() 
  System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() 
  System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() 
  System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() 
  System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() 
  System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() 
  System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() 
  System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() 
  System.Web.dll!System.Web.UI.Control.PreRenderRecursiveInternal() 
  System.Web.dll!System.Web.UI.Page.ProcessRequestMain(bool includeStagesBeforeAsyncPoint = {unknown}, bool includeStagesAfterAsyncPoint = {unknown}) 
  System.Web.dll!System.Web.UI.Page.ProcessRequest(bool includeStagesBeforeAsyncPoint = {unknown}, bool includeStagesAfterAsyncPoint = {unknown}) 
  System.Web.dll!System.Web.UI.Page.ProcessRequest() 
  System.Web.dll!System.Web.UI.Page.ProcessRequestWithNoAssert(System.Web.HttpContext context = {unknown}) 
  System.Web.dll!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext context = {unknown}) 
  App_Web_svmivhsw.dll!ASP.initiallogin_wastelabelprintrequest_aspx.ProcessRequest(System.Web.HttpContext context = {unknown}) 
  System.Web.dll!CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
  System.Web.dll!System.Web.HttpApplication.ExecuteStep(IExecutionStep step = {unknown}, ref bool completedSynchronously = {unknown}) 
  System.Web.dll!ApplicationStepManager.ResumeSteps(System.Exception error = {unknown}) 
  System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext context = {unknown}, System.AsyncCallback cb = {unknown}, object extraData = {unknown}) 
  System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest wr = {unknown}) 
  System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest wr = {unknown}) 
  System.Web.dll!System.Web.HttpRuntime.ProcessRequest(System.Web.HttpWorkerRequest wr = {unknown}) 
  WebDev.WebHost20.dll!Microsoft.VisualStudio.WebHost.Request.Process() 
  WebDev.WebHost20.dll!Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Microsoft.VisualStudio.WebHost.Connection conn = {unknown}) 
  WebDev.WebHost20.dll!Microsoft.VisualStudio.WebHost.Server.OnSocketAccept(object acceptedSocket = {unknown}) 
  mscorlib.dll!System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(object state = {unknown}) 
  mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext = {unknown}, System.Threading.ContextCallback callback = {unknown}, object state = {unknown}) 
  mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(System.Threading._ThreadPoolWaitCallback tpWaitCallBack = {unknown}) 
  mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(object state = {unknown})