View Single Post
  #3 (permalink)  
Old February 27th, 2009, 11:42 AM
areed24 areed24 is offline
Authorized User
 
Join Date: Jan 2009
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default Almost but not quite

I have the following code on my page:

<
asp:DropDownListID="DropDownList1"runat="server"AutoPostBack="True"
DataSourceID="SqlDataSource1"DataTextField="Country"DataValueField="Id"AppendDataBoundItems="true">
<asp:ListItemValue="">Please select a county</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:SiteConnectionString1 %>"SelectCommand="SELECT [Country], [Id] FROM [Countries] ORDER BY [Country]">
</asp:SqlDataSource>
<asp:DropDownListID="DropDownList2"runat="server"DataSourceID="SqlDataSource2"DataTextField="Name"DataValueField="Id"AppendDataBoundItems="true"AutoPostBack="True"Visible="False">
</asp:DropDownList>
<asp:SqlDataSourceID="SqlDataSource2"runat="server"ConnectionString="<%$ ConnectionStrings:SiteConnectionString1 %>"SelectCommand="SELECT [Name], [CountryId], [Id] FROM [Cities] WHERE ([CountryId] = @CountryId) ORDER BY [Name]">
<SelectParameters>
<asp:ControlParameterControlID="DropDownList1"Name="CountryId"PropertyName="SelectedValue"Type="Int32"/>
</SelectParameters>
</asp:SqlDataSource>
<asp:RepeaterID="Repeater1"runat="server">
<ItemTemplate>
<pclass="Contacts"><asp:LiteralID="Literal1"runat="server"Text='<%# Eval("MemberName") %>'></asp:Literal>
<br/><asp:LiteralID="Literal2"runat="server"Text='<%# Eval("Email") %>'></asp:Literal>
<br/><asp:LiteralID="Literal3"runat="server"Text='<%# Eval("Summary") %>'></asp:Literal></p>
</ItemTemplate>
</asp:Repeater>

with this code on the code behind page

If Page.IsPostBack Then
Using myDataContext AsNew SiteDataContext()
Dim allReviews = From r In myDataContext.Reviews _
Where r.CityId = DropDownList2.SelectedValue _
SelectNewWith {r.Member.MemberName, r.Member.email, r.Summary}
Repeater1.DataSource = allReviews
Repeater1.DataBind()
EndUsing
EndIf

I get the results that I want, the User Name, their email address, and the review. However, the review continues off of the page, out of the main content area defined on the other pages. Why is it doing this? How do I fix it? And is using a literal the best way to display the information?