ADO.NET :: Linq To SQL GroupBy With Nested Repeaters?
Sep 2, 2010
After a few hours of searching I couldn't find a solution to this issue so I figured I'd try a post. I have stored procedure that queries 3 tables and retuns 1 set of results. When I execute the sproc using the following code db.GET_TRAININGS(userID).GroupBy(s=>s.COURSE_TITLE); I get back an IGrouping container where the course title is the key and contains 2 GET_TRAINING_RESULT elements. Then I bind using rptCourses.DataSource=trainings; then databind(),etc.What I'm trying to do is have the parent repeater show the course titles and the nested repeater show the modules for that course for the particular logged in user. Basically trying to turn a flat piece of data into heirchical data.The stored procedure returns the following SQL Columns Course_Title, Module_Path, Module_Name,Sequence. The sproc code is below:
[Code]....
The repeaters look like this of course:
[Code]....
View 3 Replies
Similar Messages:
Sep 24, 2010
In a dataset i m getting values like this
IdApplication ApplicationDesc Permissions
1 User Add
1 User Delete
1 User Update
2 Role Add
2 Role Delete
3 User2 Modify
3 User2 Change
How can i Bind like in nested repeater control
In my Nested repeater control bound i need to Bind the Values like this Formate According Groupwise
User Add Update
Role Add Delete
User2 Modify Change
In the nested repeater control i taken a label in Header Template i need to bind 3 different values Application Desc once User, Role, User2 and in Item Template i had binded the <%# Eval("Application Desc")%> but i am getting like this all permissions in 1 line
Add Update Add Delete Modify Change
View 5 Replies
Oct 8, 2010
I have a page that has 3 nested repeaters. For the first two repeaters, the repeater's ItemDataBound event binds the next lower repeater. This works fine for the data that I have, but causes a large amount of data to load all at once on Page_Load. Is it possible to use collapsible panels with nested repeaters in such a way that the data only loads when the user clicks a particular linkbutton?
View 3 Replies
Feb 14, 2010
[Code]....
I use if(! Page.postback) to fill those two repeaters I want to get the data related to checked checkboxes when using the below code it get only the data of the first checked box how to make it brign all the data
private void Btn_Confirm_Click(object sender, System.EventArgs e)
{
//CheckBox checkedButton = null;
foreach (RepeaterItem item in ParentRepeater.Items)
{
CheckBox control=(CheckBox)item.FindControl("CheckBox1");
if (control.Checked)
{
//checkedButton = control;
foreach(DataRow r in GetInnerData(control.Text).Rows ) // GetInnerData is used to pring datarelated to the selected check box
{
if(r["DESCRIPTION"].ToString() == control.Text)
{
Response.Write(r["DESCRIPTION"].ToString() + r["Date" ].ToString() + r[ "Trx" ].ToString() + r[ "GL" ].ToString() + r["Amount" ].ToString() +"
");
}
}
control.Dispose();
//checkedButton.Dispose();
break;
}
}
}
}
View 2 Replies
Nov 9, 2010
i'm currently developing a news system with comments.And i need a way to retrieve an id of the article in a click handle event so i can add new comments to each articleHere is my code-behind right now
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
[code]...
View 5 Replies
Feb 1, 2010
i did like all instruction in this link
[URL]
but i have a problem,this erer arise "Can not find tabel1"
View 2 Replies
Jan 11, 2011
I have 3 nested repeaters and in my code behind I can't seem to lock onto the second level repeater. I have written code for the third level but I will once I figure out how to get to the second level. My code is written below.
[Code]....
CODE-BEHIND
[Code]....
View 4 Replies
Jun 23, 2010
For the solution, I cannot use any event handling methods, because my webapp is fully ajax based and no complete postback is possible. So here's the problem.I have a `List<WebPage>` that contains a list of Links `(List<Link>)` and I need for all the links to bind repetitive information such as page title, id, url. Here is my current repeater.
<div id="result">
<asp:Repeater runat="server" id="results">
<Itemtemplate> [code]....
View 1 Replies
Apr 30, 2010
I am using nested repeaters and wanted to access a value from my parent repeater within the child...is this possible?
View 3 Replies
Mar 11, 2010
We say that "GroupBy" and "OrderBy" methods from LINQ as Extension Methods.Then how about "variable.ToString()" and "string.Split()" menthods. Are these Extension methods.
View 2 Replies
Jan 2, 2011
I use Visual Studio 2010 and MS SQL Express edition. .NET 4.0
Database model is very simple. I have articles and each articles has a category. Simple relationship 1 category many articles.
So to take all articles I use code:
[Code]....
and it's automatically loads Category reference and all Category references to. So it's looks like it's load all nested fields automatically. How I can deny this?
I was thinking that I should use .Include("Category"), but it seems that it's don't needed.Problem is that when I try to send it it's throw an exception:
The maximum read depth (32) has been exceeded because XML data being read has more levels of nesting than is allowed by the quota.
var tt = from a in PE.Articles
View 2 Replies
Nov 4, 2010
I am looking for a way to groupby a listbox. I get some of my listitems from the database with this linq query:
[Code]....
But i tried to make it here groupby but cant seem to get it work. It must groupby for : product.Vendor
Here is the listbox code:
[Code]....
If anyone know the answer for this i would be very happy. Also here is screenshot for what i want to do:
The "Wrong" part is what i get now, but i want it like the "Good" part.
View 3 Replies
Jan 6, 2010
I can select IQueryable<object-type> data fine from a data repository class and push it into a list type MVC view, but how do I do this and group that data - I don't seem to be able to find any examples on this.
View 9 Replies
Mar 26, 2010
I'm using a linq group by query (with two grouping parameters) and would like to use the resulting data in a nested repeater.
var dateGroups = from row in data.AsEnumerable()
group row by new { StartDate = row["StartDate"], EndDate = row["EndDate"] };
"data" is a DataTable from an SqlDataAdapter-filled DataSet. "dateGroups" is used in the parent repeater, and I can access the group keys using Eval("key.StartDate") and Eval("key.EndDate").
Since dateGroups actually contains all the data rows grouped neatly by Start/End date, I'd like to access those rows to display the data in a child repeater. To what would I set the child repeater's DataSource? I have tried every expression in markup I could think of; I think the problem is that I'm trying to access an anonymous member (and I don't know how.) In case it doesn't turn out to be obvious, what would be the expression to access the elements in each iteration of the child repeater? Is there an expression that would let me set the DataSource in the markup, or will it have to be in the codebehind on some event in the parent repeater?
View 3 Replies
Jan 6, 2010
on the aspx:
[code]....
The problem here is that instead of using Two repeaters, can we use only one?
We actually need the header to be separated from the contents using a different table row...
Edit: changed rptHeader's ItemTemplate's html element from <td> to <th> to be a little clearer.
View 4 Replies
Mar 1, 2011
But I have multiple repeaters in my asp application I wonder how I can make some things common like footer..
And How can I create events for my repeater? Like a button in the footer who raise an Custom event?
View 2 Replies
Dec 14, 2010
I am trying to bind data into a dropdown list from c#. I am getting a Null error when trying to enter the data into the DDL's. I am using this code for the front end.
<asp:Repeater ID="RepeaterHardDrives" runat="server">
<HeaderTemplate>
<table border="0" cellpadding="0" cellspacing="0" width="100%"> [code]...
and last but not least the function to setup the dynamic amount of DDL's looks like this
private void PreloadHardDriveRepeater(int intSupportedDrives)
{
int[] intArrDisks = new int[intSupportedDrives];[code]...
I am calling a list of populate functions in a !page.isPostBack if statement and the only one that is not getting the data is this one with the Drown Lists. It gets the number of Rows(18) from the database, but it it throwing a Null error(Object reference not set to an instance of an object.) I have seen quite a few people have been running into this error while googling the problem, however I could not find a solution that worked for me. The PreloadHardDriveRepeater function seems to work fine when run alone it loads the correct amount of DDL's onto the page.
View 1 Replies
Jan 4, 2010
I need to know the best way to do the following. I have nested business level APIs (say level 1 & level 2). L1 needs to call L2. Both APIs use the database layer directly at their own nesting levels.
Now, in the database layer, I fetch the db connection from the pool each time as follows:
SqlConnection conn = new SqlConnection(connString);
conn.Open();
Is it proper to fetch the db connection each time on every DB level call as above? I know it will return a connection from the ASP.NET connection pool. However, wouldn't it be better to maintain the same DB connection throughout the nested calls (or throughout the current http request lifetime)? Will fetching a connection from the pool each time cause issues with nested TransactionScopes?
View 1 Replies
Jun 17, 2010
Is there a better, cleaner way to do this in ASP.NET 2.0?
An ASP.NET 2.0 page displays a datalist of records. Each record can have many dates, so the dates are in a nested gridview (I chose a gridview over a datalist here because we want to be able to delete a date and this is easier done in a gridview). The parent record can never be deleted.
The display works fine: the nested gridview gets its datasource during the parent datalist's OnItemDataBound event.
The problem: the nested gridview's delete function. The date gets deleted without a problem (handled in the OnRowDeleting event), but somehow the redisplay is untying all the other nested gridviews from their datasources. The delete does not appear to cause a page postback, so I don't know how the other nested gridviews are losing their datasources.
View 3 Replies
Oct 1, 2010
I am trying to create a simple menu system using repeaters. In the system I want to use a different formatting for class sub items and am trying to use an If that checks the DataBinders results and branches if its "Classes" but when I compile the code is says:
Name "Container" not declared.
On all the tutorials online and MSDN the Container.DataItem is just assumed to work so i can't find any information on it not working. Can anyone who uses databinders more than me explain this?
<asp:Repeater ID="TopNavRepeat" runat="server" DataSourceID="SqlDataSource1" >
<HeaderTemplate>
<ul id="nav">
</HeaderTemplate>
<ItemTemplate>
<li>
<asp:HiddenField ID="LinkIdField1" Value='<%# Eval("id") %>' runat="server"
OnDataBinding="LinkIdField_ValueChanged" OnValueChanged="LinkIdField_ValueChanged"/>
<asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("Title") %>' NavigateUrl='<%# Eval("Url") %>'
ToolTip='<%# Eval("Description") %>'>
</asp:HyperLink>
<ul>
<!-- -->
<% If (CStr(DataBinder.Eval(Container.DataItem, "Title")) = "Classes")THEN %>
<asp:Repeater ID="ClassDownList" runat="server" DataSourceID="ClassDS">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<li><asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("name") %>' NavigateUrl='<%# "/Class/" & helpers.urlSafe(CStr(Eval("name"))) %>'
ToolTip='<%# CStr(Eval("name")) & " home page" %>' /></li>
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:Repeater>
<% Else %>
<asp:Repeater ID="DropDownList" runat="server" OnLoad="ChildDataList_Init">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<li><asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("Title") %>' NavigateUrl='<%# Eval("Url") %>'
ToolTip='<%# Eval("Description") %>' /></li>
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:Repeater>
<%End If %>
</ul>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
View 2 Replies
Mar 3, 2010
I have a table with articles. Every article has a column named category which value is either 1 or 2 On my landingpage the article headers are displayed as hyperlinks. All the articles with category 1 will be displayed in a repeater control on the left side of page and all the articles with category 2 will be displayed in another repeater control on right side of page. I know I can bind the repeaters to two different sqldatasource controls with different SELECT statements. But I wonder if I can do this by only using one sqldatasource control, and if this is better and proper way of doing it. If so, do I create a (datatable?) and do the sorting there?
View 5 Replies
Jun 3, 2010
I realise that there are many posts on update panels and repeaters but none that quite solve my problem. I have a page with two Repeaters each inside seperate update panels. They sit next to each other one on the left and one on the right. The left repeater is filled from my database on my page load event. Im am storing the data in a List<> and then binding the list to the repeater. This works correctly and displays all my results. Each item in the left repeat has a button aswell. The button needs toremove the data from the left repeater and place it in the right repeater. I only want the database to be accessed in the Page_Load and then never again during the use of the page, until the data is saved (I have not got to this feature yet). So I have decided to use List<> objects.
View 6 Replies
Aug 13, 2010
I have one repeater control with check boxes in one of the page.My requirement is i have to pass the values of the row that i have checked (multiple check boxes can be selected at a time) when i click on a add button in the same page which is placed outside the repeater control.and, i want the details of the rows that i have selected to populate in another repeater control placed in a different page. how to do this using query string??
View 2 Replies
Jan 22, 2011
I have a web app for our golf club. When I compute handicap index for each golfer, I have to select the most recent scores and then a subset of those scores depending on how many rounds of golf the golfer has played. All the scores are entered into a single SQL Express table called "Rounds". Verbally, this is what I'm trying to do:
1) select the twenty most recent golf scores (sort on date descending, "take(20)") [if less than 20 records, then select all available];
2) for this set of records, select the 10 lowest scores (or smaller number if golfer has less than 20 rounds);
3) compute the average round differential for the subset of records, etc. to calculate handicap index (this step is working ok...)
My current VB code has this LINQ query (which is flawed -- it selects the lowest handicap differential scores of ALL records for the filtered user):
[Code]....
How do I modify this query to accomplish items 1) & 2) above? It seems this should be simple, but my experience with queries is still limited.
View 2 Replies
Mar 18, 2011
I have a set of records that will go into a repeater, however, the query being used has a grouping on it and i need to apply this to the repeater i.e.
GROUP NAME
Record 1
Record 3
GROUP NAME
Record 2
Can this be done?
View 7 Replies