|
I have been scouring Google for an answer, and cant seem to get a simple one. I am very familiar with using threadpool.queueuserworkitem with windows forms. I have a clear understanding of using delegate methods when interacting with an object that doesn't necessarily belong to the various threads, say each thread is building a row of a datatable
However, I have been having a hell of a time finding code that will do this for asp.net. does anyone have a working example of a multithreaded web app, or could point me in the right direction?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Use a call back or an asynchronous page. However, be very careful, threading in an ASP.NET application needs a very specific intent and purpose. Normal thread logic does not apply.
In fact, I would recommend against it in 99.99% of cases.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
all of my tests have blown up in spectacular fashion, so I am awar eof the dangers
the page i am writing is running, then getting the html from a particular page perhaps hundreds of times. the idea so far has been to allow me to re-use an exisiting page in our app rather than rewriting the code from it in a new page that would then repeat it.
It works like this:
we have a page that uses a querystring to request information from the db. it has a specific formatting to it. The project i have been assigned is to runa query with specific parameters, and then build a page that is a composite of all the pages that "would" be generated by the query results if they were run individually, have them marginally reformatted to break for each printer page, and then launch the print window via javascript.
this is pretty monumental to begin with, but the way i have built it so far runs the query, then loads the "other" page and scrapes the body of it and adds it to a datatable. This works great, except when i run the full query, it takes 20 minutes to load the page. Obviously, this is unworkable. I would like to launch each item in a thread and as they finish rendering, add them to the datattable, then return the whole thing.
does that sounds like a good candidate?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
A query that takes 20 minutes is likely in error.
If you insist on this track then I would suggest you need a temporary storage medium for the results, ala session. Then you can poll the session with either ajax or an asynchronous page to update the data table.
I, however, would rework the query.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
the query is actually lightning fast, its building the page after the fact that is taking forever.
However, my boss gave me the best solution:
Let them wait. Apparently this thing will run once a month, so they can just deal with the wait.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
rotflmao. Can you generate it offline then? Maybe a Windows service that runs and persists it so that the user can just select already rendered packages?
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
If i had it my way, it would probably just be a console app that ran once a month and output a big html file, but it isnt up to me, so i guess they get to wait.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
I have an asp.net page with a calendar control. When the user selects a date in the calendar i dynamically create a changing number of checkBoxes. In this page i also have a button which is supposed to read the values of the checkBoxes. The problem is that page_load fires before my button's click event, and in the click event handler the checkBoxes don't exist so i can't check their values. I tried to save the checkBoxes info in the Session after the date has changed, but that gives me their original values and not the values the user changed before he clicked the button.
Hope i made myself clear enough and you'll be able to help me.
Thx
|
|
|
|
|
Where do you create these checkboxes? on client using JavaScript or on the server?
Can you post some code to make it easier to help?
|
|
|
|
|
I create the checkBoxes on the server, in the SelectionChanged event of the calendar. The processing of the information they hold needs to be done on the server too.
The button is created in design time (not dynamically), but it's not visible at start. It becomes visible in the same SelectionChanged event of the calendar. A click on it should be able to access the values of the dynamically created checkBoxes, but the problem is that when the button click event handler is called, the page doesn't contain the checkBoxes any more.
|
|
|
|
|
hi
write the code for dynamically creating checkbox in a function
and call this function from both in form load each time and in button click
|
|
|
|
|
The checkBoxes build (amount, values, etc) depends on the selected date in the calendar. I can't build the checkBoxes on page_load because i don't know what is the current date in the calendar (the page_load events occurs before the SelectionChanged of the calendar, so the calendar doesn't hold the pressed date in page_load)
|
|
|
|
|
hi
have u tried it
it must work
do some logical things
it will work when u call the function from page load
i have use this many time
|
|
|
|
|
I tried what u suggested, but new problems popped out. So i replaced the checkBoxes with buttons and then applied your suggestion and apperantly it was much easier.
Thanks alot.
|
|
|
|
|
Hi Everybody,
I am completely new for ASP.net. I want to print the data manually in grid using while loop. is it possible or not. please help me.
Thank you,
Uddhab
|
|
|
|
|
I have an ASP.NET custom control in a class library, which (apart from server-side logic) has client-side functionality. As far is I know this is best achieved by adding the javascript file to the project as an embedded resource and registering it via code, like this:
string scriptLocation = Page.ClientScript.GetWebResourceUrl(this.GetType(), "Namespace.Control.js");
Page.ClientScript.RegisterClientScriptInclude("Namespace.Control.js", scriptLocation);
Now the funny thing is, it works as expected on one site, however if used on a page in a second site that uses the same class library, I get the following Exception:
"This is an invalid webresource request.". Google only came up with solutions for cases, where it doesn't work at all. Right now I have absolutely no idea what could cause this different behavior for the 2 sites. Any comment on the subject would be appreciated.
|
|
|
|
|
Hi all,
I have a user control with one datalist that displays thumbnails of pictures stored in the database. In the same user control, I have an Image control where I would like to display a zoomed version of the picture when the user clicks on one of the thumbnails of the datalist.
In the datalist, I have ImageButton controls to show the thumbnails. When the user clicks a thumbnail, I get the item index and retrieve the corresponding image from the dataset in the session. The image is stored as a byte array. I save the image in another session variable that will be used by an ASPX page to display it. I point the ImageUrl of my Image control to that ASPX page.
The ItemCommand event handler is as follows:
protected void dlVisuals_ItemCommand(object source, DataListCommandEventArgs e)
{
int index = e.Item.ItemIndex;
DataRow dr = sessionParams.SiteDS.Tables["TempVisuals"].Rows[index];
Session["VisualZoom"] = SiteServices.GetThumbnail((byte[])dr[2], 300, 300);
imgZoomFeature.ImageUrl = "ZoomVisualImage.aspx";
imgZoomFeature.Visible = true;
}
The aspx code to show the image is as follows:
if (Session["VisualZoom"] != null)
{
Bitmap bmp = new Bitmap(new MemoryStream((byte[])Session["VisualZoom"]));
bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
}
I have put the datalist AND the Image control in an UpdatePanel and set the trigger to the ItemCommand event of the datalist.
The code works fine for the FIRST click only, i.e. when the user clicks on a thumbnail after the user control has been loaded. Subsequent clicks do not have any effect on the Image control. I have stepped into the code and I verified that the event handler is being called correctly at each thumbnail click. It seems that the ASPX page displaying the image is not working properly. I put a breakpoint in it but the program doesn't stop at it.
Any ideas?
Thanks,
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook
|
|
|
|
|
Hi,
I am using Visual studio 2005 for building my website. the website is working fine.
But the issue is: I am getting a compilation warning.
Warning: Unable to update auto-refresh reference 'chartfx.internet.dll'. Can not find assembly
'c:\Documents and Settings\kncsnmr\Local Settings\Application Data\Microsoft\VisualStudio\8.0\ProjectAssemblies\5cvgir0d01\ChartFX.Internet.dll'.
I manual browsed through my disk with above path. I was only able to go till 'ProjectAssemblies'. Because there was nothing in the ProjectAssembly folder to reach the end of the above path.
Please let me know how to clear out this compiler warning.
I would greatly appreciate any kind of help on this.
Thanks
Mohamed.
|
|
|
|
|
Might be beacuse of this dll 'chartfx.internet.dll'
are you using this dll in your application if yes then check that dll remove that dll and add once again or try to refresh that dll ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
|
I'm using an UpdatePanel along with a RegularExpressionValidator to inform the user if he/she has input the date in an incorrect format. This works fine once, but if the user types in the date wrong a second time, it doesnt show the validation error message. Any help would be appreciated.
Textbox:
autopostback = true;
causesvalidation = true;
UpdatePanel:
updatemode = Always;
|
|
|
|
|
|
Thanks John, worked great Saved me alot of time/headache. Do the other Ajax extensions work correctly?
|
|
|
|
|
Hi,
I hav implemented the functionality to call a popup window.
but while i child window appears , the value of parent will refresh.
suggest Clue If Any.
Regards
Tarun Singh
Sr. Software Engineer.
mailto:tksingh@zenta.com
|
|
|
|
|
use the following javascript function.. pass the target url, width and height of the window to be opened.
function OpenWindow(url, width, height)
{
if( url == null || url == "" )
{ return false; }
else
{
var handle = window.open(url, "scrollbars=yes,screenX=25,screenY=25,directories=0,height=" + height + ",width=" + width + ",location=no,menubar=no,resizable=yes,status=no,toolbar=no"); +
Children.push(handle);
handle.focus();
return handle;
}
}
--Sreeram
|
|
|
|