Using Nested Query To Display Document List?

Apr 28, 2010

I using the two tables below to create a list of category titles containing document links so it looks like this:

documentCategoryName
documenttitle
documenttitle
documentCategoryName
documenttitle
documenttitle

Here are my tables:

documents table
documentID int Unchecked
documentName nvarchar(MAX) Checked
documentCat int Checked
documentDescription ntext Checked
documentType nvarchar(MAX) Checked
documentSiteID int Checked
Document category
documentCategoryId int Unchecked
documentCategoryName nvarchar(MAX) Checked

To do this I'm using a nested query which involves alot of code.

all my page code is below:

[Code]....

View 2 Replies


Similar Messages:

Forms Data Controls :: Using A Nested Listview To Display A Seperate Grid For Each Group Of Data Returned From Db Query

Jan 13, 2011

I am using a nested listview to display a seperate grid for each group of data returned from my db query. To get this working, I have adapted a piece of code to group the data prior to it being bound:

[Code]....

I am then using the following html markup:

[Code]....

[Code]....

This works as I want it to however some of the fields within the nested table need to be formatted as currency so I am trying to use Eval and {0:c} to do this however the moment I use Eval, the data items cannot be found

DataBinding: 'System.Data.DataRow' does not contain a property with the name '0'.

View 4 Replies

ADO.NET :: LINQ Entity Framework Query - Construct "nested" Query?

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

Gridview - Query Regarding The Nested Grid Views In C#

Mar 31, 2011

I have defined a nested grid view in the following way.

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" OnRowDataBound="GridView1_RowDataBound" GridLines="None">
<Columns>
<asp:BoundField DataField="Date Of Transaction" HeaderText="Date Of Transaction"
SortExpression="Date Of Transaction" />
<asp:BoundField DataField="Invoice Number" HeaderText="Invoice Number" SortExpression="Invoice Number" />
<asp:BoundField DataField="totalAmount" HeaderText="totalAmount" ReadOnly="True"
SortExpression="totalAmount" />
<asp:TemplateField>
<ItemTemplate>
<asp:GridView ID="gridView2" runat="server" HorizontalAlign="Left" ShowHeader="false" GridLines="None" OnRowDataBound="gridView2_RowDataBound">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<ItemTemplate>
<asp:Button ID="Btn1" runat="server" Text="Download" OnClick="Btn1_Click"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ComponentDBConnectionString %>"
SelectCommand="SelectUserPreviousHistory" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter DefaultValue="XYZZ" Name="userName" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

The screenshot of the output is here. As you can see i have a "Download" button in each row of the child gridview (i.e., gridView2) but I want the download button to be last column but .net is rendering it to be the first column. How can I do it? More over gridview2 datasource is arraylist. Here is the code

gridView2.DataSource = titlesArrayList;
gridView2.DataBind();

View 2 Replies

Linq Query - How To Select Inner Query Into List

Oct 17, 2010

I am writing a linq query to select a blogpost,

[code]....

The blogpost i am testing got 3 tags attached to it. The table structure is:

(table)BlogPost -> (table)BlogPostTags <- (table)Tags

So the BlogPostTags table only contains 2 fields, BlogPostID and TagID.

When i run the query above i get 3 results back. Same blogpost 3 times but with 1 tag in each. It should return 1 post with 3 tags. The problem lies in the Tags query above.

View 1 Replies

DataSource Controls :: Use Nested Query In Objectdatasource.FilterExpression?

Jan 30, 2010

I was wondering if I could use something like :

ObjectDataSource1.FilterExpression = " (ID in (Select ID from TablewithIDs where User = '{0}')) "

I am getting this error:

Syntax error: Missing operand after 'ID' operator.

View 1 Replies

SQL Server :: Query Slow In Loading / Trying To Display Query Result?

Feb 1, 2011

I am trying to display this query result in an aspx page.

It is very slow in loading. Here is the query. The inner query inside the outer quesry is the problem.(Please see the underlined part in the query) - (If I remove that part it is very fast.)

select

top 500

