By the power of google... http://malsup.com/jquery/block/[^]
Torsten Mauz
Posts
-
Blocking UI -
missing operand ??The DataTable has no built in support for this, you'll basically have to roll your own. Check out this article: Select DISTINCT on DataTable[^] Your other option would of course be to just grab all the rows using DataTable.Select() then de-dupe the returned array.
-
SQLBULKCOPY class - number of records copiedLooking at the MSDN docs there's no nice way of doing this. Their examples all suggest doing a "pre-work" row count, then doing the BulkCopy, then doing a "post-work" row count (which will obviously give you the final count). http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx[^] There is an event fired
SqlRowsCopied
but it looks like it only fires after a fixed number of rows have been copied (so if you set theNotifyAfter
property to 50 and copy 99 rows you'll only get notified once), although it might fire when it completes as well (I'll leave that for you to check). http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.sqlrowscopied.aspx[^] HTH -
web services don't workOk in that case - the Webmethod is returning the type
SearchResponseSearchResult
which will have some series of properties (you'll probably find that the datatable is one of them), if you are using VStudio you can use object explorer to examine that object otherwise you'll be able to find the webservice proxy class to see the class definition ofSearchResponseSearchResult
. Then you should be able to do something like :Client.localhost.SearchResponseSearchResult objResult = serv.Search(var1, var2); DataTable appsearch; if(objResult.DataTableProperty ! = null) { appsearch = objResult.DataTableProperty; }
-
web services don't workDataTable name is not set
- kind of gives the game away. The webservice has issues that need resolving, i.e. the DataTable object they are trying to return needs to have it's
TableName
property set before it can be serialised. If you have access to the webservice code then you'll need to fix that. Otherwise you'll have to get in touch with whoever is responsible for the service. HTH -
How to Clear the Numbers..The below will work in IE. It will be easy enough to make cross browser - I just don't have the time at the moment (but the same principals will apply).
function checkKey()
{
var key = event.keyCode;
var ch = '';if (document.selection) { var sel = document.selection.createRange(); if(key == 46) { sel.expand("character"); ch = sel.text; if(isNaN(ch)) return false; } if(key == 8) { sel.move("character", -1); sel.expand("character"); ch = sel.text; if(isNaN(ch)) return false; } }
}
HTH
-
Popup Blocker Detection using JavascriptYou'll also want to remove the marked line, as the window does't exist when that code executes you can't call the close method... if(!test) { test.close(); alert("A popup blocker was detected."); } else { test.close(); alert("No PopUp Detected"); }
-
IE7 Javascript Problemhehe - one of those ;)
-
IE7 Javascript ProblemWierd, just done a tiny test myself using your code and get a number as you'd expect from elements.length Here is the code I ran:
function checkForm() { alert(document.forms.length); var numElements = document.forms[0].elements.length; alert(numElements); return true; } The first alert gives "1" and the second gives "5". If your form isn't too huge perhaps you could paste in the code that's giving you this wierd behaviour. HTH
-
Redirect to Paypal [modified]Look at the url you are trying to redirect to.... http://www.paypal.com/cgi-bin/webscr&cmd=\_xclick&business=xyz@xyz.com It should be: http://www.paypal.com/cgi-bin/webscr**_?_**cmd=\_xclick&business=xyz@xyz.com
-
Javascript and databaseYes it is possible, but unless you really really really need to (and even if you think you need to you probably don't and you certainly shouldn't) then don't.
var objConn = new ActiveXObject('ADODB.Connection');
var objRs = new ActiveXObject('ADODB.Recordset');objConn.Open(conn_string);
objRs.Open('SELECT * FROM table', objConn, 2, 3);if(!objRs.BOF)
{
objRs.MoveFirst();
while(!objRs.EOF)
{
document.writeln(objRs.Fields("title").Value +'<br/>\n');
objRs.MoveNext();
}
}It will work, but you will have to have extremely low security settings in IE (it will only work in IE). The user will also get a couple of security warnings which you can't get rid of. The above is provided merely as evidence that it is possible, if you haven't got the hint yet then I'll say once more.... please don't use this for anything other then learning. As you're using cgi-mail, you obviously have access to some server-side technology so use that for communicating with your DB. HTH
-
IE7 Javascript Problemtry something like this
function checkForm()
{
var frm = document.getElementById('form1');
var strError = 'The following fields are required:\n';
var bValid = true;
var child;for(var i = 0; i < frm.childNodes.length; i++) { child = frm.childNodes.item(i); if(child.nodeType == 1) { if(child.tagName.toString().toLowerCase() == 'input') { if(child.type.toString().toLowerCase() == 'text') { if(child.value == '') { strError += '\\n'+ child.id.toString(); bValid = false; } } } } } if(!bValid) alert(strError); return bValid;
}
Works in both FF and IE7. It only checks input text's at the moment so you'll need to change it so that it's a bit more useful, but it should get you going. HTH
-
Javascript file existing checking [modified]Off the top of my head, probably not (at least not without some wierd tricks), but feel free to try it and let us know how you get on :)
-
Remove toolbar, address bar, status bar, etc from a pageThe simple answer is that you can't. However, you can achieve what you want. You can only set those things up when opening a window. So you can use the following javascript:
window.open("app.htm","", "toolbar=false,location=false,status=false,menubar=false,scrollbars=false");
So basically you'll need an extra page to "launch" the application, then you can just run your application within the newly created window. HTH
-
File Upload in asp.netI'm reasonably sure that you can't. The file input does not allow you to pre-populate it with a value for security reasons. Which is why the value will not be kept between post backs.
-
Redirect to Paypal [modified]I suggest you re-read what you pasted ;) you are redirecting to the value of
strGO
, but you are filling out the paypal url in a variable calledstr
That code is sayingResponse.Redirect("");
so no wonder it's not working ;) HTH -
Microsoft.Office.Interop.ExcelI only had two references I added to get that code working were: Microsoft Office 11.0 Object Library Microsoft Excel 11.0 Object Library Obviously those will vary dependant on which version of office you are developing against. Intellisense partially works in web developer express, and vs 2005. I do seem to remember that it pretty much didn't work at all in older versions of visual studio (but not 100% sure on that). It's all part of the pain of doing office automation I'm afraid X| HTH
-
ASP.NET Caching ProblemTo be honest it is more likely to be your browser caching things. Unless you have some cache directives used, then afaik asp.net will not cache your page. Try the following:
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;But you could also add the following to the top of your aspx file:
<%@ OutputCache Location="None" VaryByParam="None" %>
Or you can achieve this programatically by doing:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
HTH
-
Javascript file existing checking [modified]Ok when you said "I wish test if some client side file exists" I understood that as that you were checking the client....anyway... this will be a hell of a lot simpler ;)
Then in a script block below have this:
var imgEle = document.getElementById('myImg');
imgEle.onerror = imgError;function imgError()
{
imgEle.style.display = 'none';
}Note: CP seems to be replacing some of the code...you should replace ".removed" with ".onerror" in the 2nd line of javascript. HTH
-
Microsoft.Office.Interop.ExcelYour using statement will be
using Microsoft.Office.Core;
Just because I've been through this pain before and the documentation for automatation is awful, I thought I'd paste an old demo I had lying around...
private void ReadExcelValue()
{
object o = System.Reflection.Missing.Value;Excel.Application objE = new Excel.Application(); Excel.Workbooks objBooks = null; Excel.Workbook objB = null; Excel.Worksheet objS = null; objE.Workbooks.Open(Server.MapPath("spreadsheet.xls"), o, o, o, o, o, o, o, o, o, o, o, o, o, o); objBooks = objE.Workbooks; objB = objBooks\[(object)1\]; objS = (Excel.Worksheet)objB.Worksheets\[(object)1\]; //write out the text in cell "A1" Response.Write(((Excel.Range)objS.Cells\[1, 1\]).Text); Release(objS); if (objB != null) objB.Close(false, o, o); Release(objB); if (objBooks != null) objBooks.Close(); Release(objBooks); if (objE != null) objE.Quit(); Release(objE); GC.Collect(); System.Diagnostics.Process\[\] objPr = System.Diagnostics.Process.GetProcessesByName("Excel"); foreach (System.Diagnostics.Process pr in objPr) pr.Kill();
}
private void Release(object obj)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
}
catch { }
finally
{
obj = null;
}
}Note: It's rather ugly stuff and there's a cheesy hack to make sure that the excel process doesn't persist on the server after execution (yes it's pretty easy to end up with thousands of Excel.exe processes if you don't kill them). HTH