Apertura popup da gridview

domenica 18 maggio 2008 - 14.50

squilibrio Profilo | Expert

Ciao a tutti, sto facendo mille prove per caricare una popup utilizzando il valore di un DDL della riga del gridview

ho fatto questo

protected void gwElenco_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

DropDownList ddlProssimaOwner = (DropDownList)e.Row.FindControl("ddlProssimaOwner");

Helper.PresentationHelper.FillWithOwner(ddlProssimaOwner.Items, sqlConnection);
ddlProssimaOwner.Items.Insert(0, new ListItem("Seleziona...", null));

}
}



protected void gwElenco_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
ImageButton btnCalendar = (ImageButton) e.Row.FindControl("btnCalendar");
DropDownList ddl = (DropDownList) e.Row.Cells[1].FindControl("ddlProssimaOwner");
btnCalendar.Attributes.Add("onlick","javascript:window.open('AgendaPopup.aspx?IDOwner=" + ddl.SelectedValue + "','Dettaglio','width=500, height=500, menubar=no, scrollbars=yes, resizable=yes');");
}
}


due problemi:

non accade nulla al click dell'immagine


al postback (dopo il click dell'immagine) visualizzo

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 61: DropDownList ddlProssimaOwner = (DropDownList)e.Row.FindControl("ddlProssimaOwner");
Line 62:
Line 63: Helper.PresentationHelper.FillWithOwner(ddlProssimaOwner.Items, sqlConnection);
Line 64: ddlProssimaOwner.Items.Insert(0, new ListItem("Seleziona...", null));
Line 65:




e se per ipotesi tolgo quelle righe dal metodo RowCreated, quando clicco sull'immagine non viene aperto nulla, non accade nulla

cosa sbaglio?

Grazie
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5