.NET Framework Developer Center > .NET Development Forums > JScript for the .NET Framework > To display a Yes/No dialog box after reading a file !!
Ask a questionAsk a question
 

AnswerTo display a Yes/No dialog box after reading a file !!

  • Friday, October 30, 2009 6:58 AMKarthizen Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

    I have a scenario where I need to look out for a file & if it exists then I need to popup a dialog box with YES/NO buttons prompting the user to select either of the two buttons. 

    If the user selects YES then I will execute some block of code & similarly for NO.  I have used confirm method using JavaScript, but it shows OK/CANCEL & I have called it on click event.  Here I am not going to call in the click event where as after searching a file.

    Please find below the code I have used so far,

    protected void btn_submit_Click(object sender, EventArgs e)
        {
    READFILE();
    }





    private
    void READFILE()
    { try {
    string FILE_NAME = "appset.txt"; if (File.Exists(FILE_NAME)) { // I need to populate the message box here like “Are you want to update?” // if YES { Some code here } // if NO else
    { Some code here } } } catch (Exception EX) { Alert.Show(EX.Message); } } Regards,
    Karthizen
    • Edited byKarthizen Friday, October 30, 2009 6:59 AMNo signature
    • Edited byKarthizen Friday, October 30, 2009 7:02 AMpreview was not good
    •  

Answers

  • Friday, October 30, 2009 12:57 PMKarthizen Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi,

    With the help of one gentleman I realised the error in flow of the application & I redesigned the application in such a way that it will look out for the file during page load event, I have called the OK/CANCEL dialog on button click & depending on the existense of file, it will update the file.

    Thanks,
    Karthizen
    • Marked As Answer byKarthizen Friday, October 30, 2009 12:57 PM
    •  

All Replies

  • Friday, October 30, 2009 12:57 PMKarthizen Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi,

    With the help of one gentleman I realised the error in flow of the application & I redesigned the application in such a way that it will look out for the file during page load event, I have called the OK/CANCEL dialog on button click & depending on the existense of file, it will update the file.

    Thanks,
    Karthizen
    • Marked As Answer byKarthizen Friday, October 30, 2009 12:57 PM
    •