Multiple datasources in FormView/DetailsView

S

swethasivaram

Hi all

I am displaying some information from my database using DetailsView
which is bound to SqlDataSource1.

<asp:DetailsView ID="DetailsView1" runat="server"
AutoGenerateRows="False" DataSourceID="SqlDataSource1"
ForeColor="#333333" >

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [x], [y], [z], [a], , [c] FROM [sometable]
WHERE ([ID] = @ID)"> />

When I allow editing of this information, I want to populate certain
dropdownlists in the DetailsView using different datasources. Is this
possible?

Specifically:

<ItemTemplate>
<asp:Label ID="lbl" runat="server" Text='<%# Bind("someField")
%>'></asp:Label><br />
</ItemTemplate>

<EditItemTemplate>
<asp:DropDownList ID="ddl" runat="server" </asp:DropDownList><br />
</EditItemTemplate>

The ListItems for this DropDownList need to come from another database
table, not the same one to which it is bound in the ItemTemplate.

Is this possible at all?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top