Showing posts with label performing. Show all posts
Showing posts with label performing. Show all posts

Monday, March 26, 2012

Performing a download along with another action

I have a webform that contains a button which I want to do three things:

1. Delete a record from a database
2. Let the user download a text file that is generated
3. Refresh the page to show that the record was deleted

I am able to do any of these things separately with no trouble. The problem
occurs when I try to offer a download AND call my refresh method. When I try
to do a download and call my refresh method, only the download is performed,
regardless of whether the refresh is called before or after the download.
Here is snippet of my code that does the download and refresh:

Me.RefreshEvents()
Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition", "attachment;filename=" &
downloadname)
Response.Write(downloadtext)
Response.End()

If I comment out five lines that do the download, Me.RefreshEvents() does
what I want and would expect, but otherwise it appears to do nothing. I
don't care whether Me.RefreshEvents() is called before or after doing the
download, as long as they are both done. What can I do to make sure both of
these tasks get completed?
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/when the browser requests a page (like when the user hit the button), the
browser only expects one document back. you can do one of several options

1) refesh page and enable a download button
2) refresh page and use client script to start a download
3) refresh page and use meta tag to start download

in all cases you refresh the page and then download the text file.

-- bruce (sqlwork.com)

"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
This can be done. What is meant by refreshing the page, something like
re-display the grid?
So the user hits the button:
1. You delete the record and re-bind the grid so the user can see the
changes on this page.
2. You save the text to be downloaded in a session variable - this is the
simplest, or on disk, or database record, etc.
3. You have a Protected string variable, say MustDownLoad, and set it's
value "Yes", or anything, to be read by Java script.
4. In the HTML view of the form, right at the bottom, you must add Java
script to open a new window to download the text:
<script language="javascript">
if ("<%=MustDownLoad%>" != "") {
window.open("Form_DownLoadText.aspx");
}
</script>
5. You create a new form Form_DownLoadText.aspx and in it, you read the text
from the session variable/disk/record and do the
Response.ClearContent()
Response.ContentType = "text/plain"
yada yada

"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
Nathan,

Maybe a stupid question, why do you not use the HTML command File Field. It
is a strange name because AFAIK mostly is used Download Button.

It is the HTML tag <Input type=file
Cor

Performing a download along with another action

I have a webform that contains a button which I want to do three things:
1. Delete a record from a database
2. Let the user download a text file that is generated
3. Refresh the page to show that the record was deleted
I am able to do any of these things separately with no trouble. The problem
occurs when I try to offer a download AND call my refresh method. When I try
to do a download and call my refresh method, only the download is performed,
regardless of whether the refresh is called before or after the download.
Here is snippet of my code that does the download and refresh:
Me.RefreshEvents()
Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition", "attachment;filename=" &
downloadname)
Response.Write(downloadtext)
Response.End()
If I comment out five lines that do the download, Me.RefreshEvents() does
what I want and would expect, but otherwise it appears to do nothing. I
don't care whether Me.RefreshEvents() is called before or after doing the
download, as long as they are both done. What can I do to make sure both of
these tasks get completed?
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/when the browser requests a page (like when the user hit the button), the
browser only expects one document back. you can do one of several options
1) refesh page and enable a download button
2) refresh page and use client script to start a download
3) refresh page and use meta tag to start download
in all cases you refresh the page and then download the text file.
-- bruce (sqlwork.com)
"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
This can be done. What is meant by refreshing the page, something like
re-display the grid?
So the user hits the button:
1. You delete the record and re-bind the grid so the user can see the
changes on this page.
2. You save the text to be downloaded in a session variable - this is the
simplest, or on disk, or database record, etc.
3. You have a Protected string variable, say MustDownLoad, and set it's
value "Yes", or anything, to be read by Java script.
4. In the HTML view of the form, right at the bottom, you must add Java
script to open a new window to download the text:
<script language="javascript">
if ("<%=MustDownLoad%>" != "") {
window.open("Form_DownLoadText.aspx");
}
</script>
5. You create a new form Form_DownLoadText.aspx and in it, you read the text
from the session variable/disk/record and do the
Response.ClearContent()
Response.ContentType = "text/plain"
yada yada
"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
Nathan,
Maybe a stupid question, why do you not use the HTML command File Field. It
is a strange name because AFAIK mostly is used Download Button.
It is the HTML tag <Input type=file>
Cor

