Triggering a server-side event from a client-side
-
Short version All I need is that, in a ModalPopUp, when the DoubleClick event of a ListItem fires, the click event of my OK button should be executed. Detail I have a ModalPopUpExtender, which hosts a user control. The user control has an OK and a Cancel button. Along with that, it has a dynamic ListBox added to it(may be more). So far, I've considered the following possible solutions: 1. Use Ajax.Net. But, I cannot afford to have a WebMethod. 2. Use a ClientScriptCallBack. This will need a lot of JavaScript, since I have made almost every control dynamic. Is there any other way apart from using an UpdatePanel?
जय हिंद
-
Short version All I need is that, in a ModalPopUp, when the DoubleClick event of a ListItem fires, the click event of my OK button should be executed. Detail I have a ModalPopUpExtender, which hosts a user control. The user control has an OK and a Cancel button. Along with that, it has a dynamic ListBox added to it(may be more). So far, I've considered the following possible solutions: 1. Use Ajax.Net. But, I cannot afford to have a WebMethod. 2. Use a ClientScriptCallBack. This will need a lot of JavaScript, since I have made almost every control dynamic. Is there any other way apart from using an UpdatePanel?
जय हिंद
That's easy. Assuming there is a double click event at all ( and if not, you could fake one ), you just hook that up to javascript, which calls the script to fire the OK button.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
That's easy. Assuming there is a double click event at all ( and if not, you could fake one ), you just hook that up to javascript, which calls the script to fire the OK button.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
How I wish it was that easy, unfortunately some browsers disable that ability and even then for some reason it doesn't always work. You can however you
Page.ClientScript.GetPostBackEventReference(Control, String)
to do this.Using the wrong tool for the job is half the fun.
-
That's easy. Assuming there is a double click event at all ( and if not, you could fake one ), you just hook that up to javascript, which calls the script to fire the OK button.
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
Christian Graus wrote:
Assuming there is a double click event at all ( and if not, you could fake one )
Done that and its working fine.
Christian Graus wrote:
you just hook that up to javascript, which calls the script to fire the OK button.
Are you referring to
PageMethods.MethodName()
? I don't want to use it since it will make the event a WebMethod.जय हिंद