When working with the data controls in ASP NET 2 - like GridView and DetailsView you are always best of if you use templated columns. The simplest way to acomplish this is to start of with DataBound fields then just right click them and choose "Convert to template field.
There are two major reasons for using templated fields:
1. You get predictable names, like CTL_MyView_TemplatefieldName - which is good if you need to access them via Javascript.
2. From code behind you can get your fields like this:
TextBox t = (TextBox) ((DetailsView)sender).FindControl("tbStatusDetailTemplate");
// Lazze
The life of a computer/sci-fy/teccie-nerd :-) Interested in lots of stuff like: Net, C#, Software Architecture, IoT, building stuff (like sensors based on RPI Pico W), Cars, Books, meeting people, learning new stuff, Cyber Security
Tuesday, September 25, 2007
Monday, September 10, 2007
Sunday, September 09, 2007
Application Wide(Windows Forms) - capture Keys(like functions keys)
1) Define constants
const int WM_KEYDOWN = 0x100;
const int WM_KEYUP = 0x101;
2) Add interface, IMessageFilter
public partial class Form1 : Form, IMessageFilter
3) Make message interceptor
public bool PreFilterMessage(ref Message m)
{
Keys keyCode = (Keys)(int)m.WParam & Keys.KeyCode;
if (m.Msg == WM_KEYDOWN && keyCode == Keys.F8) // We'll just handle F8 here
{
MessageBox.Show("Key: " keyCode.ToString());
return true;
}
return false;
}
4) Add message interceptor to forms message handling(in Forms constructor)
Application.AddMessageFilter(this);
Enjoy!
//Lazze
const int WM_KEYDOWN = 0x100;
const int WM_KEYUP = 0x101;
2) Add interface, IMessageFilter
public partial class Form1 : Form, IMessageFilter
3) Make message interceptor
public bool PreFilterMessage(ref Message m)
{
Keys keyCode = (Keys)(int)m.WParam & Keys.KeyCode;
if (m.Msg == WM_KEYDOWN && keyCode == Keys.F8) // We'll just handle F8 here
{
MessageBox.Show("Key: " keyCode.ToString());
return true;
}
return false;
}
4) Add message interceptor to forms message handling(in Forms constructor)
Application.AddMessageFilter(this);
Enjoy!
//Lazze
Subscribe to:
Posts (Atom)
Lazzes Smart Home - 2023
Here is an overview of the components in the Smart Home as of now. More stuff than I tought :-)
-
If you, like me - use VLC mediaplayer to view all your media, you may have run into the same problem as I. That is, when we watch multiple m...
-
1) Define constants const int WM_KEYDOWN = 0x100; const int WM_KEYUP = 0x101; 2) Add interface, IMessageFilter public partial class Form1 : ...
-
The DivX register app is hardcoded to use the System32 folder as path for Rundll32, which of course doesn't exist on a 64bit system. So ...