It is because you are taking the ModalPopupExtender inside Gridview and hence you are unable to access it.
What you can do is take the ModalPopupExtender outside the gridview. Following code might help.
In the aspx page:
<cc1:ModalPopupExtender BackgroundCssClass="modalBackground" ID="ModalPopupExtender1" PopupControlID="pnlEdit" TargetControlID="default" runat="server"></cc1:ModalPopupExtender>
<asp:Button ID="default" runat="server" style="display:none"/>
<asp:Panel ID="pnlEdit" runat="server" CssClass="modalpopup" Direction="LeftToRight" style="display:none"> Your Code here
And on the Click event of Image button :-
protected void ImageButton3_Click(object sender, EventArgs e)
{
ModalPopupExtender1.Show();
}
Hope This helps you :)