- height,
- width or
- position (absolute)
Monday, November 26, 2007
No filter applied to <span> or <div> tags..
.. unless one of the following attributes is specified:
Friday, June 01, 2007
Capturing F1 in javascript
Developing Web applications for IE may require to custom action instead of the popup of Windows Internet Explorer Help.
OnKeyPress doesn't gets fired when pressing functional keys, however, we are able to capture F1 by inserting the following script:
<script language="javascript">
document.onhelp = function()
{
alert("help"); // instead of an alert you can define custom content
return false; // necessary for cancel original F1 event
}
</script>
OnKeyPress doesn't gets fired when pressing functional keys, however, we are able to capture F1 by inserting the following script:
<script language="javascript">
document.onhelp = function()
{
alert("help"); // instead of an alert you can define custom content
return false; // necessary for cancel original F1 event
}
</script>
Vertical alignment in DIV panel
There is no such attribute or style attribute like 'valign' or 'vertical-align' for DIV panels. And 'text-align' only sets the horizontal alignment of a DIV's content. However, if you wish to position the content vertically in the middle, you may use the 'line-height' attribute:
<div style="width: 100px; height: 100px; line-height: 100px; text-align: center; border: 1px solid red;">acontent</div>
Special thanks to Erika :).
<div style="width: 100px; height: 100px; line-height: 100px; text-align: center; border: 1px solid red;">acontent</div>
content
Special thanks to Erika :).
Wednesday, May 16, 2007
Monday, February 26, 2007
Hidden field's value gets lost
Hidden fields loose their value on postback, when the container they are placed in, is disabled. However, when they get disabled, their value is kept.
Wednesday, February 21, 2007
Friday, February 09, 2007
Make a page refresh after a form submit
Guess what happens, if you insert new records in a datatable on a button click, then press F5, or the refresh button of the browser?! The same record is going to be inserted again. I found this very annoying.
A simple solution: redirect to the same page at the end of the button click event handler.
private void SaveClicked(object sender, EventArgs e)
{
// insert a record somewhere in a datatable
Response.Redirect(itself); // itself being the URL of the current page
}
Thursday, January 25, 2007
Create ActiveX Component in .Net
1. Create a new Class Library project.
2. When the project is created, add a new User Control to it, then add the controls, methods and properties you need.
3. To make it work, you need to expose the interface for the control. This is how COM/COM+ objects will know which are the properties they can use.
...
namespace ActiveXComponent
{
public interface IActiveXControl
{
string Title{ set; get ; }
...
}
public class ActiveXControl : System.Windows.Forms.UserControl, IActiveXControl
{
private string _title;
public string Title
{
get { return _title; }
set { _title = value; }
}
...
}
}
4. Compile the project, and copy the resulted .dll in your client application. Then embed the created user control in a web page.
<OBJECT id="ActiveXControl 1" name="ActiveXControl 1" classid="ActiveXComponent.dll#ActiveXComponent.ActiveXControl"></OBJECT>
5. You can make use of it's exposed methods and properties on client side. For example:
<script language = "javascript">
var myctrl1 = document.getElementById('ActiveXControl1');
myctrl1.Title = 'My first activeX component';
<script>
Subscribe to:
Posts (Atom)