--This column is the issue
,Governing_Class=( case when exists (select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.appid and tqc.class_code not in('8742' ,'8810','7380')
order by tqcm.premium_amt desc
)
then ( select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.
appid
order by tqcm.premium_amt desc
)
......... From tables

View 7 Replies

Entity Framework CTP5 - Code First - Nested Query Error

Jan 3, 2011

I have the following classes:

public class Category
{
public int CategoryId { get; set; }
public string Name { get; set; }
}
public partial class CategoryMap : EntityTypeConfiguration<Category>
{
public CategoryMap()
{
this.HasKey(c => c.CategoryId);
this.Property(c => c.Name).IsRequired().HasMaxLength(400);
}
}
public class MyObjectContext : DbContext
{
public MyObjectContext(string connectionStringName)
: base(connectionStringName)
{
}
public DbSet<Category> Categories { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new CategoryMap());
base.OnModelCreating(modelBuilder);
}
}

Now when I run the following code I get an exception (GenericArguments[0], 'System.Int32', on 'System.Data.Entity.Internal.Linq.ReplacementDbQueryWrapper`1[TEntity]' violates the constraint of type 'TEntity')

DbDatabase.SetInitializer<MyObjectContext>(new DropCreateDatabaseIfModelChanges<MyObjectContext>());
using (var context = new MyObjectContext("NopSqlConnection"))
{
var query1 = from c in context.Categories
select c.CategoryId;
var test1 = query1.ToList(); //works fine
var query2 = from c in context.Categories
where query1.Contains(c.CategoryId)
orderby c.Name descending
select c;
var test2 = query2.ToList(); //throws the exception
}

View 1 Replies

DataSource Controls :: Repeating A Nested (or Sub) Query For Multiple Categories?

Jul 10, 2010

I'm trying to design a page that displays all suppliers by their location. I'd quite like this to work from a query that will automatically include new locations added in the future.

At the moment my design has a table that holds 'locations' with locationID and locationName fields. In my 'suppliers' table I also have a locationID to join them.

I'm not sure how to query the database to return all the suppliers in location 1, then all in location 2. (Or even sure of the terms I need to Google to get some examples!) For example:

Location 1
Supplier 1
Supplier 2
Location 2
Supplier 3
Supplier 4

View 3 Replies

List Of Grouped (nested) Checkboxes?

Mar 11, 2011

I want to create List of Grouped Checkboxes as follows:

[]Group1
[] Item1
[] Item2
[]Group2
[]Item1
[]Item2
[]Item3

Here Group# and item# are checkboxes. Does anyone know how to do this in asp.net. I am getting data from DataSet. One limitation is that I am not allowed to use third party tool/controls or jQuery.

View 1 Replies

List Nested Gridview - Filled And Displayed

Jun 28, 2010

I have a listview with a nested gridview. I'm having trouble accessing the gridview. I want the gridview to be filled and displayed when a linkbutton is clicked on the listview. I use FindControl to get linkbutton - but cannot get it to work for the nested gridview. I have gridview working outside the listview, but it fails when nested.
Snippet:

asp.net Code:
<asp:ListView> ...............
<SelectedItemTemplate>
<tr >
<td>
<asp:Label ID="BuildingLabel" runat="server" Text='<%# Eval("Building") %>' CommandName="Select"/>
</td>
<td>
<asp:Label ID="AreaOccupied_m2Label" runat="server"
Text='<%# Eval("[AreaOccupied m2]") %>' />
</td>
</tr>
<tr><td colspan = "2">
</td> </tr>
<tr><td colspan = "2"> <asp:Panel ID="pnlInnerGrid" runat="server">
<asp:GridView ID="GridViewBlocksInner" runat="server">
</asp:GridView>
</asp:Panel></td></tr>
</SelectedItemTemplate>
</asp:ListView>
'Code Behind:
Protected Sub ListViewBuildings_SelectedIndexChanging(ByVal sender As Object, ByVal e As ListViewSelectEventArgs)
'FindControl for linkbutton Works
Dim item As ListViewItem = CType(ListViewBuildings.Items(e.NewSelectedIndex), ListViewItem)
Dim l As LinkButton = CType(item.FindControl("BuildingLabel"), LinkButton)
'FindControl for gridview Does Not Work
Dim gitem As ListViewItem = CType(ListViewBuildings.Items(e.NewSelectedIndex), ListViewItem)
Dim gv As GridView = CType(item.FindControl("GridViewBlocksInner"), GridView)
Try
dsBlocks = SqlHelper.ExecuteDataset( _
DBConnectionString, CommandType.StoredProcedure, _
"procName", New SqlParameter("@Site", strSite))
'Next line gives Error:
gv.DataSource = dsBlocks
gv.DataBind()
Catch ex As Exception
lblMessage.Text = lblMessage.Text & " Error: " + ex.ToString
End Try

