Heres another way of accessing AppSettings
Add a Class to the project like this one
Imports System.Configuration
Public Class MyWebConfig
Public Shared ReadOnly Property ConnectionInfo() As String
Get
Return ConfigurationSettings.AppSettings("ConnectionInfo")
End Get
End Property
End Class
In your project you could access the appsettings using
"MyWebConfig.ConnectionInfo"
Wednesday, June 29, 2005
Thursday, June 23, 2005
Enter key press in Web Forms
Heres the way to handle enter key buttons in forms
Add a onKeyPress event handler to body tag in aspx page
<body onkeypress="KeyPress()">
If you wish to call a button click even to be fired on enter key press then add the following code
<script language="javascript">
<!--
function KeyPress()
{
if (window.event.keyCode == 13)
{
window.event.keyCode =0;
document.all.btnAdd.click();
// the button for which button click event is to be fired
}
}
// -->
</script>
If in case you dont want the form to be posted on enter key, and the form to be posted only on click of the button then add this
<script language="javascript">
<!--
function KeyPress()
{
if (window.event.keyCode == 13)
{
window.event.keyCode =0;
}
}
// -->
</script>
Add a onKeyPress event handler to body tag in aspx page
<body onkeypress="KeyPress()">
If you wish to call a button click even to be fired on enter key press then add the following code
<script language="javascript">
<!--
function KeyPress()
{
if (window.event.keyCode == 13)
{
window.event.keyCode =0;
document.all.btnAdd.click();
// the button for which button click event is to be fired
}
}
// -->
</script>
If in case you dont want the form to be posted on enter key, and the form to be posted only on click of the button then add this
<script language="javascript">
<!--
function KeyPress()
{
if (window.event.keyCode == 13)
{
window.event.keyCode =0;
}
}
// -->
</script>
Subscribe to:
Posts (Atom)