User435566049 posted
I have a page that contains at least two ObjectDataSources, one that displays the details of a record (sourceRecord), and one that contains a list of categories (sourceCategories). I have a FormView that uses sourceRecord as its data source.
Inside the FormView's EditItemTemplate, there is a DropDownList that uses sourceCategories as its datasource.
I use the Selected event for both of these ObjectDataSources in my code. For reasons I cannot understand, the Selected event for sourceRecord is only raised once, but the Selected event for sourceCategories is raised twice.
Here is the code for the two ObjectDataSources:
<asp:ObjectDataSource ID="sourceRecord" runat="server"
SelectMethod="GetGraybookRecordByID"
TypeName="AFATempeDB.GraybookComponent.GraybookDB"
onselected="sourceGraybookDocument_Selected"
UpdateMethod="UpdateGraybookRecord"
OldValuesParameterFormatString="original_{0}">
<UpdateParameters>
...
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0" Name="record_id"
QueryStringField="DocID" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="sourceCategories" runat="server"
SelectMethod="GetAFSDocumentList"
TypeName="AFATempeDB.AFSDocumentsComponent.AFSDocumentsDB"
onselected="sourceAFSDocuments_Selected">
<SelectParameters>
<asp:ControlParameter ControlID="FormView1$chkWIUGRD_Fletcher" DefaultValue="false"
Name="wiugrd_fletcher" PropertyName="Checked" Type="Boolean" />
</SelectParameters>
</asp:ObjectDataSource>
Can anyone explain why the Selected event is being raised twice and what I can do to fix it?