View 6 Replies

C# - List View And Inside Listview Like Nested

Feb 24, 2011

i have list view and inside lisetview i have another list vie like nested listview
lv1 --> lv2 and inside lv2 i have button when i'll click buttion than insert template show but how can fine control lv2 ....? there is my code Lv1 is working but lv2 is creating problem..?

protected void lv1_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "NewRecord")
{
lv1.InsertItemPosition = InsertItemPosition.FirstItem;
}
}
protected void lv2_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "NewRecord")
{
//ListView lv2 = (ListView)e.Item.FindControl("lv2");
//lv2.InsertItemPosition = InsertItemPosition.FirstItem;
}
}

View 2 Replies

Display The PDF Document In Webpage?

Mar 13, 2010

how can i add a sticky notes in my asp.net webpages.... i have a requirement where i need to display the PDF document in my webpage ... and i need to add the sticky notes to that pdf document... can any one guide me .... about how to start to achieve this....

View 5 Replies

Web Forms :: Error - Could Not Contact Sharepoint Server For List Of Document Libraries

Feb 15, 2011

I am creating one new silverlight webpart from VS Sharepoint 2010. If i am creating the silverlight application its asking for the sharepoint local site url, i gave the valid url but its showing the ["could not contact sharepoint server for list of document libraries. check your sharepoint URl"].

how to resolve this error.

View 1 Replies

How To Display Document Content On Webpage

May 12, 2010

How to display document(xls,doc,pdf) dirctely on the web page. send the related links also..

View 5 Replies

How To Read And Display Word Document

Apr 8, 2010

I have a file up-loader by which i upload the .doc file in a folder on server.]

I want to display the whole word document content on a label as it is in .doc file in C#.

View 2 Replies

SQL Server :: How To Display The Word Document

Aug 10, 2010

how to display the word document which is binary document which is stored in database?

View 2 Replies

Display Uploaded Document From Database

Oct 10, 2010

I have a MVC 2 web application. The website captures grant applications for loans. With each application I can upload documents. The way that we upload documents to the database is as follows:

private IEnumerable<byte> GetStreamByteArrayData(Stream stream)
{
byte[] buffer = new byte[8192];
int bytesRead = 0;
while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
{
for (int byteIndex = 0; byteIndex < bytesRead; byteIndex++)
{
yield return buffer[byteIndex];
}
}
}

The calling method looks like this:

Convert.ToBase64String(GetStreamByteArrayData(hpf.InputStream).ToArray());

In my grid that displays the uploaded documents I have the document name, mime type and so forth. What I am trying to do is to have the name of the document in a link. When the link is clicked then the document is opened. I have no idea how to do this in an MVC app. Can someone provide some sample source code?

View 2 Replies

Forms Data Controls :: Nested Listview Inner List Not Displaying?

Jan 10, 2011

I have two listviews. The inner listview (InnerListView1) is in the SelecttItemTemplate of the outer listview (OuterListView1). Both listviews are bind in the code behind. The outer listview displays correctly in the ItemTemplate. Neither Listview Listview displays in the SelectItemTemplate. Both should display when I click the Select button. I just get a postback (flicker). The display should include the selected record of the outer listview and the inner listview.

Shown be low are code snipets of the.

Markup:
<asp:ListView ID="OuterListView1" DataKeyNames="entryid" runat="server" EnableViewState="False" EnableModelValidation="True" InsertItemPosition="LastItem" OnItemDataBound="OuterListView1_ItemDataBound" OnSelectedIndexChanging="OuterListView1_OnSelectedIndexChanging"
>

[Code]....

View 5 Replies

Web Forms :: Display MS Word Document In HTML Via ASP?

May 18, 2010

