Sassy2spice
New Member
I have the following mark-up:\[code\]<div class="section"> <p runat="server" id="sectionName"></p></div><div class="label"> <div class="activity-header">Activity</div> <div class="status-header">Status</div> <div class="comment-header">Comment</div></div><asp:Repeater ID="rptActivity" runat="server"> <ItemTemplate> <div class="under-label"> <div class="activity"> <%#Eval("ActivityName")%> <input type="hidden" name="activityId" value='http://stackoverflow.com/questions/13830676/<%#Eval("ActivityId")%>' /> </div> <div class="status"> <aspropDownList ID="ddlStatuses" DataValueField="Id" DataTextField="Name" DataSourceID="SqlDataSource1" runat="server"></aspropDownList> </div> <div class="comment"> <textarea name="comments" cols="35" rows="3" name="comment" style="float: left; margin: 0px 0px 0px 25px; font-family: Geneva, Arial, Helvetica, sans-serif;"><%#Eval("Comment")%></textarea> </div> </div> </ItemTemplate></asp:Repeater><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStringshumafConnectionString %>" SelectCommand="SELECT * FROM [Status]"></asp:SqlDataSource>\[/code\]The datasource for the rptActivity Repeater is List and Helper is defined as below:\[code\]public class Helper { public string ActivityName { get; set; } public long ActivityId { get; set; } public long StatusId { get; set; } public string Comment { get; set; } }\[/code\]As you can see I am binding the relevant fields to the properties of the entity and am binding all the ddlStatuses to a datasource which returns all statuses.. However, since this is an update screen I want to have the previously selected status selected, and I have that Id through the prop StatusId of the Helper entity.Tried setting SelectedValue of ddlStatuses to <%# Eval("StatusId") %> but it threw an exception that I can only call props from the datasource to which the control is bound.Basically I have the StatusIds I need to make them selected in ddlStatuses.How can I do that?Thanks for your time and if you have any question, please do ask.EDIT:I forgot to mention that one of the solutions I had in mind is including \[code\]List<Status>\[/code\] as a property in the helper class, that way I'll have the statusId as well as all other statuses, however that won't work if I can't use the parent's datasource.