Last post Jun 01, 2011 10:46 PM by Decker Dong - MSFT
May 31, 2011 02:09 PM|TBossAZ|LINK
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"
<asp:QueryStringParameter DefaultValue="0" Name="record_id"
QueryStringField="DocID" Type="Int32" />
<asp:ObjectDataSource ID="sourceCategories" runat="server"
<asp:ControlParameter ControlID="FormView1$chkWIUGRD_Fletcher" DefaultValue="false"
Name="wiugrd_fletcher" PropertyName="Checked" Type="Boolean" />
Can anyone explain why the Selected event is being raised twice and what I can do to fix it?
Jun 01, 2011 10:46 PM|Decker Dong - MSFT|LINK
It seems that you've put the ObjectDataSource outside the FormView, and you want to bind the Dropdownlist with the ObjectDataSource (because I see your ControlId is FormView1$chkWIUGRD_Fletcher).
I guess you can try to put the ObjectDataSource inside the ItemTemplate or EditTemplate inside the FormView to bind to the Dropdownlist.