Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
foghorn
Oct 9, 2006

Haters gunna hate.
Quick ASP question:

I want to include an ASP file only if certain conditions are met. Since the include statements are in HTML comments, can I do something like this:

code:
mySQL = "SELECT * FROM LOLTABLE WHERE LOLFIELD = " & camis
objRS.Open mySQL, objConn

dim liccode
liccode = objRS("LICENSETYPE")

if liccode = "MED"
	response.write("<!--#include file=\"medallion.asp\"-->")

else if liccode = "CAR"
	response.write("<!--#include file=\"fhv.asp\"-->")

else if liccode = "BAS"
	response.write("<!--#include file=\"base.asp\"-->")
	
else 
	response.write("No relevant data to display")

end if
?

Old hand at PHP, but the workplace is a Windows-only shop that uses ASP for everything, so if I made a complete n00b mistake, please let me know.

Adbot
ADBOT LOVES YOU

Strict 9
Jun 20, 2001

by Y Kant Ozma Post
This is a horribly embarrassing question for someone who has been programming for a decade now, but I just can't find the right Google keywords to solve my query, so here we go:

In C# .NET, how do I call a method that exists in another file? I have a using <Namespace> at the top of the file I want to call from, and the method that I want to call is public. Do I need a constructor in that file, and create an instance of that class?

csammis
Aug 26, 2003

Mental Institution

Strict 9 posted:

In C# .NET, how do I call a method that exists in another file? I have a using <Namespace> at the top of the file I want to call from, and the method that I want to call is public. Do I need a constructor in that file, and create an instance of that class?

First, it's "C#" - .NET is the platform. Second, methods only exist in classes, and classes != files. Unless the method is static, create an instance of the class and call the method.


edit: Better post your code. The questions you're asking seem to indicate there's something strange about your design, because this is how every method is called in C#, and I think you may be trying to shove C# into another language's idiom :confused:

uXs
May 3, 2005

Mark it zero!

dwazegek posted:

Casting is not the same as an explicit conversion, even though the syntax is identical.

In this case you'd have to use a Select instead of a cast, so something like:
code:
IEnumerable<TestTarget> targets = sourceList.Select(ts => (TestTarget)ts);

Cool, thanks. Having to do stuff like that makes me feel that there is probably something wrong with the design, but whatever. Thanks :-)

genki
Nov 12, 2003

csammis posted:

edit: Better post your code. The questions you're asking seem to indicate there's something strange about your design, because this is how every method is called in C#, and I think you may be trying to shove C# into another language's idiom :confused:
Actually, if I had to guess, I'd say he hasn't added a reference to the file in his project...

pliable
Sep 26, 2003

this is what u get for "180 x 180 avatars"

this is what u fucking get u bithc
Fun Shoe
Did Framework 3.5 change how try-catch-finally blocks work? I had a piece of code that worked fine in Framework 2.0 when I had a try-finally block, but then we recently upgraded to 3.5 and I spent the last hour trying to figure out how and why my exceptions were not being caught by the "finally" block unless I put "catch" there instead :psyduck:.

mlnhd
Jun 4, 2002

pliable posted:

Did Framework 3.5 change how try-catch-finally blocks work? I had a piece of code that worked fine in Framework 2.0 when I had a try-finally block, but then we recently upgraded to 3.5 and I spent the last hour trying to figure out how and why my exceptions were not being caught by the "finally" block unless I put "catch" there instead :psyduck:.
If there's no catch it will get thrown as far as necessary until it's caught, but the code in your finally block is guaranteed to be executed (before the throw?). I think this is how it's always been

Strict 9
Jun 20, 2001

by Y Kant Ozma Post

csammis posted:

First, it's "C#" - .NET is the platform. Second, methods only exist in classes, and classes != files. Unless the method is static, create an instance of the class and call the method.


edit: Better post your code. The questions you're asking seem to indicate there's something strange about your design, because this is how every method is called in C#, and I think you may be trying to shove C# into another language's idiom :confused:

Considering all the languages that were crammed down my throat during college, I wouldn't be surprised if I was mixing up the terms.

I don't have the code here at home, but basically I have a file, Template.aspx.cs, with a few public functions (I'm guessing functions would be a more accurate term here) that I'd like to call from other files.

I've tried calling the function via MyProject.Template.Function(), but that doesn't work.

So it sounds like your suggestion is to write a constructor for Template.aspx.cs, create an instance of it, and call the function using that instance?

