I have a user control that uses ModalPopupExtender. Inside the user control, there are 2 buttons and a WebDataGrid. First column in the grid is an UnboundCheckBoxField.
When the popup comes up, displays the grid with data, I can use either of the buttons to hide the popup. The second that any row is checked (with checkboxes), the popup does not close on button clicks anymore. I have a server side event for the button "confirm" and it does not fire if a single row in the grid is checked. I noticed however that it's fine and still works if ALL or NO rows are checked. Clueless as to why that would be happening.
If a checkbox or multiple checkboxes are checked, the server side events for buttons do not fire anymore. If ALL checkboxes are checked or none, they fire fine.
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="EmployeeSelector.ascx.vb" Inherits="EmployeeSelector" %>
<%@ Register Assembly="Infragistics4.Web.v14.1, Version=14.1.20141.2392, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB" Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics4.WebUI.Misc.v14.1, Version=14.1.20141.2392, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB" Namespace="Infragistics.WebUI.Misc" TagPrefix="igmisc" %>
<style type="text/css">
.modalBackground {
background-color:#000000;
filter:alpha(opacity=80);
opacity:0.8;
}
.modalPopup
{
position:fixed;
border-radius:5px;
top:10%;
left:10px;
width:700px;
height:400px;
text-align:center;
background-color:White;
color:black;
</style>
<ajax:ModalPopupExtender ID="popup" runat="server" DropShadow="false" PopupControlID="pnlPopup" TargetControlID="lnkFake" BackgroundCssClass="modalBackground"></ajax:ModalPopupExtender>
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup">
<table>
<tr>
<td>
<asp:Button ID="btnClose" runat="server" CssClass="btn btn-xs btn-primary" OnClientClick="return Hidepopup()" Text="Close" />
</td>
<asp:Button ID="btnConfirm" runat="server" CssClass="btn btn-xs btn-primary" Text="Confirm" />
</tr>
</table>
<table style="width: 700px">
<td style="width: 70%; height: 300px">
<ig:WebDataGrid ID="dgv" AutoGenerateColumns="false" HeaderCaptionCssClass="InfraGridHead_XS" EnableAjax="false" Height="100%" Width="100%" runat="server">
<Behaviors>
<ig:Activation Enabled="true"></ig:Activation>
<ig:EditingCore BatchUpdating="true">
<ig:CellEditing>
<EditModeActions MouseClick="Single" EnableOnActive="true" />
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey="Code" ReadOnly="true" />
<ig:EditingColumnSetting ColumnKey="FullName" ReadOnly="true" />
<ig:EditingColumnSetting ColumnKey="SquadCode" ReadOnly="true" />
<ig:EditingColumnSetting ColumnKey="RankCode" ReadOnly="true" />
</ColumnSettings>
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
</ig:WebDataGrid>
</asp:Panel>
<asp:LinkButton ID="lnkFake" runat="server"></asp:LinkButton>
And here's the VB code:
Imports VCS.Database.Access.MSSQL
Partial Class EmployeeSelector
Inherits System.Web.UI.UserControl
Public Event Confirm()
Private Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
configGrid()
End If
LoadEmployees()
End Sub
Private Sub LoadEmployees()
Dim emps = EmployeeDao.LoadAllEmployees.OrderBy(Function(x) x.LastName).ToList
dgv.DataSource = emps
dgv.DataBind()
Public Sub Show()
popup.Show()
Protected Sub btnConfirm_Click(sender As Object, e As EventArgs) Handles btnConfirm.Click
RaiseEvent Confirm()
Private Sub configGrid()
dgv.AutoGenerateColumns = False
Dim chk As New Infragistics.Web.UI.GridControls.UnboundCheckBoxField
chk.Key = "Checked"
chk.Header.Text = ""
chk.Hidden = False
chk.Width = 30
dgv.Columns.Add(chk)
Dim col As New Infragistics.Web.UI.GridControls.BoundDataField
col = New Infragistics.Web.UI.GridControls.BoundDataField
col.DataFieldName = "Code"
col.Key = "Code"
col.Header.Text = "Code"
col.Hidden = False
dgv.Columns.Add(col)
col.DataFieldName = "FullName"
col.Key = "FullName"
col.Header.Text = "Name"
col.DataFieldName = "RankCode"
col.Key = "RankCode"
col.Header.Text = "Title"
col.DataFieldName = "SquadCode"
col.Key = "SquadCode"
col.Header.Text = "Group"
End Class
Found the solution. Apparently I was missing DataKeyFields property on the grid. I'm guessing that made checking the checkboxes in the grid not know which unique rows are checked.
Hello,
Thank you for contacting Infragistics! I am glad you have been able to resolve your issue. If you have any further questions feel free to update the thread.
Please let me know if you have any further questions concerning this matter.