Display in another window and retrieving value

Discussion in 'ASP .Net Building Controls' started by J, Sep 9, 2003.

  1. J

    J Guest

    Poping the window up is not a problem, however, a modal
    window is impossible(at least I don't think it is
    possible without an ActiveX control or client side
    application.)

    Depending on what you are using to display the
    information:

    DataGrid:
    -------------------------------------------------
    <asp:TemplateColumn>
    <ItemTemplate>

    <input type="button" value="Select This User"
    onclick="window.open('Default.aspx?UserID=<%#
    DataBinder.Eval(Container.DataItem, "UserID") %>',
    null, 'toolbar=no, menubar=no, scrollbars=no, top=0,
    left=0, height=300 width=600');">

    </ItemTemplate>
    </asp:TemplateColumn>

    The Redirected Page
    --------------------------------------------------
    In the page load event:

    Dim UserID As String
    UserID = Request("UserID")

    If UserID = Nothing Then

    Page.FindControl("FormName").Controls.Add(New
    LiteralControl("<SCRIPT>alert('There was no information
    about the user.\n\nThis window will now
    close.');self.close();</SCRIPT>"))

    Exit Sub
    End If

    '===============================
    '== Your Processing Code Here ==
    '===============================



    If you want the user to make a selection to the pop up I
    would suggest redirecting to the page where the changes
    need to take effect and then redirecting back to the host
    page. There are several ways that you can track the user.
    If you need help with this let me know.

    Datagrid Redirect To Different Page
    -------------------------------------------

    <asp:TemplateColumn>

    <ItemTemplate>

    <input type="button"
    value="Select This User" onclick="self.location
    = 'Default.aspx?UserID=<%# DataBinder.Eval
    (Container.DataItem, "UserID") %>';">

    </ItemTemplate>

    </asp:TemplateColumn>

    The Redirected Page
    --------------------------------------------------
    In the page load event:

    Dim UserID As String
    UserID = Request("UserID")

    If UserID = Nothing Then

    Page.FindControl("FormName").Controls.Add(New
    LiteralControl("<SCRIPT>alert('There was no information
    about the user.\n\nThis window will now
    close.');self.close();</SCRIPT>"))

    Exit Sub

    End If

    '===============================
    '== Your Processing Code Here ==
    '===============================

    Hope This Helps,

    Jeff
     
    J, Sep 9, 2003
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.