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 Behind:
javascript:
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);
}