Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Problems with a gridview in a modalpopupextender

$
0
0

Hello,

I have a page aspx like this:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="Bouwgegevens.WebForm2" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title><style type="text/css">
            .modalBackground {
                background-color: #819FA2;
                filter: alpha(opacity=70);
                opacity: 0.7;
            }

            .modalPopup {
                background-color: #FFFFFF;
                border: 1px solid #819FA2;
                padding: 6px;
                max-height: 100%;
                border-radius: 6px;
            }
        </style></head><body><form id="form1" runat="server"><ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager><div><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:Panel ID="pnlPopUpArtikel" runat="server"><asp:Button ID="btnCancel" runat="server" Text="Cancel" /><asp:GridView ID="GrvPopup" CssClass="grvContent" runat="server" AutoGenerateColumns="False" DataKeyNames="WetTekstID"
                    GridLines="None" CellPadding="0" ShowHeader="False"><Columns><asp:BoundField DataField="Wet_Omschrijving" HtmlEncode="false" HeaderText="Wet_Omschrijving" ReadOnly="True" SortExpression="Wet_Omschrijving"></asp:BoundField></Columns></asp:GridView></asp:Panel><asp:Button ID="btnShowPopup" runat="server" Text="Button" OnClick="Button1_Click" /><ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender5" runat="server" TargetControlID="btnShowPopup" PopupControlID="pnlPopUpArtikel"
                BackgroundCssClass="modalBackground" CancelControlID="btnCancel"></ajaxToolkit:ModalPopupExtender></ContentTemplate></asp:UpdatePanel></div></form></body></html>

 

and a code behind .cs

using Bouwgegevens.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Bouwgegevens
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        DBBouwgegevensEntities _context = new DBBouwgegevensEntities();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            var source = (from a in _context.tbl_WetTeksten
                          where a.WetTekstID == 13
                          select new
                          {
                              a.WetTekstID,
                              a.Wet_Titel,
                              a.Wet_Omschrijving
                          }).ToList();

            GrvPopup.DataSource = source;
            GrvPopup.DataBind();
        }
    }
}

When thegridview is not in thepanelwithModalPopupExtender, it works. Butit does not workin this example.What am I doingwrong.

Kind regards Mark

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>