Create A SortedList That Holds Multiple Variables?

Feb 27, 2011

How do I create a SortedList that holds multiple variables? I want to keep multiple instances of (date, height, weight).

View 2 Replies


Similar Messages:

Databases :: SQL - Create A Variable That Holds The Value For Each Row Of The Timestamp?

Feb 8, 2010

I'm making a simple forum using MySQL and I use a repeater to display a list of all threads in it. I have two tables for posts, one for threads and one for replies, and I want to sort the threads by either when they were posted or when the last reply was posted in it. My SQL query is really long and hard to read so here's some psuedo code similar to it (easier to understand these column names, etc):

SELECT

threads.id,
threads.title,
threads.timestamp,
users.username,
(SELECT COUNT(*) FROM replies WHERE thread_id = threads.id) AS number_of_replies,
(SELECT COUNT(*) FROM views WHERE thread_id = threads.id) AS number_of_views,
(SELECT timestamp FROM replies WHERE thread_id = threads.id ORDER BY timestamp DESC LIMIT 1) AS last_reply_timestamp
FROM threads
LEFT JOIN users
ON threads.user_id = users.id
ORDER BY ************** DESC

What I do here is I fetch the values id, title, timestamp, the author's username, the number of replies and views for a specific thread, and I also get the timestamp for the last reply to this thread.

Then, what I want to do is sort the whole list so that the threads are displayed in an order matching when either it was posted or the last reply was posted in it (you know, like a normal forum) but I'm not sure how to accomplish this.

I tried this:

ORDER BY CASE WHEN last_reply_timestamp > threads.timestamp THEN last_reply_timestamp ELSE threads.timestamp END DESC

but that, I guess, maybe only looks at the first row and determines which one should be used so the order is not correct.

I'm not sure if it's possible to create a sort of variable that holds the value for each row of the timestamp that applies, if that's possible you could sort by that. For example:

(CASE WHEN last_reply_timestamp > threads.timestamp THEN last_reply_timestamp ELSE threads.timestamp END) AS last_activity_timestamp

...

ORDER BY last_activity_timestamp DESC

So each row has a field "last_activity_timestamp" containing either timestamp, whichever is the later than the other.

Can this be done somehow? How does everyone else solve this? It's so hard to search google because I just get lots of forums but no code.

View 6 Replies

Forms Data Controls :: Create Datagrid Row That Spans Columns And Holds Form Controls?

Mar 18, 2011

Here is the situation:I have a Datagrid which is going to display a number of rows. I want to click a button on the datagrid and have the following occur

open a row underneath the row clicked, without hiding or replacing that row Open this row so that it spans all of the columns as one continuous row where i can put form fields and/or just data formatted as I would like and not just in columns.Be able to close that new row. While I do most of my work in VB.NET, don't think that is a requirement for answering this.I have managed to currently take the first column (with the "Edit" button) and when clicked to
Hide the rest of the cells in that row Expand the button column to run all the way across the table Unfortunately I loose the clicked row's data, and I've only started getting this to work so I haven't tried too much, or getting data to bind to fields "on the fly"

View 9 Replies

C# - How To Create Create Variables / Properties In Master Page And Let Sub-pages Access Them

Apr 14, 2010

How to create create variables/properties in master page, and let sub-pages access them? So my master will have a string property HomeUrl How can any page that uses the master page access this property?

View 2 Replies

Best Approach To Implement Reusable SortedList?

May 8, 2010

I have a situation where I need to maintain a large number of related integer values in my ASP.Net 3.5 application. The SortedList seems perfect for this purpose. If this were a Windows app I'd just create a class and setup one method to Set values within the SortedList and another one to Get values out of it.

But being a web app, I'm not entirely sure of the best approach to use. Sure, I could just create one method for Set and another for Get but that doesn't seem very "clean".I thought about creating a UserControl without any visual elements but am not sure if that makes sense.How would you go about implementing such a SortedList in your web app?

View 7 Replies

State Management :: Get An Item From SortedList?

Jan 11, 2011

I have an object of Product and it contains a double of "price" and string of "name".

Then I put each Product object into a sortedlist

Then I put the sortedlist into session state.

How do I then retrieve the "price" and "name" from Session state?

View 2 Replies

Passing Multiple Variables Between Pages?

Mar 25, 2011

I am trying to pass multiple variables between pages....

Page1.aspx (sending page)
Dim StrValue1 As String
Dim StrValue2 As String
StrValue1='ASSIGN A VALUE......

This does not work correctly. Page2.aspx is recieveing Value1 correctly but not Value2. I dont think I have the correct syntax...

Have tried the redirect with an ampersand in the middle but that does not work either...

Response.Redirect("Page2.aspx?Value1=" & Value1 & "&?Value2=" & Value2)

View 4 Replies

C# - Split And Strip Into Multiple Variables?