Performing Arithmetic on DataTable Columns

I have a DataTable with only one DataColumn of type float. I need to
calculate the Max value that in any of the DataRows, and this DataColumn.
I noticed the DataColumn has an Expression property:
http://msdn.microsoft.com/library/d...essionTopic.asp
However, it seems that I would end up having to create a new DataColumn,
call it MaxVal or something, and populate it for every row.
Is there a cleaner way?Nevermind, I discovered the Compute method.
float flMax =
(float)m_dsSegments.Tables["Calculations"].Compute("Max(Score)",
string.Empty);
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:O30tjLLTEHA.240@.TK2MSFTNGP11.phx.gbl...
> I have a DataTable with only one DataColumn of type float. I need to
> calculate the Max value that in any of the DataRows, and this DataColumn.
> I noticed the DataColumn has an Expression property:
>
http://msdn.microsoft.com/library/d...essionTopic.asp
> However, it seems that I would end up having to create a new DataColumn,
> call it MaxVal or something, and populate it for every row.
> Is there a cleaner way?
>
If your contents are bound to a dataset why don't you just use the dataset
ds.Tables[0].Compute("Max(["+strColumnName+"])",String.Empty)
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:O30tjLLTEHA.240@.TK2MSFTNGP11.phx.gbl...
>I have a DataTable with only one DataColumn of type float. I need to
> calculate the Max value that in any of the DataRows, and this DataColumn.
> I noticed the DataColumn has an Expression property:
> http://msdn.microsoft.com/library/d...opi
c.asp
> However, it seems that I would end up having to create a new DataColumn,
> call it MaxVal or something, and populate it for every row.
> Is there a cleaner way?
>

Performing Arithmetic on DataTable Columns

I have a DataTable with only one DataColumn of type float. I need to
calculate the Max value that in any of the DataRows, and this DataColumn.

I noticed the DataColumn has an Expression property:
http://msdn.microsoft.com/library/d...essionTopic.asp

However, it seems that I would end up having to create a new DataColumn,
call it MaxVal or something, and populate it for every row.

Is there a cleaner way?Nevermind, I discovered the Compute method.

float flMax =
(float)m_dsSegments.Tables["Calculations"].Compute("Max(Score)",
string.Empty);

"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:O30tjLLTEHA.240@.TK2MSFTNGP11.phx.gbl...
> I have a DataTable with only one DataColumn of type float. I need to
> calculate the Max value that in any of the DataRows, and this DataColumn.
> I noticed the DataColumn has an Expression property:
http://msdn.microsoft.com/library/d...essionTopic.asp
> However, it seems that I would end up having to create a new DataColumn,
> call it MaxVal or something, and populate it for every row.
> Is there a cleaner way?
If your contents are bound to a dataset why don't you just use the dataset
ds.Tables[0].Compute("Max(["+strColumnName+"])",String.Empty)

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:O30tjLLTEHA.240@.TK2MSFTNGP11.phx.gbl...
>I have a DataTable with only one DataColumn of type float. I need to
> calculate the Max value that in any of the DataRows, and this DataColumn.
> I noticed the DataColumn has an Expression property:
> http://msdn.microsoft.com/library/d...essionTopic.asp
> However, it seems that I would end up having to create a new DataColumn,
> call it MaxVal or something, and populate it for every row.
> Is there a cleaner way?

Performing an Operation Once a Day

