Po przeładowaniu strony, zdarzenia w jQuery nie zawsze się podpinają. Trzeba to zrobić tak:
// Podpięcie zdarzeń po postbacku:
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(bindEvents);
// Po załadowaniu się strony.
$(document).ready(bindEvents);
// Podpięcie zdarzeń.
function bindEvents()
{
// kliknięcie na tabeli:
$("table#tableElements").click(clickOnTable);
}
Obsłużenie zdarzeń po np. kliknięciu na dynamicznie dodane nowe elementy:
// Ustawiam zdarzenia na tabeli. I wtedy nieważne czy się dodało dynamicznie nowe elementy.
function clickOnTable(event)
{
var target = $(event.target);
if (target.is('a.lnkEditMenu')) return clickEditMenu(target);
if (target.is('a.lnkDeleteElement')) return deleteElement(target);
if (target.is('a.lnkEditElement')) return editNoteElement(target);
};
źródło: part 1, part 2
Development
JavaScript, jQuery
Whole process looks very simple: grab VSS, produce text file, run SVN and consume produced file.
- Download and install (unpack) vss2svn
- Run vss2svn.exe
vss2svn.exe --vssdir \\vss\repository\path
- That will produce
file which will be consume by svnadmin
- [Optional]: compress and send vss2svn-dumpfile.txt file. I’m using 7-zip:
"{PathTo7-Zip}\7-Zip\7z.exe" a "%DATE% vss2svn-dumpfile.7z" "vss2svn-dumpfile.txt" -t7z -mx9 -aoa
- Run svnadmin, use vss2svn-dumpfile.txt
"{PathToSVN Server}\VisualSVN Server\bin\svnadmin" load "E:\SVN Repositories\BackupVSS" < "vss2svn-dumpfile.txt"
- And thats it.
Whole script might look like this:
E:
CD E:\Vss2Svn\
vss2svn.exe --vssdir \\vss\repository\path
:: ### Optional compression, you might do this if you want send file somewhere else ###
"C:\Program Files (x86)\7-Zip\7z.exe" a "%DATE% vss2svn-dumpfile.7z" "vss2svn-dumpfile.txt" -t7z -mx9 -aoa
:: ### SVNAdmin ###
"C:\Program Files (x86)\VisualSVN Server\bin\svnadmin" load "E:\SVN Repositories\BackupVSS" < "vss2svn-dumpfile.txt"
Tools
HowTo, Subversion, SVN, Visual Source Save, VSS
This little function converts HTML characters (for example brackets < >) to entities (like < >).
function escapeHTMLEncode(str)
{
var div = document.createElement('div');
var text = document.createTextNode(str);
div.appendChild(text);
return div.innerHTML;
}
Source: http://sanzon.wordpress.com
Development
HowTo, JavaScript
Add following code to file: FCKEditor\editor\fckeditor.html
window.onload = function()
{
// 25-11-2008 Han: Fixing the issue with the backbutton, when the back/forward button is hit then the html to display is
// still HTMLEncoded which will cause the control to display html control sequences in the editor.
// The easiest solution is probably to always htmldecode the value before it is beaing displayed in the editor, this can be done
// using the statement below.
// FCK.LinkedField.value=FCKTools.HTMLDecode(FCK.LinkedField.value);
FCK.LinkedField.value=FCKTools.HTMLDecode(FCK.LinkedField.value); // THIS LINE
InitializeAPI(); // existing code line
.......
}
After adding the code line you will have to make sure that the javascript is downloaded to the client, so in your browser delete the local files ( tools->internet options->delete files).
And then it should all work as expected.
Source: FCKEditor forum
Development
FCKEditor, HTML Editors, Problems
- Get webservice.htc (eg. from here),
- Copy it to the same directory as the Web page that uses the behavior. By placing the webservice.htc file in the same directory as your HTML page that calls it, you avoid any DHTML behavior-related cross-domain security issues,
- Attach WebService behaviour to an element using the STYLE attribute f.e.:
<body id="webServiceCaller" STYLE="behavior:url(webservice.htc)"></body>
- Establish friendly name for WebService:
<script language="JavaScript" type="text/javascript">
function loadService()
{
webServiceCaller.useService("http://address.to.your.service/YourService.wsdl", "MyService");
}
</script>
- Load service with page load:
<body id="webServiceCaller" STYLE="behavior:url(webservice.htc)" onload="loadService()">
//...
</body>
- Create handler for WebService result:
function handleResult (result)
{
if (!result.error)
{
alert("Success! Result: " + result.value);
}
else
{
alert("Failed! Error: " + result.errorDetail.string);
}
}
- Call WebService method:
You don’t have to specify result handler, you can insteed handle the onresult event in webServiceCaller.
- Whole code listing:
<header>
<script language="JavaScript" type="text/javascript">
function loadService()
{
webServiceCaller.useService("http://address.to.your.service/YourService.wsdl", "MyService");
}
function handleResult (result)
{
if (!result.error)
{
alert("Success! Result: " + result.value);
}
else
{
alert("Failed! Error: " + result.errorDetail.string);
}
}
function myMethodAsync()
{
callID = webServiceCaller.MyService.callService(handleResult, "MyMethod", "Asynchronous Call");
}
</script>
</header>
<body id="webServiceCaller" style="behavior:url(webservice.htc)">
<button id="callAsynch" onclick="myMethodAsync()">Call Asynchronously</button>
</body>
Based on: Web Services: Calling Service Methods
About WebServices: MSDN: About the WebService Behavior
Development
JavaScript, WebService
- SecurityTrimming doesn’t work with Menu control and when Windows authentication is used. Menu becomes invisible or only root node is visible.
Create root node as
<siteMapNode url=”home.aspx” title=”Home” roles=”*”>.
If it still doesn’t work try to add roles attribute to other siteMapNodes.
- How to refresh an UpdatePanel using JavaScript?
Use __doPostBack() method in JavaScript code:
function someFunction ()
{
__doPostBack('UpdatePanel1', '');
// or try this if code above doesn't work:
// __doPostBack('<%= UpdatePanel1.ClientID %>', '');
}
Development
AJAX, asp.net, JavaScript, Problems
Error: The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension ‘.csdl’, ‘.ssdl’, or ‘.msl’, or a URI that identifies an embedded resource.Source: forums.microsoft.com
ADO.NET Entity Framework
OS: Vista x64
Platform: VS 2008
The catch is that apparently the designers are not supported on 64-bit machines. You should copy two files from %windir%\Microsoft.NET\Framework64\v3.5 to %windir%\Microsoft.NET\Framework\v3.5:
- Microsoft.Data.Entity.Build.Tasks.dll
- Microsoft.Data.Entity.targets
then restart Visual Studio and rebuild your solution.
Tools
ADO.NET, Entity Framework, Problems, Visual Studio 2008
Error: The selected file is not a valid solution file.
Platform: VS 2008
Description: When one trying to use VisualSourceSafe 2005 with VisualStudio 2008 one get above error.
Solution:
- First install Visual Source Safe 2005 Update CTP
- Next run as administrator the following command: regsvr32 “%programfiles%\Microsoft Visual SourceSafe\tdnamespaceextension.dll”
Source: http://blogs.msdn.com/richardb
Tools
Problems, Visual Studio 2005, Visual Studio 2008