I have a modalpopup extender attached to a panel, inside which resides two asp.net buttons. Each of these had the normal "Onclick" attribute assigned to them. However, when they were clicked, no postback was occuring.
From some reading around, it appears that this is by design, and that the buttons are there for this to be closed.
So how do you get round this?
You can attach a javscript client side event that mimmicks the behaviour of what happens with asp anyway, by forcing the postback to take place.
Firstly, in the head of your page, define a function that ensures that the page is valid first, and then causes the postback to take place (the validation part is crucial for this to work.
function doPostback(sender,e)
{
if(Page_IsValid)
{
__doPostback(sender,e);
}
else
{
return false;
}
}
Now in your code behind, tell your buttons to call this:
btnSaveUserDetails.OnClientClick = "javascript:return doPostback('" + btnSaveUserDetails.UniqueID + "');";
It is important here that the uniqueID is used, as this ensures that any controls that are nested pass the right details to the postback function.
And ta da, they now work!
Tuesday, 27 April 2010
Monday, 26 April 2010
modalpopupextender event fires but does not show
I lost half a day of my life to this silly mistake today.
I had on my page a panel, with a modal popupextender. When I clicked a link that ran a serverside mdlPopup.show() or a client side $('mdlPopup').show(), the events fired, but no modal popup showed.
The reason for this was because I had set the "visible" attribute of my panel to "false", rather than setting the style of it to "display:none"!
Silly....
I had on my page a panel, with a modal popupextender. When I clicked a link that ran a serverside mdlPopup.show() or a client side $('mdlPopup').show(), the events fired, but no modal popup showed.
The reason for this was because I had set the "visible" attribute of my panel to "false", rather than setting the style of it to "display:none"!
Silly....
Tuesday, 30 March 2010
The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
When starting IIS 7 under Vista or Windows 7, you receive the error from the IIS Manager saying "The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)"
The reason for this is well documented, and it is because you have another site setup with the same binding - in english, this means you have two sites setup that are configured to use the same port (probably 80).
In my circumstances, this was confusing because I had only one IIS instance and this was bound to port 80, but wouldn't start.
So, to find out what was conflicting, I went to the command prompt and typed:
NETSTAT -ano
This showed an entry of address 0.0.0.0 using port 80 up!
This also showed the process ID of 4400, so I looked in task manager and found that this was Skype.exe
After digging through the advanced settings in Skype, it appears that by default, Skype decides to listen on ports 80 and 443 for incoming connections (probably to appeas firewalls), so unticking this allowed my IIS to start.
Useful to find out, but it took a while!
The reason for this is well documented, and it is because you have another site setup with the same binding - in english, this means you have two sites setup that are configured to use the same port (probably 80).
In my circumstances, this was confusing because I had only one IIS instance and this was bound to port 80, but wouldn't start.
So, to find out what was conflicting, I went to the command prompt and typed:
NETSTAT -ano
This showed an entry of address 0.0.0.0 using port 80 up!
This also showed the process ID of 4400, so I looked in task manager and found that this was Skype.exe
After digging through the advanced settings in Skype, it appears that by default, Skype decides to listen on ports 80 and 443 for incoming connections (probably to appeas firewalls), so unticking this allowed my IIS to start.
Useful to find out, but it took a while!
Tuesday, 5 January 2010
ie don't print filename
I needed to convert a webpage into a pdf today, and using PDFCreator, this is normally a doddle.
However, whenever I did, it printed the address to the footer of the page.
After much faffing around, I found that under the page setup are "headers" and "footers". If you delete what is in those fields, it stop ie and firefox printing the filenames and page numbers.
However, whenever I did, it printed the address to the footer of the page.
After much faffing around, I found that under the page setup are "headers" and "footers". If you delete what is in those fields, it stop ie and firefox printing the filenames and page numbers.
Monday, 4 January 2010
XPath select attributes containing a string
I needed to find a way to use XPath to select items from within a html document, that would return back to me all UL tags that had an id that contained the word "menu".
To find all the UL's, it is simple enough to do:
However, to select the id of "menu", I then found:
What I ended up with, to find any ULs that contained the word "menu" in the id attribute was:
To find all the UL's, it is simple enough to do:
//UL
However, to select the id of "menu", I then found:
//ul[@id='menu']
What I ended up with, to find any ULs that contained the word "menu" in the id attribute was:
//ul[contains(@id,'menu')]
Thursday, 31 December 2009
Reset AutoIncrement Number in MySQL
To reset your autoincrement number, you can simply run the following SQL:
ALTER TABLE 'table_name' AUTO_INCREMENT = X
Where X is the ID number you want to set the increment start point to, so running
ALTER TABLE 'table_name' AUTO_INCREMENT = 0
resets the ID increment process, and
ALTER TABLE 'table_name' AUTO_INCREMENT = 1023
Would set the start seed to 1023 - sometimes useful for making things looked "used", for example with order systems.
ALTER TABLE 'table_name' AUTO_INCREMENT = X
Where X is the ID number you want to set the increment start point to, so running
ALTER TABLE 'table_name' AUTO_INCREMENT = 0
resets the ID increment process, and
ALTER TABLE 'table_name' AUTO_INCREMENT = 1023
Would set the start seed to 1023 - sometimes useful for making things looked "used", for example with order systems.
Making changes to overall_header.php in phpBB do not take effect
I have been, for some time, trying to make changes to the code in the header file for phpBB. These were not changes for functionality, rather links required to other parts of the site.
Anyway, I had made the changes locally in my local copy of the overall_header.php file of the prosilver theme, but I ftp'd them up, the changes didn't happen.
Frustrated, I spent some time checking what phpBBs admin area said was in the file using the built in editor, and it said my changes were done.
However, what it doesn't say is that once you've made any changes to page files or style documents, you have to run the PURGE ALL feature from the admin control panel to flush out cached copies!
Ran that, and hey presto, fixed.
Anyway, I had made the changes locally in my local copy of the overall_header.php file of the prosilver theme, but I ftp'd them up, the changes didn't happen.
Frustrated, I spent some time checking what phpBBs admin area said was in the file using the built in editor, and it said my changes were done.
However, what it doesn't say is that once you've made any changes to page files or style documents, you have to run the PURGE ALL feature from the admin control panel to flush out cached copies!
Ran that, and hey presto, fixed.
Subscribe to:
Posts (Atom)