I have never used ASP before!I have a server which has a shared folder where all quotes for our small business are saved.I have setup a HTTPs website with authentication, which then allows you to browse the folder contents as HTML. If you WORD installed on your machine you can download and open. No need to be able to save or anything - it is for viewing only.

The trouble I have is that every now again you are on a site where you cannot open the document as there is no software to do so. I would like to be able to display the WORD doc in a web browser.I have googled and it seems it is possible, but I am struggling with a result.All I want to do is view the WORD document in an HTML page. It could even be just the text less the formatting and header/footer if this was easier to achieve.Running MS Server 2003 SBS, and currently still using MS Office 2000!

View 2 Replies

Display The Upload Document Content To Webpage?

May 12, 2010

Actually i want code of when user upload his document, its automatically generate all the content of document to display in the web page.. and all the code belongs to c#,javascript,jquery

View 1 Replies

Controls :: Display Word Document On Webpage?

Dec 27, 2013

How Can i Show the resume on web page after uploading the resume .......

View 1 Replies

Forms Data Controls :: List Box Nested In Listview Control Selection

Jul 5, 2010

I have a list box in a list view control. I want to access the value of the listbox. I have fixed the height of the list box and the box has scroll bars. If i change the number using the scrollbar and then click on the number (turning it blue) everthing works fine. If I simply change the number using the scrollbar the system throws the error below. Can anyone tell me how to get this to work simply by using the scrollbar to select the number (without having to also click on the number itself) This is the error that is thrown

[FormatException: ??????????????????]
Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
+201
Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +66
[InvalidCastException: String "" ??? 'Integer' ??????????]
This is the aspx listbox
<td><asp:label id="Label1" runat="server" text='<%# eval("CustomerID") %>'></asp:label></td>
<td><asp:label id="label2" runat="server" text='<%# eval("ProductID") %>'></asp:label></td>
<td>
<asp:ListBox ID="ListBox1" runat="server" Height="30px">
<asp:ListItem Value="0">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
</asp:ListBox>
</td>
<td>$<asp:label id="label4" runat="server" text='<%# eval("OrderDate") %>'></asp:label></td>
<td>
<asp:Button ID="Button1" runat="server" Text="order" CommandName="cart"
CommandArgument='<%# eval("CustomerID")%>'/></td>
This is the vb page
Partial Class Droplist
Inherits System.Web.UI.Page
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim db As New DataClassesDataContext
ListView1.DataSource = db.Droplist1
ListView1.DataBind()
End If
End Sub
Sub upload(ByVal sender As Object, ByVal e As ListViewCommandEventArgs)
If e.CommandName = "cart" Then
Dim q As ListBox = e.Item.FindControl("Listbox1")
Dim ProductNumber As Integer = CType(q.SelectedValue, Integer)
Label3.Text = ProductNumber
End If
End Sub
End Class

View 4 Replies

AJAX :: Display Cascading Dropdown List Based On Checkbox List Selected Value

Nov 10, 2010

How can i generate dropdown lists based on what has been selected in the checckbox list. Below is an example of what i need. if the user selects the options day, lotID and waferID, then 3 cascading dropdown lists should be displayed. And then a gridview displays data based on what has been chosen in the dropdown lists.

Day
LotID
SlotID
WaferID
VendorID
ToolID
LocationDetected
ProcessStep
Stage
Precipe
WaferStartMaterial
WaferStartVendor
WaferStartLot
WaferDiameterCOA
WaferMapTitle
BreakPoint
BreakpointSide
BreakpointMeasurement

View 3 Replies

Javascript - MVC List With JQuery - Links - View To Display A List Of Products

Nov 5, 2010

I am using a strongly-typed view to display a list of products, where every li-element gets a unique id:

<ul id="product-list">
<% foreach (var item in Model.Products)
{ %>
<li <%= "id="product_" + item.Id + """ %> >
<div class="item">
<%= item.Name %>
</div>
</li>
<% } %>
</ul>

Now I want to attach to the click-event of every single li-element, so that if the user clicks on a div-element, detailed product-informationen should be loaded asynchronously into a details-pane. I know how I can use jQuery to invoke an action-method ajax-style and also how to display the json-result which contains the product-details, BUT I have no idea, how I could attach the onclick-event to every single div, so that I can use the productId to load the details.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved