Click here to Skip to main content
15,915,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello EveryOne...
I have requiredfieldvalidator On Textbox1 whan i click on botton1 ConfirmButtonExtender message apper on screen before the validation.
Posted
Updated 10-Aug-10 2:45am
v2
Comments
Sandeep Mewara 10-Aug-10 8:50am    
Post some code. Looks like the flow of events are not in sequence.

I think you did not read documentation of ConfirmButton. Check samples from ASP.Net and don't forget to read ConfirmOnFormSubmit Property.

ConfirmButton Demonstration[^]

still facing problem after read this check below code


XML
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
     <asp:ConfirmButtonExtender ID="cbe" runat="server"
    TargetControlID="Button1"
    ConfirmText="Are you sure you want to click this?"
    ConfirmOnFormSubmit="false"
     />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
        ControlToValidate="TextBox1" ErrorMessage="RequiredFieldValidator">
    </asp:RequiredFieldValidator>
 
Share this answer
 
Comments
koool.kabeer 10-Aug-10 14:56pm    
dont be so hurry to answer... read carefully what the OP is asking..
sagar dube 07 27-Aug-10 3:23am    
I thing u not worked properly on your answer.
raju melveetilpurayil 27-Aug-10 3:28am    
i didn't understand. avoid using chat words like 'u','v'
when you use ajax ConfirmButtonExtender your validations of page will be done after the Confirmation Message....
to avoid this you have to confirm from user using Javascript...
somewhat like this...

function checkBeforeConfirm()//put this javascript function
{
    if(Page_ClientValidate()==true)//method to check validations
    {
         if(confirm('Are You Sure with the Details?')==true)//confirm after validations check
         {
              return true;
         }
         else
         {
              return false;
         }
    }
    else
    {
         return false;
    }
}


if you have divided your validations into groups then
function checkBeforeConfirm()//put this javascript function
{
    if(Page_ClientValidate('validationGroup')==true)//method to check validations
    {
         if(confirm('Are You Sure with the Details?')==true)//confirm after validations check
         {
              return true;
         }
         else
         {
              return false;
         }
    }
    else
    {
         return false;
    }
}


on your "OnClientClick" Property of your Button call this funtion..
<asp:button id=".." ...="" onclientclick="return checkBeforeConfirm();" xmlns:asp="#unknown"></asp:button>


this you will get help from this
 
Share this answer
 
v3
Comments
raju melveetilpurayil 10-Aug-10 15:18pm    
you need one more edit. Page_ClientValidate is correct not Page_CliectValidate.
koool.kabeer 10-Aug-10 15:19pm    
yup sorry.... i didnt see that...
raju melveetilpurayil 10-Aug-10 15:24pm    
mmm ok. and don't forget I can Improve your Answer, anyway try to post good and useful answers.
koool.kabeer 10-Aug-10 15:26pm    
it was a type mistake
Sandeep Mewara 10-Aug-10 15:33pm    
It's ok koool.kabeer. From dummy code snippet point of view, typo is not an issue. Ignore.
As long as your answer helps in directing OP towards resolution, all is good. :thumbs up:

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