0

I have an entitydatasource defined in the markup as so

<asp:EntityDataSource ID="edsFV" runat="server"></asp:EntityDataSource>
            <asp:EntityDataSource ID="eds_fv_singleuserprofile" runat="server"
                    ConnectionString="name=webEntities" DefaultContainerName="webEntities"
                    EnableFlattening="False" EnableUpdate="True" EntitySetName="userprofiles"
                    Where="it.ASPUserId = @SelectedValue" >
                    <WhereParameters>
                        <asp:Parameter DefaultValue="20" Name="SelectedValue" Type="Int32" />
                    </WhereParameters>
            </asp:EntityDataSource>

I it requeries for information on a dropdown selection. It returns a single item with 5 properties. I am trying to acces one of the properties, "FullName" to use in the legend of the fieldset within the update panel this dropdown is changing data for as follows;

<asp:UpdatePanel ID="udpUserProfile" runat="server" >
            <ContentTemplate>
                <fieldset id="singleuserprofile" >
                    <legend>Profile details for <%# I want to databind the "FullName" property value here%></legend>
                       "other code"
                </fieldset>
            </ContentTemplate>
 </asp:UpdatePanel>

I cannot seem to find the method that works properly to do so. Any help appreciated.

dinotom
  • 4,990
  • 16
  • 71
  • 139
  • This is something you'll probably want to do in the code behind. I don't think using the datasource will be the best tool for the job. – Michael Richardson Jan 15 '13 at 02:27
  • yes well running an ef query in the dropdown selected index event produces no change in my detailview which is wehre "other code" is in my update panel. The page works fine, there is a way to extract that value through Eval, Bind or viewstate I just can't find how – dinotom Jan 15 '13 at 05:35
  • How did you end up getting your data for the legend? – Michael Richardson Feb 06 '13 at 04:55

1 Answers1

0

While I haven't found anything explicitly stating so, it is my understanding that Data Sources are used solely to interface with data-bound controls. From the MSDN page:

Data source controls greatly expand the capabilities of data-bound controls such as the GridView, FormView, and DetailsView controls. By working together, data source controls and data-bound controls let you retrieve, modify, page, sort, and filter data from different data sources with little or no code.

You should probably get the data for the fieldset tag with an Entity query, and use the entitydatasource with your DetailsView only.

As best I can understand, you are using a DropDownList with AutoPostBack to select the item in the DetailsView. If, as your comment implies, the DetailsView is not updating when you do the partial postback you should call a .DataBind() on the control. Also, using a ControlParameter instead of a basic Parameter may be more appropriate in this context.

Michael Richardson
  • 4,213
  • 2
  • 31
  • 48
  • No, the detail view updates properly I am simply trying to get the FullName property value from the EDS for the fieldset legend text – dinotom Jan 15 '13 at 22:30
  • If you really want to use the `DataSource` you could wrap the `legend` tag in a data control such as a `FormView` or `Repeater` and use the normal binding expressions. – Michael Richardson Jan 16 '13 at 02:35