I want to write a script that runs just once in a day.
Like i want to add a poll of the day or send all emails after one day or something like that then how can i do?
I thought of threading but if the web application closes and then on its start how would it know if the actions have been taken? do I have to store them in some files like last poll update time etc.
Is there a better way of doing this? Moreover can i make a class that is visible to all the sessions (just like application variables) and any script can call that class or its member functions.There are several ways to go about this. You could have the web app fire the tasks (yes, you'd have to store the status in a file or database somewhere), but because ASP.NET may restart itself, the application may shut down, etc., you won't be able to control when your daily processes run. If you are simply adding content to a database, you might choose to schedule a database job to run at a specific time. You could use the Windows scheduler to fire off an exe or to run some VBScript via WSH at a predetermined time. Or, you may choose to create a Windows service to coordinate execution of each task.
To answer your second question: yes, you can create a class that is visible to all sessions. A class built using the singleton design pattern will accomplish this, with the side-effect of also being accesible to your non-HttpContext daily tasks.

Thanks for the reply.
Yes, choosing a database schedule is suitable for database jobs. I dont have direct access to my server ( i have shared hosting), so i dont think i can write a windows scheduler. Moreover i would like to write a generic script that will work on any client machine.
I didnt quite understand the second point. What is a class built on a singleton design? The side effect that it is accessible to non httpcontext tasks mean it can be accessed without the http request also?
I did the same thing with an application I wrote, this was delivered on a shared hosting plan.
I added a little script to the homepage which checked if todaysactivity had been completed, if not, it did it and then changed theflag.
Of course, someone had to visit the homepage at least once a day - butthat wasn't a problem, since the customer visited it every hour anyway.
We had two versions - one which stored data in a database, another stored the flag in an XML file.

Ya this is a good idea. I had thought of making a page that the web team will visit each day, which will execute the scripts. This way i can perform the operations.
Is it possible to make a class that sends email. This must be visible to the entire application. How can i do that?
Yes, things will get a bit trickier in a shared hosting environment. Your only option may be to have a page check a status flag and kickoff the script as has been suggested and, as long as thight scheduling is not required, should work just fine.
A singleton class can only ever have one instance, meaning that data can be easily shared between objects, etc. The advantage to using this approach versus the ASP.NET Application object is that other, non-web pieces of your application can gain access to the object. If you'd like to learn more about singleton, referenceDesign Patterns or theMS P&P website.


Thanks. The link was of great help.

Performing calcualtions on data in gridview

Is it possible to perform calculations on data in your gridview in your
ASP, or do you need to do any calculations in the OnRowDataBound event?
Here is what I am trying to do :
<asp:TemplateField HeaderText="Target (%)"
SortExpression="TargetPercentage">
<ItemTemplate>
<asp:Label ID="lblTargetPercentage"
Text='<%# Eval("TargetPercentage")*100 %>' runat="server"></asp:Label>
</ItemTemplate>
<ItemStyle Height="24px" Width="50px" />
*** Sent via Developersdex http://www.examnotes.net ***I would make the calculation part of the sql statement or part of the stored
procedure so that the gridview simply displays the
calculated results
"Mike P" <mike.parr@.gmail.com> wrote in message news:OrfJwbIlGHA.408@.TK2MSFTNGP03.phx.gbl..
.
> Is it possible to perform calculations on data in your gridview in your
> ASP, or do you need to do any calculations in the OnRowDataBound event?
> Here is what I am trying to do :
> <asp:TemplateField HeaderText="Target (%)"
> SortExpression="TargetPercentage">
> <ItemTemplate>
> <asp:Label ID="lblTargetPercentage"
> Text='<%# Eval("TargetPercentage")*100 %>' runat="server"></asp:Label>
> </ItemTemplate>
> <ItemStyle Height="24px" Width="50px" />
>
> *** Sent via Developersdex http://www.examnotes.net ***
If the calculations required input that was not available within the
database, you could retrieve the dataset with a constant value column
and then perform the calculation on the dataset before binding to the
datagrid.
Jon Paal wrote:
> I would make the calculation part of the sql statement or part of the stor
ed procedure so that the gridview simply displays the
> calculated results
>
> "Mike P" <mike.parr@.gmail.com> wrote in message news:OrfJwbIlGHA.408@.TK2MS
FTNGP03.phx.gbl...

Performing calcualtions on data in gridview

Is it possible to perform calculations on data in your gridview in your
ASP, or do you need to do any calculations in the OnRowDataBound event?
Here is what I am trying to do :

<asp:TemplateField HeaderText="Target (%)"
SortExpression="TargetPercentage">
<ItemTemplate>
<asp:Label ID="lblTargetPercentage"
Text='<%# Eval("TargetPercentage")*100 %>' runat="server"></asp:Label>
</ItemTemplate>
<ItemStyle Height="24px" Width="50px" /
*** Sent via Developersdex http://www.developersdex.com ***I would make the calculation part of the sql statement or part of the stored procedure so that the gridview simply displays the
calculated results

"Mike P" <mike.parr@.gmail.com> wrote in message news:OrfJwbIlGHA.408@.TK2MSFTNGP03.phx.gbl...
> Is it possible to perform calculations on data in your gridview in your
> ASP, or do you need to do any calculations in the OnRowDataBound event?
> Here is what I am trying to do :
> <asp:TemplateField HeaderText="Target (%)"
> SortExpression="TargetPercentage">
> <ItemTemplate>
> <asp:Label ID="lblTargetPercentage"
> Text='<%# Eval("TargetPercentage")*100 %>' runat="server"></asp:Label>
> </ItemTemplate>
> <ItemStyle Height="24px" Width="50px" />
>
> *** Sent via Developersdex http://www.developersdex.com ***
If the calculations required input that was not available within the
database, you could retrieve the dataset with a constant value column
and then perform the calculation on the dataset before binding to the
datagrid.

Jon Paal wrote:
> I would make the calculation part of the sql statement or part of the stored procedure so that the gridview simply displays the
> calculated results
>
> "Mike P" <mike.parr@.gmail.com> wrote in message news:OrfJwbIlGHA.408@.TK2MSFTNGP03.phx.gbl...
> > Is it possible to perform calculations on data in your gridview in your
> > ASP, or do you need to do any calculations in the OnRowDataBound event?
> > Here is what I am trying to do :
> > <asp:TemplateField HeaderText="Target (%)"
> > SortExpression="TargetPercentage">
> > <ItemTemplate>
> > <asp:Label ID="lblTargetPercentage"
> > Text='<%# Eval("TargetPercentage")*100 %>' runat="server"></asp:Label>
> > </ItemTemplate>
> > <ItemStyle Height="24px" Width="50px" />
> > *** Sent via Developersdex http://www.developersdex.com ***

Performing Asynchronous operation

Hi
I have 2 operations to perform one is to upload data and the second is
to generate report. Both take huge time(more than 20 mins and I believe
by that time session would have expired) and hence has to be done
asynchronously.
For uploading data, user will click start button and the asynchronous
operation has to start immediately.
For report generation, user will enter a time when the report has to be
generated(wend date time) and press start button. The asynchronous
operation should start only at this designated time.
How can I do the above 2 operations?
Thanks
rjn
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!You need to read up on threading or use an asynchronous web service for your
first problem. Check out http://www.15seconds.com/issue/031124.htm.
For the second item, you don't say what your system is. If SQL Server, pop
the date and time into a field that can be scanned by a SQL Agent Job every
ten minutes or so. When the record is within ten minutes of the current
time, fire off a stored procedure.
If not SQL, you could achieve something similar using a file and Windows
Scheduler.
"RJN" <rjn@.yahoo.com> wrote in message
news:%23TA15ehrEHA.2000@.tk2msftngp13.phx.gbl...
> Hi
> I have 2 operations to perform one is to upload data and the second is
> to generate report. Both take huge time(more than 20 mins and I believe
> by that time session would have expired) and hence has to be done
> asynchronously.
> For uploading data, user will click start button and the asynchronous
> operation has to start immediately.
> For report generation, user will enter a time when the report has to be
> generated(wend date time) and press start button. The asynchronous
> operation should start only at this designated time.
> How can I do the above 2 operations?
> Thanks
> rjn
>
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!

Performing Asynchronous operation

Hi

I have 2 operations to perform one is to upload data and the second is
to generate report. Both take huge time(more than 20 mins and I believe
by that time session would have expired) and hence has to be done
asynchronously.

For uploading data, user will click start button and the asynchronous
operation has to start immediately.

For report generation, user will enter a time when the report has to be
generated(weekend date time) and press start button. The asynchronous
operation should start only at this designated time.

How can I do the above 2 operations?

Thanks

rjn

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!You need to read up on threading or use an asynchronous web service for your
first problem. Check out http://www.15seconds.com/issue/031124.htm.

For the second item, you don't say what your system is. If SQL Server, pop
the date and time into a field that can be scanned by a SQL Agent Job every
ten minutes or so. When the record is within ten minutes of the current
time, fire off a stored procedure.

If not SQL, you could achieve something similar using a file and Windows
Scheduler.

"RJN" <rjn@.yahoo.com> wrote in message
news:%23TA15ehrEHA.2000@.tk2msftngp13.phx.gbl...
> Hi
> I have 2 operations to perform one is to upload data and the second is
> to generate report. Both take huge time(more than 20 mins and I believe
> by that time session would have expired) and hence has to be done
> asynchronously.
> For uploading data, user will click start button and the asynchronous
> operation has to start immediately.
> For report generation, user will enter a time when the report has to be
> generated(weekend date time) and press start button. The asynchronous
> operation should start only at this designated time.
> How can I do the above 2 operations?
> Thanks
> rjn
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

performing error check on date values entered in a textbox

If you perform "Convert. ToDateTime" to the text of a textbox, the syntax should be yyyy-mm-dd. What is the syntax for performing a checking condition (so that I can output an error note if the values in the textbox are wrong rather than the whole server error screen appearing) such that I can check that the month doesn't exceed 12 and the day doesn't exceed 31 because a code such as: label1.text = Convert.ToDateTime(textbox1.text) would produce an error if the month exceeds 12 or the day exceeds 31. Thanks for the help.Why not use one of the Validator controls? There is a DataType check that can be applied to the CompareValidator (as I recall). I am not sure what it would do with yyyy-mm-dd (unless that is the format set up in regional settings) but in a pinch, you can do a custom validator...
Use the compareValidator, and set the Type to Date (making sure you also set the 'Control to Validate' property).

If you really really really want to do it in code (which is not advisable, but I have had to do it once or twice), then here is a little function I got from somebody:


Public Function IsDateValid(ByVal strDate As String) As Boolean
Try
' attempt parse
Dim dtParsed As DateTime = DateTime.Parse(strDate)
Return True
Catch ' parse failed
End Try
Return False
End Function

IsDateValid("200323") returns false
IsDateValid("20/12/2004") returns true

Not sure if it will work with yyyy-mm-dd, but try and and let us know.

HTH

Jagdip

Performing issues

Hi guys,
What is faster to IIS, a Code Behind file or a In Code aspx file?
When we call for a Class like dim f as new MyClass if it's a big class,
will it take longer to run? or the IIS only access the funcions that we call
inside the class when we call it?
Thanks
Bruno Alexandre
Kbenhavn, Danmark
"a portuguese in Denmark"An ASPX file is parsed at run-time to MSIL, which is then compiled to a
native image. A DLL is MSIL, so it takes fewer operations to compile it to a
native image. Of course, caching mechanisms make most of that moot, as the
resources are no continually being re-compiled.
HTH,
Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com
If the Truth hurts, wear it.
"Bruno Alexandre" <bruno.in.dk@.gmail.com> wrote in message
news:uL60f$E6GHA.3508@.TK2MSFTNGP06.phx.gbl...
> Hi guys,
> What is faster to IIS, a Code Behind file or a In Code aspx file?
> When we call for a Class like dim f as new MyClass if it's a big class,
> will it take longer to run? or the IIS only access the funcions that we
> call inside the class when we call it?
> Thanks
> --
> Bruno Alexandre
> Kbenhavn, Danmark
> "a portuguese in Denmark"
>
>
Hi Kevin,
but I'm not talking about DLL, only VB files (classes) and having the code
in the same page or separete one.
I dont thing that the IIS will take my hole site and put it in diferent
DLL's (there is an option in framework 2.0 that we can do that into one DLL)
but this is not my point.
Bruno Alexandre
Kbenhavn, Danmark
"a portuguese in Denmark"
"Kevin Spencer" <uce@.ftc.gov> escreveu na mensagem
news:uhr08DH6GHA.3508@.TK2MSFTNGP06.phx.gbl...
> An ASPX file is parsed at run-time to MSIL, which is then compiled to a
> native image. A DLL is MSIL, so it takes fewer operations to compile it to
> a native image. Of course, caching mechanisms make most of that moot, as
> the resources are no continually being re-compiled.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> Software Composer
> http://unclechutney.blogspot.com
> If the Truth hurts, wear it.
> "Bruno Alexandre" <bruno.in.dk@.gmail.com> wrote in message
> news:uL60f$E6GHA.3508@.TK2MSFTNGP06.phx.gbl...
>

Performing issues

Hi guys,

What is faster to IIS, a Code Behind file or a In Code aspx file?

When we call for a Class like dim f as new MyClass if it's a big class,
will it take longer to run? or the IIS only access the funcions that we call
inside the class when we call it?

Thanks

--

Bruno Alexandre
Kbenhavn, Danmark

"a portuguese in Denmark"An ASPX file is parsed at run-time to MSIL, which is then compiled to a
native image. A DLL is MSIL, so it takes fewer operations to compile it to a
native image. Of course, caching mechanisms make most of that moot, as the
resources are no continually being re-compiled.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com
If the Truth hurts, wear it.

"Bruno Alexandre" <bruno.in.dk@.gmail.comwrote in message
news:uL60f$E6GHA.3508@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

Hi guys,
>
What is faster to IIS, a Code Behind file or a In Code aspx file?
>
When we call for a Class like dim f as new MyClass if it's a big class,
will it take longer to run? or the IIS only access the funcions that we
call inside the class when we call it?
>
Thanks
>
--
>
Bruno Alexandre
Kbenhavn, Danmark
>
"a portuguese in Denmark"
>
>
>
>


Hi Kevin,

but I'm not talking about DLL, only VB files (classes) and having the code
in the same page or separete one.
I dont thing that the IIS will take my hole site and put it in diferent
DLL's (there is an option in framework 2.0 that we can do that into one DLL)
but this is not my point.

--

Bruno Alexandre
Kbenhavn, Danmark

"a portuguese in Denmark"

"Kevin Spencer" <uce@.ftc.govescreveu na mensagem
news:uhr08DH6GHA.3508@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

An ASPX file is parsed at run-time to MSIL, which is then compiled to a
native image. A DLL is MSIL, so it takes fewer operations to compile it to
a native image. Of course, caching mechanisms make most of that moot, as
the resources are no continually being re-compiled.
>
--
HTH,
>
Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com
>
If the Truth hurts, wear it.
>
"Bruno Alexandre" <bruno.in.dk@.gmail.comwrote in message
news:uL60f$E6GHA.3508@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

>Hi guys,
>>
>What is faster to IIS, a Code Behind file or a In Code aspx file?
>>
>When we call for a Class like dim f as new MyClass if it's a big class,
>will it take longer to run? or the IIS only access the funcions that we
>call inside the class when we call it?
>>
>Thanks
>>
>--
>>
>Bruno Alexandre
>Kbenhavn, Danmark
>>
>"a portuguese in Denmark"
>>
>>
>>
>>


>
>

Performing multiplication in web form??

I need to multiply two numbers together on a web form and I have no idea how to do that. Here is the code that I wrote to try to perform this calculation:

if (txtQuantity.Text != null)
{
lblPrice.Text = intPrice * intQuantity;
}

I'm sure this is simple enough, but I'm new to ASP.NET and C# and not sure how this is supposed to work. Both values are coming from, as you can see, txtQuantity.text and lblPrice.text, both of which are strings. I found a couple of explanations about performing calculations online, but it was clearly written for more advanced users. A code sample would be great!

Take care


if (txtQuantity.Text != null)
{
lblPrice.Text = (intPrice * intQuantity).ToString();
}

How do I put txtQuantity.text and lblPrice.text into the variables. I just tried and I get an "cannot convert string to int" error.

Take care


long q=int.Parse(txtQuantity.Text);
long p=int.Parse(txtPrice.Text);

Note that int.Parse() will throw an exception if txtQuantity.Text is, say, "Fred" or "Hi" rather than something that can be parsed as a number.

Performing MATH on database query results

Hello,

I have an page that is doing a query on a database and returning the results to the screen. The end result I need is that the page will send an email that has two columns, one for element name, and one for the calculated percentage. Essentially, I have the following...

I get a list of records that contain a timedate value and a value of trur or false in a col called 'value' These are up/down alerts for various servers(elements) I need to calculate to 4 decimal places, the amount of uptime for the reported time period and send that out via email. Can anyone help? Thanks!!!

Joe

Hi Joe,

I'm not sure we have enough information, but assuming that true is up and false is down, you could do a

SELECT COUNT(*) FROM theTable WHERE theDate between(date1 AND date2) AND Value = true

...(or 1, in some DBs). By the way, Value is probably not a good field name -- reserved words should never be used to name database objects -- but that's another issue.

Once you have a count of the true records and a count of the false records, it's easy to take those two numbers and divide the true number by the sum of the true and false checks. That's your percentage, though you can't make it accurate to 4 decimal places unless you have a big enough number (at least a hundred thousand "up" values).