Click here to Skip to main content
11,485,294 members (77,392 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Javascript
protected void Button1_Click(object sender, EventArgs e)
    {
        if ((DropDownList1.SelectedItem.Text == "---- Select ----") || (TextBox1.Text == "") || (TextBox2.Text == ""))
        {
            Label1.Visible = true;
            Label1.Text = "All fields are mandatory, can not left blank.";
            TextBox1.Text = "";
            TextBox2.Text = "";
        }
        else if ((TextBox1.Text != TextBox2.Text))
        {
            Label1.Visible = true;
            Label1.Text = "Confirm Password does not match, Try Again.";
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox1.Focus();
        }
        else
        {
            string lsUsrName, lsPwd;
            lsUsrName = DropDownList1.SelectedItem.Text;
            lsPwd = TextBox1.Text;
 
            Response.Write("<script>var resp = window.confirm ('Are you sure want to change password?');alert(resp);</script>");
 
        }
    }



alert message is giving the correct , which i select, how to store it in a c# variable for further process?????? Help me experts ....
Posted 15-Jan-13 1:04am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,

Hidden Field is way but there are some security constrain so be careful.

Read this [^]
  Permalink  
Comments
KManishS at 15-Jan-13 6:55am
   
how to use it in my code?????
Suvabrata Roy at 15-Jan-13 7:02am
   
document.getElementById('id').value=resp;
KManishS at 15-Jan-13 7:53am
   
done it, not working...
Suggest experts.
Suvabrata Roy at 15-Jan-13 8:11am
   
you can use query string.
Or Read this article Link
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,

For your problem you can use ModalPopupExtender control from Ajax toolkit. Steps:-

1. Add a Modal Popup Extender to your .aspx page and then add two buttons on it.

2. Open that popup by calling :- ModalPopup1.show()

3. Now add the event to your 'OK' button.

If you need any other assistance please put comment. I will help you.

Thanks!
  Permalink  
Comments
KManishS at 15-Jan-13 8:03am
   
permission deny to use AJAX, any other solution Sir???
KManishS at 16-Jan-13 8:24am
   
any sample???

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 380
1 Maciej Los 365
2 Mehdi Gholam 210
3 Frankie-C 134
4 OriginalGriff 134
0 Sergey Alexandrovich Kryukov 8,819
1 OriginalGriff 7,982
2 Sascha Lefèvre 3,199
3 Maciej Los 2,841
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100