Hello,
I have a RadList populated by an SQLDatasource that looks like this:
Here is the code for my RadListBox:
When I try to run this, the Objective name shows up as it is supposed to, but the TopicName and CategoryName don't display in the list (it is empty in those areas). I have this in my codebehind:
Can anyone tell me what I'm missing? This is urgent, as it is for a project that is due very soon. Help! :)
I have a RadList populated by an SQLDatasource that looks like this:
<asp:SqlDataSource ID="dsObjectives" runat="server" |
ConnectionString="<%$ ConnectionStrings:MentorDBConnectionString %>" |
DeleteCommand="DELETE FROM [ObjAssignment] WHERE [ObjAssign_ID] = @ObjAssign_ID" |
InsertCommand="INSERT INTO [ObjAssignment] ([Role_ID], [Topic_ID], [Objective_ID], [SortOrder]) VALUES (@Role_ID, @Topic_ID, @Objective_ID, @SortOrder)" |
SelectCommand="SELECT ObjAssignment.ObjAssign_ID, ObjAssignment.Role_ID, ObjAssignment.Topic_ID, ObjAssignment.Objective_ID, ObjAssignment.SortOrder, Objectives.[Content], Categories.CategoryName, Topics.TopicName FROM ObjAssignment INNER JOIN Objectives ON ObjAssignment.Objective_ID = Objectives.Objective_ID INNER JOIN Topics ON ObjAssignment.Topic_ID = Topics.Topic_ID INNER JOIN Categories ON Objectives.Category_ID = Categories.Category_ID WHERE (ObjAssignment.Role_ID = @Role_ID) ORDER BY ObjAssignment.SortOrder" |
UpdateCommand="UPDATE [ObjAssignment] SET [Role_ID] = @Role_ID, [Topic_ID] = @Topic_ID, [Objective_ID] = @Objective_ID, [SortOrder] = @SortOrder WHERE [ObjAssign_ID] = @ObjAssign_ID"> |
<SelectParameters> |
<asp:ControlParameter ControlID="comboRole" DefaultValue="2" Name="Role_ID" |
PropertyName="SelectedValue" Type="Int32" /> |
<asp:ControlParameter ControlID="comboTopics" DefaultValue="0" Name="Topic_ID" |
PropertyName="SelectedValue" Type="Int32" /> |
</SelectParameters> |
<DeleteParameters> |
<asp:Parameter Name="ObjAssign_ID" Type="Int32" /> |
</DeleteParameters> |
<UpdateParameters> |
<asp:Parameter Name="Role_ID" Type="Int32" /> |
<asp:Parameter Name="Topic_ID" Type="Int32" /> |
<asp:Parameter Name="Objective_ID" Type="Int32" /> |
<asp:Parameter Name="SortOrder" Type="Int32" /> |
<asp:Parameter Name="ObjAssign_ID" Type="Int32" /> |
</UpdateParameters> |
<InsertParameters> |
<asp:Parameter Name="Role_ID" Type="Int32" /> |
<asp:Parameter Name="Topic_ID" Type="Int32" /> |
<asp:Parameter Name="Objective_ID" Type="Int32" /> |
<asp:Parameter Name="SortOrder" Type="Int32" /> |
</InsertParameters> |
</asp:SqlDataSource> |
Here is the code for my RadListBox:
<telerik:RadListBox ID="listObjectives" runat="server" |
AllowAutomaticUpdates="True" AllowReorder="True" AutoPostBackOnReorder="True" |
DataKeyField="ObjAssign_ID" DataSortField="SortOrder" |
DataSourceID="dsObjectives" DataTextField="Content" |
DataValueField="ObjAssign_ID" EnableDragAndDrop="True" Skin="Office2007" |
Width="100%" style="top: 0px; left: 0px" |
onitemdatabound="listObjectives_ItemDataBound" |
EmptyMessage="No Objectives Found" Height="375px" |
onreordered="listObjectives_Reordered"> |
<ItemTemplate> |
<table width="423" border="0" cellpadding="1" cellspacing="1"> |
<tr> |
<td width="2%" align="center" valign="top"><img src="images/iconTopicItems.png" alt="" width="16" height="16" hspace="2" /></td> |
<td width="98%" valign="top"><strong><%# DataBinder.Eval(Container, "Text")%></strong><br /> |
<%# DataBinder.Eval(Container, "Attributes['Topic']")%> - <%# DataBinder.Eval(Container, "Attributes['Category']")%></td> |
</tr> |
</table> |
</ItemTemplate> |
<EmptyMessageTemplate> |
No Objectives Found |
</EmptyMessageTemplate> |
</telerik:RadListBox> |
When I try to run this, the Objective name shows up as it is supposed to, but the TopicName and CategoryName don't display in the list (it is empty in those areas). I have this in my codebehind:
protected void listObjectives_ItemDataBound(object sender, Telerik.Web.UI.RadListBoxItemEventArgs e) |
{ |
DataRowView dsObjectivesRow = (DataRowView)e.Item.DataItem; |
e.Item.Attributes.Add("Topic", dsObjectivesRow["TopicName"].ToString()); |
e.Item.Attributes.Add("Category", dsObjectivesRow["CategoryName"].ToString()); |
} |
Can anyone tell me what I'm missing? This is urgent, as it is for a project that is due very soon. Help! :)