|
I've seen that happen before years ago.
Web apps just run on 1 thread, unless you create a new thread as like a background worker process, like sending an email.
I think back in the day, I tries using the timer.
In my opinion, the timer is for windows applications, and not for web apps, so the timer your using is running on the server side, and not the client side.
You really want to shift timers to the client side, let the browser do that work for you.
Page.refresh set to about 30 seconds will handle that for you in HTML via the browser.
http://www.w3schools.com/tags/att_meta_http_equiv.asp[^]
|
|
|
|
|
Ok, I'll try replacing the timer by that refresh option. I have other things running server side (runat="server"), like my products table, to which I add lines depending on the product selected by the user. If I have many users selecting different products, can it have a conflict? (I did not notice any, but just to make sure)
|
|
|
|
|
I was out the door yesterday when looking at your code.
I'm totally off track here on this one.
I had to do some research, and that timer must be the Ajax extension, which runs on the client side, so that is ruled out. I had no idea they had a ajax timer object, I just use the refresh meta tag.
The page.Init and page.load use is correct. I would of done it that way.
I suspect that the issue is in the DisplaySelectedProductInfo(); or UpdateProducts
The code for that might not be very efficient, or something is not being closed or disposed of.
Try remarking out those function 1 at a time to narrow it down.
I would still just dump the timer and use the meta tag refresh.
|
|
|
|
|
Below is my aspx
<%@ Page Title="Report" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Report.aspx.cs" Inherits="Code" EnableEventValidation="false" %>
<asp:content id="Content1" contentplaceholderid="head" runat="Server">
<asp:label id="Label1" runat="server" font-bold="True" font-size="Medium" font-underline="True"
="" forecolor="#000066" text="Reports">
<asp:gridview id="GridView1" runat="server" showfooter="true" onrowdatabound="GridView1_RowDataBound"
="" width="985px" allowsorting="false" gridlines="None">
<footerstyle horizontalalign="Left" verticalalign="Middle">
<headerstyle font-bold="True" font-names="Times New Roman" font-size="Medium" font-underline="True"
="" forecolor="Blue">
<pagerstyle horizontalalign="Left" verticalalign="Top">
<rowstyle horizontalalign="Left" verticalalign="Middle">
<asp:gridview id="GridView2" runat="server" showfooter="true" allowsorting="false"
="" onrowdatabound="GridView1_RowDataBound" width="985px" gridlines="None" style="margin-left: -315px">
<footerstyle horizontalalign="Left" verticalalign="Middle">
<headerstyle font-bold="True" font-names="Times New Roman" font-size="Medium" font-underline="True"
="" forecolor="Blue">
<pagerstyle horizontalalign="Left" verticalalign="Middle">
<rowstyle horizontalalign="Left" verticalalign="Middle">
I am using the below code to export two gridviews to excel.
protected void ExporttoExcel(object sender, EventArgs e)
{
try
{
GridView[] gvList = null;
gvList = new GridView[] { GridView1, GridView2 };
ExportAv("Report.xls", gvList);
}
catch (Exception ex)
{
}
}
public static void ExportAv(string fileName, GridView[] gvs)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", fileName));
HttpContext.Current.Response.ContentType = "application/ms-excel";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
foreach (GridView gv in gvs)
{
gv.AllowPaging = false;
// Create a form to contain the grid
Table table = new Table();
table.GridLines = gv.GridLines;
// add the header row to the table
if (!(gv.Caption == null))
{
TableCell cell = new TableCell();
cell.Text = gv.Caption;
cell.ColumnSpan = 10;
TableRow tr = new TableRow();
tr.Controls.Add(cell);
table.Rows.Add(tr);
}
if (!(gv.HeaderRow == null))
{
table.Rows.Add(gv.HeaderRow);
}
// add each of the data rows to the table
foreach (GridViewRow row in gv.Rows)
{
table.Rows.Add(row);
}
// add the footer row to the table
if (!(gv.FooterRow == null))
{
table.Rows.Add(gv.FooterRow);
}
// render the table into the htmlwriter
table.RenderControl(htw);
}
// render the htmlwriter into the response
string headerTable = @"Report | " + DateTime.Now.ToString("d") + " | ";
HttpContext.Current.Response.Write(headerTable);
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
}
}
This code gives a general title called Report and date at the top of the report. Now how can I possibly give a title name for gridviews when exporting the grid to excel?
|
|
|
|
|
I want to Customize WebApi2 Oauth security provider. I want to use my own data base and own DbContext. Please help me how to do?
I am using asp.net 2013.
Thanks
|
|
|
|
|
How do i add a blog on my ASP.NET webpage
|
|
|
|
|
|
Does this download give step-by-step instructions on how to add the codes to a website.
|
|
|
|
|
|
could u till me a free gateway for sending sms from different free sms providers please could any body tell me
|
|
|
|
|
DO NOT repost.
You have already asking this exact question four times in this forum, and received several helpful answers, none of which you have replied to.
Reposting the same question over and over again will only serve to annoy the people who would otherwise be trying to help you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hi MVC4 Razor <a href="/Members/model">@model</a> - what's equivalent in ASPX view engine?
Here's how it's done with Razor - how to do the same in ASPX?
<a href="/Members/model">@model</a> IEnumerable<XYZ.Product>
@{
ViewBag.Title = "Downloads";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div>
<table>
<tr>
<th>Name</th>
<th>Description</th>
<th></th>
</tr>
<a href="/Members/foreach">@foreach</a> (var Package in Model) {
<tr>
<td>
<a href="/Members/html">@Html</a>.DisplayFor(modelItem => Package.Name)
</td>
<td>
<a href="/Members/html">@Html</a>.DisplayFor(modelItem => Package.Description)
</td>
<td>
<a href="/Members/html">@Html</a>.ActionLink("Download", "ProductDownload", Package)
</td>
</tr>
}
</table>
|
|
|
|
|
|
Thankyou Thatraja!
Question, with ASPX you declare your "Model" as such:
<% Inherits="IList<xyz.Product>" %>
Do you still use "Model" keyword when enumerating items from server side script, from "foreach"?
<ul>
<%foreach (var Product in Model)
{ %>
<li><%=Product.Price%></li>
<%} %>
</ul>
|
|
|
|
|
Sorry to disappoint you, I don't use ASPX view as I'm happy with Razor & don't like ASPX view. What happened when you tried that? Always include error message in your message.
Again I'm telling you, go with Razor. It has many advantages, see my previous message.
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
no worries Thatraja, thanks for your help!
|
|
|
|
|
i have Person table and i want access PersonId in complain table.
DataTable dt = PersonBLL.Select(new Person() { ??????? });
I create select code in BLL.
But what write in place of ????? I don't know.
plz help me...
|
|
|
|
|
Dear All,
I have scenario to encrypt the Password in client side and decrypt it in server side (C# code), this is required for a Online website.
Can any one help me on this task.
- Febin R
-
|
|
|
|
|
For using and saving passwords, you really should not be using encryption, you should really hash your passwords using a salt to be saved in the database. Here[^] is an excellent article that goes through password hashing, and goes into some depth.
Hope it helps
Everyone dies - but not everyone lives
|
|
|
|
|
Just use SSL[^]; that way, the whole request and response will be encrypted for you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
hello, I'm basically following steps as described here[^], building a new MVC4 app with my custom MembershipProvider extending from "WebMatrix.WebData.SimpleMembershipProvider".
Question is, what if I don't want to persists my users in database at all? With SimpleMembershipProvider, you must call "WebSecurity.InitializeDatabaseConnection" from "InitializeSimpleMembershipAttribute \ LazyInitializer.EnsureInitialized" at least once during startup.
Thank you!
|
|
|
|
|
I am reading a file into datatable.
In file I have 3 column but in my datatable 4.
Column 4 in datatable needs to be populated at run time before or after full file is loaded into dt.
how do I do this?
Dim lines = File.ReadAllLines(FileName)
For Each line As String In lines
dt.Rows.Add(line.Split("|"))
Next
|
|
|
|
|
What file you are trying to read from..??
|
|
|
|
|
could you share the information about exceptions.
Exp: in one class i am using more then on exception and also null bull exception.
|
|
|
|
|
One google[^] search will give you lots of results for your query..
|
|
|
|