K
KK
Hi
I have an HtmlInputImage.
at the client, for onClick there is a javascript.
I want the button to be posted as well so that I can handle
the event in the server as well (In case Javascript is disabled or not
supported)
What I currently do is
MyControl : WebControl,IPostBackDataHandler,INamingContainer,
IPostBackEventHandler{
onInit(){
controlButton.ServerClick+=new
ImageClickEventHandler(controlButton_ServerClick);
Page.RegisterRequiresPostBack(this);
Page.RegisterRequiresRaiseEvent(this);
}
private void controlButton_ServerClick(object sender, ImageClickEventArgs
e)
{
Debug.WriteLine("server click");
}
public void RaisePostBackEvent(string eventArgument)
{
controlButton_ServerClick(this,null);
}
}
This way, when the client clicks the image, javascript handles it at client
side and
I am able to call the controlButton_ServerClick() server side function
within
the RaisePostBackEvent().
But I think I am doing something wrong. Shouldn't the Page framework be
calling my serverclick event?? (without me having to call the buttons click
event
explicitly?)
thanks
KK
I have an HtmlInputImage.
at the client, for onClick there is a javascript.
I want the button to be posted as well so that I can handle
the event in the server as well (In case Javascript is disabled or not
supported)
What I currently do is
MyControl : WebControl,IPostBackDataHandler,INamingContainer,
IPostBackEventHandler{
onInit(){
controlButton.ServerClick+=new
ImageClickEventHandler(controlButton_ServerClick);
Page.RegisterRequiresPostBack(this);
Page.RegisterRequiresRaiseEvent(this);
}
private void controlButton_ServerClick(object sender, ImageClickEventArgs
e)
{
Debug.WriteLine("server click");
}
public void RaisePostBackEvent(string eventArgument)
{
controlButton_ServerClick(this,null);
}
}
This way, when the client clicks the image, javascript handles it at client
side and
I am able to call the controlButton_ServerClick() server side function
within
the RaisePostBackEvent().
But I think I am doing something wrong. Shouldn't the Page framework be
calling my serverclick event?? (without me having to call the buttons click
event
explicitly?)
thanks
KK