Mar 9, 2010

How to Split and strip X string values into separate variables? X has string value of

itemA=myvalue&itemB=anothervalue&itemC=andanother

I have 3 strings (var1,var2,var3) to hold the values of the stripped values. Find in string X "itemA=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var1) Find in string X "itemB=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var2)

Find in string X "itemB=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var3)

View 4 Replies

Can ComboBoxItem Holds Object Value

Feb 17, 2011

From my experience in silverlight, their comboBoxItem can holds object data, so I can do like ComboBox.selectedItem and cast to the data object type and get the databinding object out. But in Asp.Net, the ComboBoxItem seems like only have Text and Value property for databinding. I wonder if there is a way that I can get the databinding object out? Not with searching the datasource and find the object by Text and Value...

View 1 Replies

Static Variables To Be Accessed Across Multiple Instances

Feb 17, 2010

is there any way to stop share the static variable at multiple users....I need to create a new insatnce of static variables or not accessing the same static variables across multiple who are using the same site.....while googling i found like hisSystem.Threading.Interlocked.Increment(ref MyClass.InstanceCounter); by using can I do....or is there any other way to stop accessing the static variables accross multiple instances of my site......and in my scenario i cannot use rely on session variable also

View 2 Replies

Filtering Data On A Gridview That Takes Sortedlist As Datasource

Jun 4, 2010

I have a gridview that takes in values from a sortedlist. I want to filter those values before putting them in the gridview without taking values out of the list.

Is there an easy way to do this? Or do I have to redirect the data through another list and point the gridview to it?

View 1 Replies

SQL Server :: Assign Multiple Variables In A Single Select?

Feb 4, 2011

I am using MS SQL Server 2005 & here is my problem: I need to assign values to the multiple variables in a single select. But each value is depend on the certain value of the other column of the table.

declare @i1 Int, @i2 Int, @i3 Int;
select
case Table.column1
when 'red' then @i1 = Table.column2
when 'green' then @i2 = Table.column2
when 'blue' then @i3 = Table.column2
end
from
dbo.Table

how to achieve this in a single select?

View 3 Replies

State Management :: Session Variables And Multiple Sites?

Apr 20, 2010

i have 2 different sites under different subdomains.

www.company.com

and e-order.company.com

i want to have SSO so i have tried to make a global cookie.

my question is :does the global cookie keeps the session variables when i am going from one site to another?

if not how can i pass a session variable for ex. session("userName") from one site to the other on redirect?

View 4 Replies

Web Forms :: Session Variables Are Accessible To Multiple Users?

Oct 8, 2010

I have an asp.net website in which users can submit reports. Another tester and I tested this page at the same time and when I went to review the information I submitted, it displayed information that I didn't submit. It displayed the info submitted from the other user.

I use session variables for these values. I don't understand how this happened? What can I do so each user can individually submit their information without overlapping some one else's information? The plan is for multiple users to be able to use this page to submit their weekly layer reports.

The first example of code is how I add the session variables from the textboxes.

[Code]....

The second one is how I display them in labels on a confirmation page.

[Code]....

View 16 Replies

Architecture :: Configuration Variables To Support Multiple DLL And Web Solutions?

Jun 24, 2010

I'm designing a framework solution DLL with reusable code that I like to use for many different projects,

I want this DLL to be able to load unknown configuration variables dynamically based on the solution its running from.

I like to load my config variables like this: MyConfig.MyVariableX

Hopefully I can also to validate my variables when the web application loads (by type) and make sure it's not missing(otherwise Throw New ApplicationException("Missing..."))

It would also be nice if I can have intellisense on these variables

I want solution A (web application) to have the configuration variables and solution B (DLL) to load the variables from the configuration file in solution A

I'm thinking maybe I should create a database table to hold the variables with types and stuff...

What would be the best way to do it ?

How can I read unknown list of variables names and values from a config file and populate my class with it on runtime ?

View 3 Replies

Forms Data Controls :: Delete From A SortedList Using Listview Control?

Aug 30, 2010

I'm new to Asp.net, and I looked at an example of using a listbox's selected index to delete from a sortedlist. I'd like to write somethingthat would get the selected index from a different control, like a listview, and then delete from the sortedlist. I've read up on a few examples on how to bind data from a sortedlist to a listview, but I've not seen an example of how to get the index once the data is displayed! Can this be done?

View 3 Replies

Web Forms :: Response.Redirect Holds Other Pages From Loading?

Oct 1, 2010

I've got a form with a button on it. You have to be logged in to see this form. I use this code to check if the user is logged in and act appropriatley.

Dim isLoggedIn As Boolean = CType(Session("LoggedIn"), Boolean)
If isLoggedIn = False Then
Response.Redirect("Login.aspx")
End If

The button runs a report that takes anywhere from 0.5 to 20 seconds. For testing it just sleeps for 10 seconds.