Horse Cock Johnson
Feb 11, 2005

Speed has everything to do with it. You see, the speed of the bottom informs the top how much pressure he's supposed to apply. Speed's the name of the game.

Strict 9 posted:

Considering all the languages that were crammed down my throat during college, I wouldn't be surprised if I was mixing up the terms.

I don't have the code here at home, but basically I have a file, Template.aspx.cs, with a few public functions (I'm guessing functions would be a more accurate term here) that I'd like to call from other files.

I've tried calling the function via MyProject.Template.Function(), but that doesn't work.

So it sounds like your suggestion is to write a constructor for Template.aspx.cs, create an instance of it, and call the function using that instance?

Template.aspx.cs would be the "code behind" file for an ASP.NET page named (presumably) Template.aspx. In an ASP.NET scenario, you should think of the .aspx file and the .aspx.cs file as one class - they essentially get combined at runtime to build and output Template.aspx.

If what you're looking to do is to have a class with a bunch of public static methods that you can call from any page anywhere in your project, what you'd probably want to do is add a class (not a web form) to your project and add those methods to it.



EDIT:

This is just a wild guess based solely on the file name you provided, but if you're looking for a way to have templates or base classes that other pages in your web site derive from, look into master pages. A master page is essentially a template that you fill with placeholders that other pages (content pages) derive from, much like a base class. You can design a master page with with all the design elements that other pages in your site will inherit and give it all the methods you want. Then, in any content pages you create that derive from that master page, all you have to do is cast that page's Master property to the specific type of your master page.

Horse Cock Johnson fucked around with this message at 03:55 on Jul 10, 2008

Gary the Llama
Mar 16, 2007
SHIGERU MIYAMOTO IS MY ILLEGITIMATE FATHER!!!
I'm currently creating a Windows Forms application and I keep running into pesky UI issues. I'm just not happy with the way the program looks and is used.

I like some of the early stuff I saw that WPF could do but I'm afraid that going that route may require too much of my user base. I don't want them to have to download the .NET 3.0 framework for this application since I'm trying to appeal to the lowest common denominator. (Unless something has changed and WPF doesn't require additional framework downloads to work. Are there any stats on how many users have 3.0 already on their machine?)

So I'm either wondering if market penetration is deep enough to justify the move to WPF. (I'm targeting users that may not be very technical, including teachers and schools.) And if that's not an option and I stick with 2.0 WinForms, how can I make my program not look like crap? I'm specifically looking for some sort of smooth animating filmstrip control on my user selection screen that would look like this. (I have an idea or two on how to code it but not sure if it's feasible.)

Horse Cock Johnson
Feb 11, 2005

Speed has everything to do with it. You see, the speed of the bottom informs the top how much pressure he's supposed to apply. Speed's the name of the game.

Gary the Llama posted:

I like some of the early stuff I saw that WPF could do but I'm afraid that going that route may require too much of my user base. I don't want them to have to download the .NET 3.0 framework for this application since I'm trying to appeal to the lowest common denominator. (Unless something has changed and WPF doesn't require additional framework downloads to work. Are there any stats on how many users have 3.0 already on their machine?)

