Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Confirmation() before delete Datagrid Item

    Hello there!!!

    I want to take a Yes/No confirmation from user by displaying a MessageBox of YesNo Type while deleting an item from a DataGrid which will help to define whether Item should be delted or not (that is next steps should be proceed or just exit from the Procedure).

    My other functions in ASP.NET (VB.NET) like Add, Edit, Delete of DataGrid are working fine but I want to display a MsgBox for the confirmation of Delete the selected item.


    Thanx
    SK

  • #2
    New Coder
    Join Date
    Oct 2005
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    if(MessageBox.Show("Are you Sure?",MessageBoxButtons.YesNo)==DialogResult.Yes)
    {
    
    //write code
    
    }
    else
    {
    
    //write code
    
    }
    hope this is what you want
    Thanx
    Abhi
    Handshakeit

  • #3
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Quote Originally Posted by handshakeit
    Code:
    if(MessageBox.Show("Are you Sure?",MessageBoxButtons.YesNo)==DialogResult.Yes)
    {
    
    //write code
    
    }
    else
    {
    
    //write code
    
    }
    hope this is what you want
    Thanx
    Abhi
    Handshakeit

    I have mentiond this to you in another thread as well, windows forms applications are not the same as asp.net web applictions. MessageBox doesn't exists in asp.net. This has to be done with javascript.

    s13khan - Take a look at this article, it should give you an idea:
    http://www.codeproject.com/aspnet/Cl...nfDataGrid.asp

    Good luck;

  • #4
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got u. but the javascript over there was called by C# Code. But Can you tell me how to convert this C# codes into VB code ?


    Quote Originally Posted by Brandoe85
    I have mentiond this to you in another thread as well, windows forms applications are not the same as asp.net web applictions. MessageBox doesn't exists in asp.net. This has to be done with javascript.

    s13khan - Take a look at this article, it should give you an idea:
    http://www.codeproject.com/aspnet/Cl...nfDataGrid.asp

    Good luck;

  • #5
    New Coder
    Join Date
    Oct 2005
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You want this in VB

    Code:
    if ( e.Item.ItemType == ListItemType.AlternatingItem 
        || e.Item.ItemType == ListItemType.Item 
        || e.Item.ItemType == ListItemType.SelectedItem )
    {
         e.Item.Cells[0].Attributes.Add( "onClick", "return ConfirmDeletion();" );
    }
    here it is
    Code:
    if(e.( e.Item.ItemType == ListItemType.AlternatingItem 
        || e.Item.ItemType == ListItemType.Item 
        || e.Item.ItemType == ListItemType.SelectedItem ) then
    e.Item.Cells[0].Attributes.Add( "onClick", "return ConfirmDeletion();" )


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •