Link to home
Start Free TrialLog in
Avatar of JCWEBHOST
JCWEBHOST

asked on

OnClientClick

hey guys i have an asp button and two click method

OnClientClick
OnClick

i want to excute the OnClick first than OnClientClick but i do not know how to?

<asp:Button ID="btnAdd" runat="server" CssClass="button" Text="Add" ValidationGroup="a"
                            Width="90px" OnClick="btnAdd_Click"  />

see i have valiadators in my web page and when i click the button it goes into the OnClientClick method which is wrong.

it for to valiadate the page then move to OnClientClick method.

please help?
Avatar of Ivo Stoykov
Ivo Stoykov
Flag of Bulgaria image

you cannot because first into events chain comes ClientClick...

HTH

Ivo Stoykov
ASKER CERTIFIED SOLUTION
Avatar of rajapandian_81
rajapandian_81
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JCWEBHOST
JCWEBHOST

ASKER

protected void btnAdd_Click(object sender, EventArgs e)
    {
        ScriptManager.RegisterStartupScript(this, this.GetType(), "OnClientClick", "mainScreen.ShowConfirm(this,'Please confirm','Are you sure to add customers details?');", true);

        txtcellnumber.Text = "########";
    }

Open in new window


Guys this works and my javascript fires, how do i check if the uses click yes or no?

its hard to explain this, that onclick method display a message using ModalPopupExtender with a yes and no button.

my question is that my code on the above excutes

txtcellnumber.Text = "########";

before the user select yes or no.

if they a way that ScriptManager return a value to see if the user selects the yes button
thanks