Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

popup window

Status
Not open for further replies.

Moxy1

Programmer
Aug 29, 2002
75
US
i'm new to this asp.net stuff so talk slowly.

here is what i'm trying to do. page has a gridview on it. one of the fields is a dropdown list. if the user selects a specific value than i want to a popup window to open requesting additional details. The process will get to my RegisterStartupScript(cstype, "PopupScript", cstext, true), however it does not execute the script.


Column:
Code:
        <asp:TemplateField HeaderText="Action" SortExpression="action" >
            <ItemTemplate>
                <asp:DropDownList runat="server" ID="itemRes" CssClass="resBox" AutoPostBack="true"  OnSelectedIndexChanged="Index_Change"></asp:DropDownList>
            </ItemTemplate>
        </asp:TemplateField>

Code Behind:
Code:
    protected void Index_Change(Object sender, EventArgs e)
    {
        //***Session Variables******************************************************
        string conn = HttpContext.Current.Session["conn"].ToString();
        //**************************************************************************

        GridViewRow clickedRow = ((DropDownList)sender).NamingContainer as GridViewRow;
        int rowIndex = clickedRow.RowIndex;

        DropDownList tResolution = (DropDownList)(mainGrid.Rows[rowIndex].FindControl("itemRes"));

        int resolution = Convert.ToInt32(tResolution.Text);

        if (resolution != -1)
        {
            AlertRetrieve requireNote = new AlertRetrieve();
            bool isNoteNeeded = requireNote.isOtherRes(conn, resolution);

            if (isNoteNeeded == true)
            {

        //====================================================
        Type cstype = this.GetType();

        // Get a ClientScriptManager reference from the Page class.
        ClientScriptManager cs = Page.ClientScript;

        // Check to see if the startup script is already registered.
        if (!cs.IsStartupScriptRegistered(cstype, "PopupScript"))
        {
            string cstext = "openOther();";
            cs.RegisterStartupScript(cstype, "PopupScript", cstext, true);
        }
        //====================================================
    }

javascript:
Code:
function openOther() {
    var oReturnValue = showModalDialog('/WebSite1/dashboard/othRes.aspx', null, 'unadorned:yes;dialogHeight:300px;dialogWidth:500px;status:no;center:1');

    alert(oReturnValue.forname + "\n" + oReturnValue.surname);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top