Single ModalPopupExtension for serveral object

Last post 07-08-2008 10:44 PM by stephensaw. 4 replies.

Sort Posts:

  • Single ModalPopupExtension for serveral object

    07-08-2008, 2:17 AM
    • Member
      13 point Member
    • stephensaw
    • Member since 01-16-2007, 6:29 AM
    • Posts 44

    Hi,

     I have 2 buttons and 2 textbox, both button will show a modal popup showing list of products to choose from, and the chosen product name will be populate back to the respective textbox. I can share the modal popup with the 2 buttons, I also can populate back the selected item, but how I write codes that can determine which textbox should the value goes to?

     Thanks

  • Re: Single ModalPopupExtension for serveral object

    07-08-2008, 6:23 AM
    • Member
      6 point Member
    • deepak.shirke
    • Member since 05-22-2008, 5:25 AM
    • Mumbai
    • Posts 6

    How did you manage to share same modalpopup for two buttons coz there are different ways and solution can be different for each... so plz post ur code.

  • Re: Single ModalPopupExtension for serveral object

    07-08-2008, 6:27 AM
    • Member
      572 point Member
    • binukumar
    • Member since 02-12-2008, 4:16 AM
    • Kumar
    • Posts 124

     set a public flag / hidden field / session when you click each button.

    as per your click the value in the flag / hidden field / session will be different in each case

    thus you can set the value to respective text boxes

    Do remember to mark this as Answer if this fix your problem

    Thanks & Regards
    BinuKumar S
  • Re: Single ModalPopupExtension for serveral object

    07-08-2008, 9:17 AM
    Answer
    • Member
      712 point Member
    • TCavins
    • Member since 05-23-2007, 2:06 PM
    • Detroit, MI
    • Posts 186

    Create a generic method that both buttons call to show the modal popup.

    Give each button a different CommandArgument.

    Create a hidden field in the modal popup and save this value there.

    Public Sub SowModal(ByVal sender As Object, ByVal e As System.EventArgs)

    Dim strWhichButton As Button = CType(sender, Button)

    Dim strArgument As String = strWhichButton.CommandArgument

    ' Populate the hidden field in the modal popup
    hdnButton.Value = strArgument

    ' Show the modal popup
    myModal.Show()

    End Sub

    When closing the modal popup, retrieve the value from the hidden field and that will determine which textbox to populate.

    Tim

  • Re: Single ModalPopupExtension for serveral object

    07-08-2008, 10:44 PM
    • Member
      13 point Member
    • stephensaw
    • Member since 01-16-2007, 6:29 AM
    • Posts 44

    Thanks :)

Page 1 of 1 (5 items)