|
Since you haven't provided any code, I'll have to take a guess: your event handler is wired up multiple times.
There are several ways event handlers can be wired to events in ASP.NET; if you've used more than one, then the event will be fired multiple times.
- If AutoEventWireup[^] is set to "True", methods with names like
Page_Load will automatically be wired up to the equivalent event. - If you're using VB.NET, adding the
Handles clause to a method will wire it up to the specified event. - If you have an
OnEventName="Handler" attribute in your markup, that method will be wired up to the specified event. - If you have a
default.aspx.designer.cs / default.aspx.designer.vb file in your project, you might find that it contains code to wire up the event handler.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a C# ASP Web project where I’m required to produce a 200+ page PDF to eventually download and open on the browser. I have no experience in building a PDF file, and I was wondering if someone could point me in the right direction. I need a component / product / method that would be able to handle such a large report.
Thank you in advance.
|
|
|
|
|
|
Okay, maybe I posed the question incorrectly.
I have researched, and I've even tried a few products, and they're either inefficient or hang when they grow past 5 pages.
I guess if I could rephrase my question, it would be...
What is the most TRIED and efficient PDF printing library which most developers use?
|
|
|
|
|
Actually, the most important aspect to your question is one you haven't addressed, and that is if you are only interested in free components. Most free PDF components are not very good. Also if there are some you have already discounted you should state what they are so people know not to advise things you have already discounted.
|
|
|
|
|
In future please post in one forum only.
|
|
|
|
|
I posted a message in the SQL forum but I think it was the wrong place. This is my problem. When I do an ExecuteNonQuery statement string from a c# client I am adding C# variables to the hard coded ExecuteNonQuery statement from the client as such:
string sqlQuery = "UPDATE rights SET category_key = " + toCat + " WHERE rights_key = @rights_key";
QueryContainer Instance = new QueryContainer(sqlQuery);
ExecuteNonQuery(sqlQuery);
<pre>
Also when I do an SQL ExecuteScaler statement I am using from a C# client I am adding C# variables to the hard coded values in the SQL statement Execute ExecuteScaler client like this:
<pre>
queryString.Append(" SELECT isnull(");
queryString.Append(" (SELECT CASE WHEN convert(smalldatetime, '" + valDateMaterialRequired + "') < (getdate() + isNull(hier_asp_config.late_days_num, 3)) THEN '1' ELSE '0' END");
queryString.Append(" FROM hier_asp_config ");
queryString.Append(" WHERE asp_key = " + aspKey + " )");
queryString.Append(" , CASE WHEN convert(smalldatetime, '" + valDateMaterialRequired + "') < (getdate() + 3) THEN '1' ELSE '0' END)");
return ExecuteScaler(queryString.ToString()).ToString();
<pre>
Now in the Class that calls the actual SQL I am using these techniques:
<pre>
protected int ExecuteNonQuery(string queryString)
{
int returnValue = 0;
if (!_iserror)
{
if (_trace)
DoTrace("TAMIS.Data.Loader.ExecuteNonQuery", queryString);
if (_connection == null || _connection.State == ConnectionState.Closed)
{
OpenConnection();
}
DbCommand command = _provider.CreateCommand();
command.Connection = _connection;
command.CommandText = queryString;
command.CommandType = CommandType.Text;
if (_useTransaction) { command.Transaction = _transaction; }
try
{
returnValue = command.ExecuteNonQuery();
}
catch (Exception e)
{
if (e is EntryPointNotFoundException)
throw e;
RollBack();
LogBLL bll = new LogBLL();
bll.WriteErrorLog(e);
_iserror = true;
}
finally
{
if ((!KeepAlive && _connection.State == ConnectionState.Open) || _iserror == true)
{
CloseConnection();
}
}
}
else
{
returnValue = -1;
}
return returnValue;
}
<pre>
And this:
<pre>
protected object ExecuteScaler(string queryString)
{
object returnValue = null;
if (!_iserror)
{
if (_trace)
{ DoTrace("TAMIS.Data.Loader.ExecuteScalar", queryString); }
if (_connection == null || _connection.State == ConnectionState.Closed)
{
OpenConnection();
}
DbCommand command = _provider.CreateCommand();
command.Connection = _connection;
command.CommandText = queryString;
command.CommandType = CommandType.Text;
if (_useTransaction) { command.Transaction = _transaction; }
try
{
returnValue = command.ExecuteScalar();
}
catch (Exception ex)
{
if (ex is EntryPointNotFoundException)
throw ex;
RollBack();
LogBLL bll = new LogBLL();
bll.WriteErrorLog(ex);
_iserror = true;
}
finally
{
if ((!KeepAlive && _connection.State == ConnectionState.Open) || _iserror == true)
{
CloseConnection();
}
}
}
else
{
returnValue = -1;
}
return returnValue;
}
<pre>
These are clearly giving me SQL injection errors. In my case I cant change the code to stored procedures like they should be so How do I make the C# variable values from my client calling code and still work but not give me SQL injection errors?
|
|
|
|
|
You change it in the same way you would if you were using a stored procedure - by using parameters.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am creating a basic company website with MVC5 and bootstrap theme.
Requirements for the website are a dynamic side-menu navigation that when clicked will show the appropriate content on body of the website and a blog-like page for news-posts. CRUD operations for menu-content and news-posts will be needed.
Project will be uploaded on Microsoft Azure . My question is what to choose for a cheap database option. Obvious choices are local sql( mdf file) or SQL server on azure but we
want to search the possibility of using azure storage (blob?) but I have no experience with it.
Does the choice of storage(blob) has any advantages over the sql solutions for such a project and what are those in terms of price/performance/ease of implementation ? What do you think it is the best option of those 3 for a small website with mostly text and some images for content with basic dynamic capabilities and small traffic expectations.
If I chose AZURE STORAGE-BLOB just for RnD reasons are there any quick guides on how to implement similar project with azure storage you can recommend ?
Thanks for your help.
|
|
|
|
|
I'm trying to play mp4 video just by starting an appropriate process
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = fullpath;
process.Start();
fullpath is a file path/name on the server.
When I run it while in development mode, it's working fine.
But when upload and run the site from the server, nothing happens. IIS is configure properly, mp4 MIME is there. I don't get any errors, just nothing happens. What could that be? Any ideas?
Regards
|
|
|
|
|
esb77 wrote: fullpath is a file path/name on the server. So you are trying to run it on the server.
|
|
|
|
|
It worked locally because the server where your code was running was also the client, and your code was probably running as the logged in user.
When the web server is remote the process is running on the server so the mp4 is playing on the server, assuming the code is running under an account that has access to the hardware like the speakers. When a tree falls in the woods and no-one is there, does it make a sound? When your code is playing an MP4 on the server and no-one is there to listen to it, is it playing at all? Who knows.
You're not going to get this code to work, if you want to play MP4s on the client you need the code to run on the client. Look into the html5 video element or flash players.
|
|
|
|
|
I have an old application (using ASP.NET 2.0) running well on several IIS version from 6 to 7.5, but have a strange behaviour on 8.0/8.5
The application uses the Microsoft Ajax library on the client side, and the code goes like this:
<html>
<head>
.. all the styles and scripts included here...
</head>
<body>
...the markup of the page goes here...
<script>
Sys.Application.add_load(function (sender, args) {
if (!args.get_isPartialLoad()) {
window.radopen('/Michlol3/GeneralPages/Agreement.aspx?guid=421b25ef-9815-4588-861a-08ecb17f7e5e', 'idAgreementWindow');
}
});
Sys.Application.initialize();
...more in-page script here...
</script>
</body>
<html>
From all IIS versions it looks the same and all content in place, but, when served from IIS 8.0/8.5 (2012 or 2012 R2 server) the window Agreement.aspx never opened...
This code is pure client-side and I can not understand how it related to the IIS version, but the only difference between the two tested environments is the version (of the OS and IIS)...
I'm aware that this is not a good question, and I'm not looking for a direct solution, but more for ideas of what to check more...Of course, if you had the same problem and got any solution - do not hesitate to share ...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
As far as I can see, the .NET 2.0 / 3.5 version of MicrosoftAjax.js is completely broken in Windows 8.1 / Server 2012. The functions registered via add_load or add_init are never called.
The only workaround I've found is to use a version from an older OS, or the Microsoft CDN:
https://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js[^]
<asp:scriptManager runat="server" ...>
<scripts>
<asp:scriptReference
name="MicrosoftAjax.js"
path="https://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js"
/>
</scripts>
</asp:scriptManager>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You saved the day!!!
I will ask Chris to let upvote an answer a million time...Meanwhile get a 5!!!
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Hi,
Anybody having idea about video calling and text chat, Kindly share your ideas. Am using mod verto freeswitch webRTC concept.
Regards
Sri
|
|
|
|
|
Try a Google search, you may be pleasantly surprised.
|
|
|
|
|
How to link windows form module within Web application?
If it is possible using Web Services, than how i can use web service?
Pls anyone help me its urgent
|
|
|
|
|
|
Ok
|
|
|
|
|
using MVC for visual studio 2013, suddenly realized that there is some limitation when it comes to how controls are rendered.
there appears to be fierce debate on a design view and why its needed, but if there is a tool that does design view, where is it?
I would tend to use webforms and put everything in absolute position because it would never be resized and never used on mobile.
now? it has to be modern and mobile ready. mvc is new, i had not needed to know CSS in depth. Trying to place controls on a simple Create page? horizontal layout, labels on the left then input boxes on the right of that with mostly empty space, the labels word wrap. it would be nice to see where its defining the margins, it cannot be that hard to make some tool that at least gives a snapshot with design grid lines.
the original comments i am reading are from 2010 and 2011 where some say the design view is almost here? now its 2015, and others say its just too hard to make this kind of tool. or why do you need a designer anyway? whats wrong with counting pixels?
is there some good reason why the designer or some snapshot is not needed? guessing at where the controls will land is not a waste of time?
im grateful for any guidance on this
|
|
|
|
|
I've never used design view...when it doesn't crash VS it is slow and just doesn't work. I just have my browsers open and view the site in them as I make changes. It is hard to get working design pages because you can't emulate all browsers.
|
|
|
|
|
when i try with the browser? placing components is just a guess. make a change, refresh it moves a bit more, bit more then all the way to the edge of the wrong side. take back the value and it jumps to the wrong place.
hours trying to use the browser. i made a webform to use the design view, created the control, set it to absolute, etc copied the html into the MVC view page im working on? and it lands where ever it wants. inline style position absolute, size this/that. page does not place it where it seems it should go.
not trying to be negative but unless im missing something obvious its frustrating and seems to be arbitrary, dont know how others can put controls that way.
all i am asking for is some way to snapshot what the coordinates cause on the result. viewing on the browser? full 15 seconds until it displays, just to chase a control on the screen takes ALOT of time
|
|
|
|
|
The proper effective use of css is a skill, no doubt about it, a skill that takes a long time to master, or even get good at. These days most companies employ people just to do css so they can focus on that and ensure it works on all browsers. Luckily this means I haven't had to touch css is about 10 years
Your main problem might be the fact that you're thinking about web pages like windows forms, where things are positioned. Instead you need to think about html like a giant game of Tetris where the elements "flow", and find their place like throwing objects into a bucket. You need to think about margins and padding as a way of keeping things distant, with floats dictating if everything stacks on top of each other like a tower, or if they can fall beside each other.
|
|
|
|
|
thanks thats a good explanation. i used this in years past and didnt have to worry about mobile browsers or resizing much; fitting and floating... well i still wish to have a snapshot of what the browser will "think" about the resulting program like that mode in Word where you turn on the hidden characters.
i read about Microsoft folks saying in 2010 or 2011 how they will have a design view soon; i just cannot fathom why its so hard. i do think about things from win forms or labview styling. but your comment helped
|
|
|
|