Threading.Thread.Sleep(10000)

The problem is this. Say User1 comes to the form, logs in and runs the report. If User2 comes to the form, the page will not load until User1's report is done.

Now, the bonus is if I comment out the response.redirect line, everything works fine. But if that line is in there I will get this problem.

View 12 Replies

Forms Data Controls :: Compare Sortedlist Object Property Changes And Update Value?

Oct 30, 2010

i have a sortedlist who values contain a Product objects. i wish to set the Quantity property of a selected Product object ( from gridview) when the Quantity field changes?

how do i compare whether the product row Quantity field in the gridview is the same as the Product Quantity property in the sortedlist and update accordingly?

note. i have converted to a list(of product) to bind to gridview. then update the sortedlist values

View 3 Replies

Web Forms :: Create Variables That Would Represent A Control In JavaScript On The Fly

Jan 28, 2011

Just for an example, if I have three controls on a Master page, I would usually declare a variable for a control like this.

var elem = document.getElemntId('<%=control1.ClientID %>');

var elem2 = document.getElemntId('<%=control2.ClientID %>');

var elem3 = document.getElemntId('<%=control3.ClientID %>');

Can I do it in some form of concenation like:

[code]....

View 3 Replies

Web Forms :: Cascading Drop Box Holds Old Value If Empty On Auto Post Back?

Sep 3, 2010

I have 3 drop boxes: 1.) Choose Operation 2.) Choose Site 3.) Choose Area. All three of them are linked to an SQL server database which has 3 tables following the same heiarchy of order. I.e. Areas belong to a Site and Sites belong to an operation. And there can only be one operation per site, or one site per area.

First you select an operation, then the page auto postbacks to filter the sites. Then you pick a site and again it autopostbacks to filter the areas. The issue I am having is that when an associated operation has no sites underneight it, and therefore no areas under that, the previous values that were in the boxes are displayed and the user can't click on the boxes anymore. I think this is kind of cheap looking and would like a way to make it so the boxes are clear (i.e. nothin in them). Is there anyway to check if they are going to freeze like that and assign them blank values?

View 12 Replies

DataSource Controls :: How To Create Multiple Records In A Dataset From Multiple Databases

Mar 7, 2011

I am trying to design my logic to do this but I want to create a dataSet which will have records from several databases, The records all have the same layout.

I am reagin the connection string paths from a table in a database.

I am asking for your help in trying figure out my logic.

Should I use the connectionString builder in conjunction with a loop to Connect, read a record into a dataset Until therer are no more records to be read from my databse table with the database name/paths tables ?

Here is my beginning code which deals with one database:

[Code]....

View 2 Replies

JavaScript - Multiple Create Requests Means Multiple Button Click Events For The Same Time?

Oct 19, 2010

I have a form which inserts data in DB on Submit button click but the problem is when client click the button multiple times its sends multiple create requests means multiple button click events for the same time of same data, which must not be.

I tried to disable the button when client click the Submit button first time but after this it does not call server click event handler or not fire the server click event once it got disabled.

How to handle this multiple click problem..

I used the following code to disable the button

[code]....

View 3 Replies

Web Forms :: Create Website With Multiple Host Address Using Iisweb/ Create Command Line

Jan 21, 2010

I am creating a web site through command line. I am able to create a web site with single host address. But i want multiple host address for a website. this is the command I am using iisweb /create D:Test Test.com /d [URL]

View 6 Replies

Web Forms :: Create Multiple Masterpages And Create A Handler To Dynamically Set The Correct Master Page?

Feb 18, 2011

I'm currently in the process of creating a webshop. This webshop supports theming, but I also want customers to choose a lay-out. I can create multiple masterpages and create a handler to dynamically set the correct master page. But some components, like the shopping cart, are controls which have to be present in the master page and are also used in the aspx pages. The shopping cart control for instance, has an Update method which is called whenever the user adds a product to their cart. So the question is: can I somehow create a default masterpage which has all the components on it, but still be able to create multiple lay-outs. And how should I reference that master page from the aspx pages? I also thought of creating an Interface class which defines the masterpage and it's public components, but I don't know if I can reference an interface from aspx pages.

View 8 Replies

Collect 2 Variables From One Hyperlink, And Use Those Variables In The Page_load To Set As Session?

Aug 8, 2010

i am trying to collect 2 variables from one hyperlink, and use those variables in the page_load to set as session. but i don't know how to collect those 2 variables

such :

<a href="javascript:;" onclick="wsChangeColor('mainData', '#FF0000','#FFE4E1');return false;" title="Change color" id="red">1</a>

i would like to collect '#FF0000','#FFE4E1' or direct set '#FF0000','#FFE4E1' to string then send to pageload, how can i do this by only clicking on it ?

View 1 Replies







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