Someone can feel free to correct me if I'm wrong, but I'm pretty sure that WPF is integrated into .NET 3.5. As long as your users have the latest version of the .NET Framework (which can be bundled into an MSI or whatever method you're using to distribute your application), you could use WPF no problem.

Gary the Llama
Mar 16, 2007
SHIGERU MIYAMOTO IS MY ILLEGITIMATE FATHER!!!

Mr. Herlihy posted:

Someone can feel free to correct me if I'm wrong, but I'm pretty sure that WPF is integrated into .NET 3.5. As long as your users have the latest version of the .NET Framework (which can be bundled into an MSI or whatever method you're using to distribute your application), you could use WPF no problem.

I understand that, but like I said, I'm trying to hit the lowest common denominator. I don't want to hassle the user with installing something extra. Of course, if the process of bundling and installing it is totally seamless for the user, that's nice. I guess I should run some tests and find out.

And of course, if I switch to WPF, it's going to extend my development time quite a bit.

Edit: Anyone have an idea how big the 3.5 framework is when bundled? Isn't it something like 200-300MB? That would be completely unacceptable since my program is tiny (should end up > 5MB) and I can't guarantee that my users will have access to broadband.

Gary the Llama fucked around with this message at 04:34 on Jul 10, 2008

Horse Cock Johnson
Feb 11, 2005

Speed has everything to do with it. You see, the speed of the bottom informs the top how much pressure he's supposed to apply. Speed's the name of the game.

Gary the Llama posted:

Edit: Anyone have an idea how big the 3.5 framework is when bundled? Isn't it something like 200-300MB? That would be completely unacceptable since my program is tiny (should end up > 5MB) and I can't guarantee that my users will have access to broadband.

Yeah, it's pretty big and I may have spoken too soon about bundling the framework install with an MSI anyway. I could have sworn I've seen ways to package the installer with an MSI before, but I can't seem to find anything specific on how to do it.

I guess it really depends on who your users are as to whether or not you stick with Windows Forms or move to WPF. You say you're appealing to the "lowest common denominator", so until things like Vista and .NET 3.5 are a foregone conclusion or you can feel safe in asking your users to download something extra to make your app work, you might be better off sticking with Windows Forms.

MORE CURLY FRIES
Apr 8, 2004

I have an interesting problem:

I'm pulling data from three databases to be loaded on a page. Due to the nature of the databases there is a time difference between the data pulled from each one. One will be quicker than the others and one will be much slower.

However the information pulled from each database is valid in its own right - so if the page only loaded information from one database they'd still be able to act on it - but it's the information from all three is the same "set".

What I'm wondering is how it would be possible to perform the search, then when the information is returned from the first database I'd like to display the page, rather than waiting on the other two to return. But when the information becomes available from the other two databases then I'd like to update the page using some sort of AJAXY stuff, rather than a full page refresh.

If anyone knows how to go about doing this then that'd be a great help.

csammis
Aug 26, 2003

Mental Institution

pliable posted:

Did Framework 3.5 change how try-catch-finally blocks work? I had a piece of code that worked fine in Framework 2.0 when I had a try-finally block, but then we recently upgraded to 3.5 and I spent the last hour trying to figure out how and why my exceptions were not being caught by the "finally" block unless I put "catch" there instead :psyduck:.

A finally block has never "caught" exceptions. Like melonhead said, its only purpose is to contain code that will be executed no matter how the try block is exited (either normally or when an exception is caught). The finally block doesn't have access to the thrown exception or anything like that.

Melonhead posted:

the code in your finally block is guaranteed to be executed (before the throw?)

Exception thrown -> finally block executed -> exception passed back up the stack

Strict 9
Jun 20, 2001

by Y Kant Ozma Post

Mr. Herlihy posted:

Template.aspx.cs would be the "code behind" file for an ASP.NET page named (presumably) Template.aspx. In an ASP.NET scenario, you should think of the .aspx file and the .aspx.cs file as one class - they essentially get combined at runtime to build and output Template.aspx.

If what you're looking to do is to have a class with a bunch of public static methods that you can call from any page anywhere in your project, what you'd probably want to do is add a class (not a web form) to your project and add those methods to it.

Ah, that was it! I was trying to do everything in web forms. I kind of, well, forgot about classes.

Thanks!

pliable
Sep 26, 2003

this is what u get for "180 x 180 avatars"

this is what u fucking get u bithc
Fun Shoe

csammis posted:

A finally block has never "caught" exceptions. Like melonhead said, its only purpose is to contain code that will be executed no matter how the try block is exited (either normally or when an exception is caught). The finally block doesn't have access to the thrown exception or anything like that.


Exception thrown -> finally block executed -> exception passed back up the stack

Ah, well then I'm retarded and obviously need to go back to school! Thank you both for the info.

fankey
Aug 31, 2001

Mr. Herlihy posted:

Yeah, it's pretty big
Actually, there's a new Client Profile that removes most of the stuff rarely needed for client apps. It comes in at ~25MB.

genki
Nov 12, 2003

Gary the Llama posted:

I'm currently creating a Windows Forms application and I keep running into pesky UI issues. I'm just not happy with the way the program looks and is used.
I've been working with Windows Forms in .net 2.0 for a few years now and yeah, there are many pesky UI issues and I'm not really happy with the way things look either. :v: Unfortunately, I have no suggestion as to a solution. Practically speaking, to make something look really good, I think you either have to put in a lot of time to make a polished experience (making user controls is a fairly time consuming task if you want functionality that can't be constructed from existing controls) or buy/find a pre-built control that does what you want.

edit: oh, and the WPF issues are as outlined. I don't think .net 3.5 penetration is high enough to consider it a lowest common denominator solution.

Fastbreak
Jul 4, 2002
Don't worry, I had ten bucks.
Anyone know exactly the effect of the .NET Runtime Optimization Service? I just got my own VPS instead of a shared hosting thing running and I see this in the service list. Now I don't have it running on my home or work computer, and by default its set to manual on my VPS so its not running either. Its obviously not essential, but whats the deal with it? What effect will I find by turning it on or off?

biznatchio
Mar 31, 2001


Buglord

Fastbreak posted:

Anyone know exactly the effect of the .NET Runtime Optimization Service? I just got my own VPS instead of a shared hosting thing running and I see this in the service list. Now I don't have it running on my home or work computer, and by default its set to manual on my VPS so its not running either. Its obviously not essential, but whats the deal with it? What effect will I find by turning it on or off?

That's the service that handles background NGen requests (compiling of assemblies into native code ahead of time so they don't need to be JITted at runtime). You'll generally only notice it running after installing a new .NET application or installing an update to the framework itself.

Starting it directly yourself won't provide any performance benefit. In fact it may just stop itself right away if you try since it wouldn't have any work to do. NGen starts it when its needed. Disabling it entirely will have no immediate performance impact until you do one of the conditions above (installing a new .NET app or updating the framework), and then after that you'll notice worse performance (and in the case of framework updates, considerably worse performance).

HIERARCHY OF WEEDZ
Aug 1, 2005

Is there any way to programmatically check to see if ActiveSync is installed?

Gravy Jones
Sep 13, 2003

I am not on your side
Currently we have to email Word documents to a third party in a specific PCL format.

I do this (using VB.Net) by opening the document, switching to the correct print, and telling the document to print to file (by setting the relevant flag in the printout method. I then attach that document to an email and send it.

However the system is changing from being email based to XML submitted of HTTP. The PCL document now needs to be encoded as a string within the XML document.

What I'm wondering is if I can do this in a single step. Rather than print to file and then encode that file, can I capture the output of the document as it's printing and convert it to the appropriate format without actually saving it as a file.

Probably a bit of a longshot, but I thought I'd check here as I'm not having much luck finding any information about this.

Edit: I should add this isn't a big deal or anything, I can just delete the file as soon as I encode it. I guess I'm more curious than anything, it strikes me as something that shouldn't have to be this messy.

Gravy Jones fucked around with this message at 15:45 on Jul 11, 2008

Green_Machine
Jun 28, 2008
Does anyone know of a way to do to polymorphic xml serialization of objects?

I'm talking about the xml serialization you can define for a class using the definitions in System.Xml.Serialization. For example:

code:
[XmlElement]
public class Foo
{
     [XmlAttribute]
     public bool MyBoolProperty { get; set; }
}

[XmlElement]
public class Bar : Foo
{
     [XmlArray]
     string[] MyStringArray { get; set; }
}


[XmlRoot]
public class MyXmlRootClass
{
     [XmlArray]
     Foo[] MyFooArray { get; set; }
}
Now suppose I have an object of type MyXmlRootClass, and its Foo array actually includes some objects of the derived type Bar. If I pass the MyXmlRootClass object off to an XmlSerializer, I would like the Bar objects to get serialized polymorphically as Bar objects rather than Foo objects.

Is this possible using the existing framework?

SixPabst
Oct 24, 2006

Panic! at the Fist Jab posted:

Is there any way to programmatically check to see if ActiveSync is installed?

Look for the registry key?

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog
Is there a good HTML parsing library for .NET? I guess I'm looking for something like Beautiful Soup that I can use in a C# project.

Lord Purple
Mar 7, 2006

Remove your eyes...
This is kind of a javascript/C#.net question, so hopefully this is in the right thread. In my cs file I need to open up a new window for the user when they hit a button. The name of the file is stored in a string called pageToLoad and I open it up in a Response.Write() with some javascript. With a normal web address, it opens fine but when I try to put in a network location from the intranet, it errors. I have copied the data from pageToLoad into an address bar and it loads no problem, but the javascript I use seems to add things and mess with it. For example, if PageToLoad is "\\CompName\Folder\xmlFile.xml" it will switch it to "http://CompName/Folder/xmlFile.xml". Is there any way so it will just have the the string for the location and no extras added on or is there a better way to do what I am trying to do in the .Net framework?

Here is the code in question:
code:
string pageToLoad = "\\\\CompName\\Folder\\" + xmlFileName;
            string newPageOpen = "<Script Language=\"JavaScript\">window.open('" + pageToLoad +
                "','','scrollbars=yes,menubar=yes,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');</Script>";
            Response.Write(newPageOpen); 

moww
Jan 16, 2005

Can Type the Hype and Post the Most.
I'm trying to teach myself ASP.NET/C# and I've run into a problem that likely has a simple and elegant solution (but I can't think of it).

I have an SQL query that returns a single column of ints. My goal is to see which int in the column has the most frequent occurrence--pretty simple, right? The real problem I'm having is populating a data structure with the data from the query so I can iterate through it and count the occurrences. Here's the code I've tried, which does not populate the array:
code:
SqlDataReader myReader = myCommand.ExecuteReader(); //reader contains proper data
int[] votes = new int[bigEnough];
while (myReader.MoveNext()) {
     votes[int.Parse(myReader['piece_id'].ToString())]++;  //this loop seems to be the main problem
}
//when code reaches this point, votes[] contains only 0's at every index.
For the post above me, while I don't have THE answer, I have a few ideas:
1. Try a fully qualified URL (myDomainURLVar + "CompName\Folder\xmlFile.xml")
2. Try a single slash at the beginning of the URL

moww fucked around with this message at 21:06 on Jul 11, 2008

Richard Noggin
Jun 6, 2005
Redneck By Default

moww posted:

I'm trying to teach myself ASP.NET/C# and I've run into a problem that likely has a simple and elegant solution (but I can't think of it).

I have an SQL query that returns a single column of ints. My goal is to see which int in the column has the most frequent occurrence--pretty simple, right? The real problem I'm having is populating a data structure with the data from the query so I can iterate through it and count the occurrences. Here's the code I've tried, which does not populate the array:
code:
SqlDataReader myReader = myCommand.ExecuteReader(); //reader contains proper data
int[] votes = new int[bigEnough];
while (myReader.MoveNext()) {
    [b] votes[int.Parse(myReader['piece_id'].ToString())]++;[/b]  //this loop seems to be the main problem
}
//when code reaches this point, int[] contains only 0's at every index.
For the post above me, while I don't have THE answer, I have a few ideas:
1. Try a fully qualified URL (myDomainURLVar + "CompName\Folder\xmlFile.xml")
2. Try a single slash at the beginning of the URL

Hint: you're not actually assigning votes[x] to anything.

moww
Jan 16, 2005

Can Type the Hype and Post the Most.

Richard Noggin posted:

Hint: you're not actually assigning votes[x] to anything.

I don't see what you mean. Am I not assigning values to votes[] when I do
code:
votes[someKey]++;
?

EDIT: Thanks a million, Richard Noggin and mintskoal. The problem was using .NextResult() instead of .Read() (in the sample I posted, I accidentally wrote .MoveNext() instead of .NextResult()).

moww fucked around with this message at 21:46 on Jul 11, 2008

Richard Noggin
Jun 6, 2005
Redneck By Default
Yeah, it should. I missed the ++ at the end.

SixPabst
Oct 24, 2006

moww posted:

code:
SqlDataReader myReader = myCommand.ExecuteReader(); //reader contains proper data
int[] votes = new int[bigEnough];
while (myReader.MoveNext()) {
     votes[int.Parse(myReader['piece_id'].ToString())]++;  //this loop seems to be the main problem
}
//when code reaches this point, votes[] contains only 0's at every index.

For one thing, change .MoveNext() in the while loop to

code:
while (myReader.Read())
{
  
}
See if that helps.

Lord Purple
Mar 7, 2006

Remove your eyes...

moww posted:

I'm trying to teach myself ASP.NET/C# and I've run into a problem that likely has a simple and elegant solution (but I can't think of it).

I have an SQL query that returns a single column of ints. My goal is to see which int in the column has the most frequent occurrence--pretty simple, right? The real problem I'm having is populating a data structure with the data from the query so I can iterate through it and count the occurrences. Here's the code I've tried, which does not populate the array:
code:
SqlDataReader myReader = myCommand.ExecuteReader(); //reader contains proper data
int[] votes = new int[bigEnough];
while (myReader.MoveNext()) {
     votes[int.Parse(myReader['piece_id'].ToString())]++;  //this loop seems to be the main problem
}
//when code reaches this point, votes[] contains only 0's at every index.
For the post above me, while I don't have THE answer, I have a few ideas:
1. Try a fully qualified URL (myDomainURLVar + "CompName\Folder\xmlFile.xml")
2. Try a single slash at the beginning of the URL

Thanks for the help, I just tagged on file:// on the front and it seemed to work. I guess it needs something otherwise it defaults to http://.

biznatchio
Mar 31, 2001


Buglord

Green_Machine posted:

Is this possible using the existing framework?

Yes. It should work exactly as you expect automatically, though you'll need to give the XmlSerializer the hint that it needs to build the logic to support Bar classes because otherwise it won't know how to handle them.

Add an [XmlInclude(typeof(Bar))] attribute to either the Foo class, the MyXmlRootClass class, or in the constructor of the serializer.

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:
Linq-to-Sql question:

I have a database table that will generally contain a fairly large number of rows (anywhere between 300k and 5M is normal). The primary key consists of a Guid and a DateTime.

Periodically I'll get a list of identifier objects (again, a Guid and DateTime) which denote the items rows that have to be deleted from the database.

Is there a clean and fast way to do this with linq-to-sql?

My current solution is to enumerate through the objects and call a stored procedure for each item, which has proven to be much faster than any linq-to-sql method I've used so far, but I might be missing something.

Phummus
Aug 4, 2006

If I get ten spare bucks, it's going for a 30-pack of Schlitz.
I apologize if this has been asked already, but I don't have platinum, and this thread is 70-some pages long.

I have a grid view that is bound to a SQLCommand that is a stored procedure. The stored procedure returns a lot of fields that I don't want to display on my gridview. I want to hide those columns (as well as change header text, etc).

here is my code:

code:
SqlDataReader sqlReader = sqlCmd.ExecuteReader();
            gvTasks.DataSource = sqlReader;
            gvTasks.DataBind();
            gvTasks.Columns[1].HeaderText = "Hello";
The headertext on column 1, however does not change when the application is run. Any ideas what I'm doing wrong?

The Noble Nobbler
Jul 14, 2003

MuppetPastor posted:

The headertext on column 1, however does not change when the application is run. Any ideas what I'm doing wrong?

Are the columns being autocreated and overriding the change?

I would have figured that the databinding would do the creation, but who knows, it may come after.

Phummus
Aug 4, 2006

If I get ten spare bucks, it's going for a 30-pack of Schlitz.

The Noble Nobbler posted:

Are the columns being autocreated and overriding the change?

I would have figured that the databinding would do the creation, but who knows, it may come after.

If I try to change anything before the databind, I would assume that the columns don't exist yet...

Dromio
Oct 16, 2002
Sleeper

MuppetPastor posted:

If I try to change anything before the databind, I would assume that the columns don't exist yet...

It might be easier to just set AutoGenerateColumns="false" and define your columns in the aspx like so:

code:
<asp:GridView ID="MyGrid" runat="server" AutoGenerateColumns="false">
    <Columns>
        <asp:BoundField DataField="FieldFromYourProc" HeaderText="WhatIWantToShow" />
        <asp:BoundField DataField="SecondField" HeaderText="WhatIWantToShowNow" />
    </Columns>
</asp:GridView>

Adbot
ADBOT LOVES YOU

tsunami
Jun 24, 2004
woo

MORE CURLY FRIES posted:

I have an interesting problem:

I'm pulling data from three databases to be loaded on a page. Due to the nature of the databases there is a time difference between the data pulled from each one. One will be quicker than the others and one will be much slower.

However the information pulled from each database is valid in its own right - so if the page only loaded information from one database they'd still be able to act on it - but it's the information from all three is the same "set".

What I'm wondering is how it would be possible to perform the search, then when the information is returned from the first database I'd like to display the page, rather than waiting on the other two to return. But when the information becomes available from the other two databases then I'd like to update the page using some sort of AJAXY stuff, rather than a full page refresh.

If anyone knows how to go about doing this then that'd be a great help.

I've never actually done this on an ASP.NET page so I'm not sure if it's any different, but I have done it with sockets. Anyway, could you spawn three threads that do the DB work and as they return, asynchronously update the page? Something similar to this: http://msdn.microsoft.com/en-us/library/3dasc8as.aspx. Although in that example they wait for all the threads to finish before displaying the results, while, as you said, you'd want to update the page immediately one by one as they finish.

  • Locked thread