Skip navigation

Category Archives: Programming

Sometimes, we need to use pageLoad() function in both MasterPage and ContentPage to get something done. But, if we add two function with such same name, that function residing in ContentPage will be ignored by the browser. To correct this behavoiur, we need to extend pageLoad() functoin in MasterPage as follows:

In MasterPage

function pageLoad(sender, args)
{
...
// ... do my MasterPage JavaScript stuff...
...
if (window.contentPageLoad) {
window.contentPageLoad(sender, args);
}
}

In ContentPage

function contentPageLoad(sender, args)
{
// do something
}

Credit goes to devioblog.

Sometimes, we need to include files while publishing our web application in Visual Studio. But, those files (e.g. pdf) are not published together. In that case, make sure the file is in project. Right-click the file and if you see ‘Include in Project’, it means that file is not part of project yet. Then, right-click the file again. Select properties and set these values:

Build Action: Content
Copy to Output Directory: Do not copy (This is to copy the file to Bin folder.)

Firefox doesn’t recognise innerText property. Below is the fix.

var AmountLabelControl = document.getElementById('lblAmount');

var amount;

if (AmountLabelControl.textContent) {
// Firefox...
amount = AmountLabelControl.textContent;
}
else if (AmountLabelControl.innerText) {
// IE...
amount = AmountLabelControl.innerText;
}

This is a known issue. Add following CSS class to your page.

.IE8Fix
{
z-index:100;
}

And, apply that CSS to your menu’s DynamicMenuStyle.


            

Credit goes to km Web Solutions.

We cannot directly simulate click event in Firefox. Add the following code to register mouseclick event for the button.

HTMLElement.prototype.click = function() {
var evt = this.ownerDocument.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
this.dispatchEvent(evt);
}

Then, you may call the event in Firefox as if you do in IE.

For client-side button:

document.getElementById('btnUpdate').click();

For server-side button:

document.getElementById('').click();

Undesired Behaviour: I tried to call a ASP.Net Ajax Modal Popup from master page code and child page has got one HTML iFrame. Modal Popup didn’t appear while the code was executed.

Fix: Add runat=”server” tag to iFrame and make it server-side element. Behaviour was corrected.

Follow

Get every new post delivered to your Inbox.