Forms Data Controls :: Add Categories To Repeater That Displays List Of Job Postings
Jun 8, 2010
I have a repeater that displays a list of job openings. I now need to modify the repeater and break out the job openings by category.
See below for the existing code for my repeater. I'm not sure how I need to modify my repeater to display the jobs under the appropriate categories.
I've added a new JobsCategory table to the database and added the foreign key relationship between my jobListing table and the jobcategory table.
I've created a new stored procedure to pull the jobs my category:
CREATE PROCEDURE [dbo].[GetJobsByCategory]
@categoryId int
AS
BEGIN
SET NOCOUNT ON
SELECT j.JobID, j.JobTitle, j.URL, j.City, j.State, j.Country, c.CategoryName
FROM ADPJobListing j
INNER JOIN ADPJobCategory c ON j.CategoryID = c.CategoryID
WHERE j.CategoryID = @categoryId
END
In my typed dataset (tableadapter), I'll add a new query to the above stored procedure and finally in my business logic layer, I'll add a new method to call down into my data access layer:
[DataObjectMethod(DataObjectMethodType.Select, false)]
public ADP.JobsDataTable GetJobsByCategory(int categoryId)
{
return this.Adapter.GetJobsByCategory(categoryId);
}
How do I need to modify my repeater to display the jobs by category?
[Code]....
View 1 Replies
Similar Messages:
Feb 11, 2011
Nested Repeater Issue: Each category list gets populated with the same set of date values rather then being populated with the data associated with that category. Trying to Do: Trying to group FAQ's by category and then list them using the repeaters.
The data is queryed though a business logic layer object that makes a call to the data access layer object. The data access layer object uses linq to sql to return data. There are 3 parameters that are passed into the innerDataSource's ObjectDataSource control to populate the nested repeater control (propID, CatID, isVisible).
With the debugger, the correct data is being returned and written to the nested repeater firing from the nested repeater's ItemDataBound event. Once this event is finished, another event fires and runs the FAQRule object again on the business logic layer which re-populates the nested repeater with the same data for each category. I have 2 repeaters, outerRepater (parent) and innerRepeater(child) with 2 ObjectDataSource controls innerDataSource and outerDataSource. See code below : ASP Page:
<asp:Repeater DataSourceID="outterDataSource" EnableViewState="false" runat="server">
<ItemTemplate>
<%# Eval("Description") + " " + this.Property.PropertyName %>
<asp:Repeater EnableViewState="false" runat="server" DataSourceID="innerDataSource">
<HeaderTemplate>
<ul style="width: 500px">
</HeaderTemplate>
<ItemTemplate>
<div><%# Eval("Question") %></div>
<div><p><%# Eval("Answer") %></p></div>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID="innerDataSource"
runat="server"
SelectMethod="FetchFAQSByPrpAndCatID"
TypeName="PropertySite.BusinessRules.FAQRules">
<SelectParameters>......................................
View 3 Replies
Oct 10, 2010
I am stuck at this point "Displaying a dropdown list of Categories with a --None -- Option. I want the gridview control to display 2 dropdown list one in read-only mode and the other in edit mode. When a record is in read-only mode, the dropdownlist's enabled property will be set to false."When it's on a read-only mode, it doesn't display the selected Category. it shows but the "No Category". When i click on edit to edit or change category, it doesn't display the selected category.
The example is given below( I am reading the book Sams Teach yourself ASP.NET 2.0 by Scott Mitchell. page 628)
<asp:Label ID="UserIdValue" runat="server" Visible="False"></asp:Label>
<asp:SqlDataSource ID="picturesDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Pictures] WHERE ([UserId] = @UserId) ORDER BY [UploadedOn] DESC"
DeleteCommand="DELETE FROM [Pictures] WHERE [PictureID] = @PictureID"
InsertCommand="INSERT INTO [Pictures] ([UserId], [CategoryID], [Title], [Description], [UploadedOn]) VALUES (@UserId, @CategoryID, @Title, @Description, @UploadedOn)"
UpdateCommand="UPDATE [Pictures] SET [UserId] = @UserId, [CategoryID] = @CategoryID, [Title] = @Title, [Description] = @Description, [UploadedOn] = @UploadedOn WHERE [PictureID] = @PictureID">
<DeleteParameters>
<asp:Parameter Name="PictureID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="UserId" />
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="UploadedOn" Type="DateTime" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text"/>
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="UserId"/>
<asp:Parameter Name="CategoryID" Type="Int32" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="UploadedOn" Type="DateTime" />
<asp:Parameter Name="PictureID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="categoriesDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [CategoryID], [Name] FROM [Categories] WHERE ([UserId] = @UserId)">
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:SqlDataSource ID="maxPictureIDDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT MAX(PictureID)
FROM Pictures
WHERE UserId = @UserId">
<SelectParameters>
<asp:ControlParameter ControlID="UserIdValue" Name="UserId"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<asp:Label ID="cannotUploadImageMessage" runat="server"
Text="The photo could not be added to your album either because you did not specify a file to upload or the file specified was not a JPEG image with the file extension .JPG"></asp:Label>
<br />
<asp:DetailsView ID="dvPictureInsert" runat="server"
DataSourceID="PicturesDataSource" Height="50px" Width="125px"
AutoGenerateRows="False" CellPadding="4" DataKeyNames="PictureID"
DefaultMode="Insert" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
<CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
<EditRowStyle BackColor="#2461BF" />
<FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
<Fields>
<asp:TemplateField HeaderText="Picture">
<InsertItemTemplate>
<asp:FileUpload ID="imageUpload" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ControlToValidate="imageUpload" Display="Dynamic"
ErrorMessage="There was no file selected" ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Category" SortExpression="CategoryID">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="pictureCategory" DataSourceID="categoriesDataSource"
runat="server" DataTextField="Name" DataValueField="CategoryID"
SelectedValue='<%# Bind("CategoryID") %>'
Visible='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True" Value="">-- Select Category --</asp:ListItem>
</asp:DropDownList>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" Display="Dynamic"
ErrorMessage="you must provide a name for the title"
ValidationGroup="PictureAdd"></asp:RequiredFieldValidator>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Title") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description" SortExpression="Description">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Description") %>'
View 2 Replies
Mar 17, 2011
I built a user control that displays a drop down list of states. I'm using it, but if I try to put it in a listview control, all I get is the frop down with nothing in it.
View 3 Replies
Mar 30, 2012
sample code for datalist to display the categories and forum like used in a aspsnippet forum
View 1 Replies
Jun 4, 2010
I have a ListView inside my UserControl which is showing a list of posts from the table named posts. I've also got a category table which is full of the categories. I then have another table which contains the PostID and the CategoryID so that posts can have multiple categories. I was wondering, in my ListView at the moment I only have a list of the posts but I would like to add, for every post in the listview, the cateogires it is in.
View 12 Replies
Jan 9, 2010
I want to add unlimited categories and sub categories facility, But I couldn't solve it for last two days.
1. DB
CategID,CategName,parentid
Data:
CategID CategName Parent ID
1 Electronics 0 (where 0 means it is main category)
2 TV 1 (Self Join whith the categ id Electronics)
3 Panasonic 2
4 LG 2
5 Toys 0
6 Girls Toys 5
7 Boys Toys 5
8 Criket Related 7
9 Dolls 6
Here I want to display this data in Combo Box like
Electronic
>>TV
>>Panasonic
>>LG
Toys
>>GirlsToys
>>Dolls
>>Boys Toys
>>Criket Realted
View 6 Replies
Jun 8, 2010
assign the address list to a repeater?
[Code]....
[Code]....
View 1 Replies
Jun 14, 2010
I'm doing property booking based project.
I have repeater control for search results.
For every search result I create a dropdown list with 2 month booking overview.
<ddl>
<item value = "1"> January - February </item>
<item value = "2"> February - March </item>
etc.
Then I call function to generate 2 months calendar view, which has two parameters generate(startmonth as Integer, sku as string)
Everything works when I hardcode starmonth as some integer.
I spent all day with no progress on how to pass value. I need a guide. I guess second problem will be to restore changed dropdown values on Postback, but one step at a time.
But what I want to do, to pass selected item value, to function, that would change view for property associated with this dropdown.
View 2 Replies
Dec 31, 2010
I have two model class
Class CustomerMpdel
{
public string Firstname {get;set;}
public string Lastaname {get set;}
}
Class UserModel
{
public int UserID {get; set;}
pulic Customer Customer{get; set;}
}
<% Using(HTMl.BeginForm()) {%>
<%:Html.TextboxFor(a=>a.UserID)%>
<%:Html.TextboxFor(a=>a.Customer.Firstname)%>
<%:Html.TextboxFor(a=>a.Customer.Lastname)%>
<input type="submt"/>
<%}%>
public ActionResult (UserModel user)
{
///gettig user parameter null here
return view();
}
View 4 Replies
Jun 6, 2010
I have a many to many table in my database called PeopleLanguage
PeopleId, pk and Languags pk each go to the own table People and Language
I know make a method call with my objectdatasource GetPeopleByLanguageId
This returns the languages that the selected person speaks and has a select
query also to lanaguageTable to get LanguageName.
I now print out the results in a datalist that is binding to LanguageName.
What i want to do is show the languages in a horizontal format with a comma after each one.
At the moment if there are 3 languages it shows each one on a seperate line / if I make it horizontal
layout I still dont get a comma. Perhaps I can use a repeater?
View 2 Replies
May 22, 2010
I have got the following code:
[Code]....
This should give me the friends of the user currently logged in in the Repeater, but gives me an exception on the runtime that an instance needs to be initialized, can you please suggest a solution...
Also, what should be the value of the NavigateUrl property of a Hyperlink in an ItemTemplate if the url is:
"http://domain.com/viewprofile.aspx?id=" + 'THE UserID property of the current element in the list'
View 3 Replies
Jan 4, 2011
I have a repeater which contains dropdown list in it.
The items in the dropdown list are all the same at fist.
But if i select a item in one dropdown, then the selected item will be deleted in the other dropdown list.
For example A, B, C, D,E are the five items in dropdown list, and repeater has three lines.
If A is selected in the dropdown list in the first line of repeater, then the dropdown list in the other lines will only have four items to select, they are B, C, D, E.
If then D is selected in the dropdown list in the third line of repeater, then the dropdown list in the second line will only have B, C, E to choose.
I can do this in csharp code, how can i do it in .aspx page?
View 4 Replies
Feb 18, 2010
I am attempting to bind a Repeater (but it could be a GridView or ListView) to a list of objects. The List's type is an abstract type, which has two different classes derived from it, both with different properties. Because they have different properties, I cannot just have one ItemTemplate. If I bind a control to a property of one type of class and the other type doesn't have it, it throws an error.
Here's where I'm at:
I cannot use <% if (whatever) { %> some stuff <% } else { %> some other stuff <% } %> because I cannot access the databound item to make the choice based on its type. I cannot use the <%# %> syntax, which lets me use the databound information, because you cannot code logic like if...then...else. I cannot (rather not) call a function and return a string with the code because what I want to render is complex and contains further nested databound controls. Has anyone found an ingenious way of doing if it is this type of object, display these controls, else display these other controls?
View 4 Replies
Sep 4, 2010
i have a data list on my page which displays editorial about the user.
<asp:DataList ID="DataList2" runat="server" DataKeyField="ModelId" DataSourceID="ObjectDataSource3" CellPadding="5" CellSpacing="5" Width="680px" RepeatLayout="Table" RepeatDirection="Horizontal" CssClass="Datalist" >
<ItemTemplate>
<h3 >Introduction:</h3>
<p>
</<asp:Label ID="Label1" runat="server" Text='<%# Eval("Intro") %>' />p>
[code]...
View 1 Replies
Dec 29, 2010
I have a user control (this has a label to display question and a radio button list to show options).
I am using this user control inside a repeater to display all the questions with their options.
In my repeater page I am not able to capture SelectedValue of radio button list.
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
View 4 Replies
Mar 18, 2011
I have a categories table which is set up to allow an infinite number of sub category levels. I would like to mimic the following:It should be clarified that sub categories can have sub categories. E.g. Parent cat -> level 1 -> level 2 -> level 3 etc.My categories table has two columns, CategoryName and ParentID.This list box will be used when assigning the correct category to a product.How can I write this?EditIn response to thedugas I had to modify your answer to work with my situation. I found some errors that needed to be fixed, but below is a final, working solution.
protected void Page_Load(object sender, EventArgs e)
{
using (DataClasses1DataContext db = new DataClasses1DataContext())
[code]...
View 3 Replies
Mar 12, 2010
I am trying to put a list of categories on my shared master page, I have it working by passing my list of categories to the shared master page in a viewdata[] object - Problem I have is I now want to loop through and out put the links to my categories (Which I am doing this)
[Code]....
View 3 Replies
Mar 16, 2010
I have a multilevel Category Table, like so
CategoryID, CategoryName, ParentCategoryID, IsMainCategory
I want to be able to loop through all the categories starting with the Main Categories and then go all the way down for example I could have
[code]...
I wanted to be able to loop through ALL categories in order like above programatically - This is how far I got
[Code]....
But I hit a stumbling block.. I just wanted to check I am tackling this the right way? Or is there something simple I'm missing?
View 2 Replies
Jul 28, 2010
Is there any way to have the gridview page by categories instead of pages. In other words instead of at the bottom having some sort of page numbering scheme there would be categories from a specific column (kind of like a group by in sql) arranged along the bottom and when I would click one it would page to the start of all those matching rows (preferably return all of them rather than just say 10 or 20).
View 1 Replies
Dec 8, 2010
i have one requirement like i want to show all the categories with the subcategories ..
i mean if i have the Sale category it will be heading of the gridview and all sub categories of the Sale category foreign key related subcategories display in that gridview like urls .same way it will show all the categories ..
View 7 Replies
Aug 3, 2010
i need to create a list view that displays items circularly. (that is when the top most item is hiding a new item should appear at the bottom)
View 2 Replies
Sep 2, 2010
i have a problem about listing. i have categories that it is added infinite category,subcategory. Table is like that:
id
ustid
kategori
seviye
i want listing like this:
For example when i click "Arac", the list will become like following:
Araç (category)
Otomobil (subcategory)
Motorsiklet (subcategory)
Then .when i click "Otomobil"
Araç
Otomobil
----Fiat
---Audi
---BMW
when i click "Fiat"
Araç
-Otomobil
--Fiat
---Murat
---Şahin
View 3 Replies
Nov 17, 2010
have some Objects, lets say Employee and Role defined as below and I have defined relationships in my database that gives me a list of objects say employees and thanks to my framework each employee object also has a Role object linked via the RoleIDID, UserName, Password, Email, RoleIDRoleID, RoleNameSo in code I can do something like this
Employee emp = dataService_GetEmployeeByID(1);
string RoleName = emp.Role.RoleName;
Now here is my problemI can bind any object in a repeater and it works fine for the first level in my relationship
For instance <%# Eval("UserName") %>
But I need to be able to show the details for my child objects as well (Role) so something like this (which does not work)
<%# Eval("Role.RoleName") %>
View 2 Replies
Sep 24, 2010
[Code]....
I am getting error of in Foreach loop
[Code]....
How to resolve this situation or any other alternative to cum out of this problem.
View 6 Replies