Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to validate the data in ajax model popup window???when I was traying to validate the text box in pop up after validating the data the pop up is closing ...the focus is not in text box ..how can I restrict dis any one can help me plz
Posted
Comments
hypermellow 11-Sep-14 5:35am    
... can you post your code?
dhjhfkjdhsa 11-Sep-14 5:43am    
If validating the text box ...when I enter the value in text box it should check with data base data thn only it shld add

This is the save button code in pop up window
C#
protected void btnSave_Click(object sender, EventArgs e)
    {
        string category = txtCategory.Text;
        if (category == "")
        {
            Message.Text = "Category name cannot be empty";

        }
        else
        {
            string value = addSkillBLL.CheckCategory(txtCategory.Text);
            if (value != "")
            {
                Message.Text = "Category Name already exists";
                txtCategory.Focus();

            }
            else
            {
                addSkillBLL.InsertCategory(txtCategory.Text);
                BindCategories();
                ddlCategory.SelectedIndex = ddlCategory.Items.Count - 1;
                Message.Text = "Category Name added sucessfully";
                Reset();
            }
        }
    }
 
Share this answer
 
v3
Hello.

First you add a namespace.

using AjaxControlToolkit; (If you are using C#)

Here we intend to keep the popup open even after performing some task on the popup window. To achieve this, write a code to remain the popup open.


C#
private void button1_Click(object sender, System.EventArgs e)
{
   // Your code
   ModalPopupExtender.Show();
  
}


Once you task is achieved you can close it using ModalPopupExtender.Close();

Hope this will help you.
 
Share this answer
 
If I use ModelpopupExtender.show() method thn the pop up refreshing
 
Share this answer
 
Try using a RequiredFieldValidator for the textbox and remove the empty value checking from your code behind.

May be it helps.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900