Hay guys I am looking for some help here

I have a page in asp that I am trying to get a button to display a pop up with the value of a textbox on the parent page.

This should be a simple popup with a multiline textbox inside it that takes the value of a textbox and parses the text into a multiline view with line breaks on a double pipe ||

any help getting this started for me would be great.

The page should not use javascript and can be handled in C# code on the back end if needed.

I wish I had some code to show you all but I am at a loss as to get this started.

Thanks in advance on any help you can all give me on this problem

Hi YellowDog,
I want to try to help you...hope this helpful

from parent page :

Protected Sub CmdLocateCustomer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CmdLocateCustomer.Click
        If TxtCustomerId.Value.Trim = "" Then
            ClearTextBox()
            Dim S As String = "<SCRIPT>var w = 0, h = 0;if (document.all || document.layers) { w = screen.availWidth;   h = screen.availHeight; }var popW = 900, popH = 500;var leftc = (w - popW) / 2, topc = (h - popH) / 2;w_Locate = window.open('../../Browse/LocateAllCustomerMaster.aspx?CustomerID=form1.TxtCustomerId&CustomerName=form1.TxtCustomerName&OnClick=CmdLocateCustomer','w_Locate','scrollbars=yes,left=' + leftc + ', top=' + topc + ',width=900,height=500');w_Locate.focus();</SCRIPT>"
            ScriptManager.RegisterClientScriptBlock(Page, Me.GetType(), "Key", S, False)
        Else
            FillContactPerson()
        End If
End Sub

and this is from child page

Protected Sub GVCustomer_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GVCustomer.SelectedIndexChanged
        Dim Row As GridViewRow = GVCustomer.SelectedRow
        Dim ID As String = Row.Cells(1).Text.Trim
        Dim Name As String = Row.Cells(2).Text.Trim
        Dim StrJScript As String = ""

        StrJScript = "<SCRIPT>window.opener." & HttpContext.Current.Request.QueryString("CustomerID") & ".value = '" & ClearSpace(Row.Cells(1).Text.Trim) & "';</SCRIPT>"
        If Not ClientScript.IsClientScriptBlockRegistered("S1") Then
            ClientScript.RegisterClientScriptBlock(Me.GetType(), "S1", StrJScript)
        End If

        StrJScript = "<SCRIPT>window.opener." & HttpContext.Current.Request.QueryString("CustomerName") & ".value = '" & ClearSpace(Row.Cells(2).Text.Trim) & "';</SCRIPT>"
        If Not ClientScript.IsClientScriptBlockRegistered("S2") Then
            ClientScript.RegisterClientScriptBlock(Me.GetType(), "S2", StrJScript)
        End If


        'to refresh parent page (call FillContactPerson() method)
        If Not HttpContext.Current.Request.QueryString("OnClick") Is Nothing Then
            StrJScript = "<SCRIPT>window.opener.document.forms[0]." & HttpContext.Current.Request.QueryString("OnClick") & ".click();</SCRIPT>"
            If Not ClientScript.IsClientScriptBlockRegistered("S3") Then
                ClientScript.RegisterClientScriptBlock(Me.GetType(), "S3", StrJScript)
            End If
        End If

        StrJScript = "<SCRIPT>window.close();</SCRIPT>"
        If Not ClientScript.IsClientScriptBlockRegistered("S4") Then
            ClientScript.RegisterClientScriptBlock(Me.GetType(), "S4", StrJScript)
        End If
 End Sub

Thanks

Create a class and add these two methods to it :

// for postback events
public static void ShowMessageBox(string _message)
    {
        Page page = HttpContext.Current.Handler as Page;
        page.RegisterStartupScript("key2", "<script>alert('" + _message +  "');</script>");
    }

// for async postback events
 public static void ShowMessageBoxForAsync(string _message)
    {
        Page page = HttpContext.Current.Handler as Page;
        ScriptManager.RegisterClientScriptBlock(page,page.GetType(), "key2", "alert('" + _message + "');", true);
    }

// Then you can call this in, let's say , button_click event handler like this ( i assume that your class name is Utilities without any namespace definition) :
protected void myButton_Click(object sender, EventArgs e)
{
Utilities.ShowMessageBox("you entered a wrong password");
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.