I tried to respond yesterday but the MSDN website crapped out again, I love
this site but it's stablity is getting worse.
Question: Why isn't OnTextChanged really 'Onchange'? It's really 'lostfocus'
becasue it doesn't fire until focus is lost!
I'm running a routine to update a label field (see response trail for more
info). But since the firing of this routine occurs once the button is
pressed, thus losing focus on a textbox, it stops the 'submit'.
I really need some sort of true onchange. I've tried onfocus but that's not
really correct since the user might enter but not change. Please read the
trail for more detail. I'd love to get your take on what I'm trying to
accomplish, thanx.
"re****@community.nospam" wrote:
I am not sure exactly what you are asking for but you can easily create
your own PostBack event either by using a secondary invisible code and
then attaching it manually using ControlName.Attributes.Add method or
you could register a PostBackHandler and handle it that way also. After
that it merely becomes a matter of finding out exactly what javascript
event you want it fired upon.
e.g.
myServerTextBox.Attributes.Add("onchange",
GetPostBackClientEvent(InvisibleControl, ""); or alternately
myServerTextBox.Attributes.Add("onchange",
GetPostBackClientEvent(myServerTextBox, "onchange");
And then either through your IPostBackHandler or by hacking and
looking at the EventArgument in the Textbox's postback handler event
String EventArgument = this.Page.Request["__EVENTARGUMENT"];
if (EventArgument==null) { EventARgument = ""; }
EventArgument = EventArgument.ToLower();
switch(EventArgument)
{
case "onchange" .... break;
case "onlosefocus": ... break;
}
etc
I would definitely see if what you can do can be done without a
postback event as postback events upon key clicks is extremely annoying
and probably one of the biggest bastardizations brought to the net by
asp.net