Oct 07, 2010, 4:01 PM
[CLOSED] [1.0] Gridpanel and checkbox question
In the following example, how would I hide "Send Notification" checkboxes in rows where HasEmail = false?
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Linq" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Store1.DataSource = from c in Contacts
select new
{
c.ID,
c.Name,
c.HasEmail,
SendNotification = false
};
this.Store1.DataBind();
}
private List<Contact> Contacts
{
get
{
List<Contact> contacts = new List<Contact>();
contacts.Add(new Contact(1, "John", true));
contacts.Add(new Contact(2, "Bill", false));
contacts.Add(new Contact(3, "Mark", true));
return contacts;
}
}
public class Contact
{
public Contact(int id, string name, bool hasEmail)
{
this.ID = id;
this.Name = name;
this.HasEmail = hasEmail;
}
public int ID { get; set; }
public string Name { get; set; }
public bool HasEmail { get; set; }
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:JsonReader IDProperty="ID">
<Fields>
<ext:RecordField Name="ID" />
<ext:RecordField Name="Name" />
<ext:RecordField Name="HasEmail" Type="Boolean" />
<ext:RecordField Name="SendNotification" Type="Boolean" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" Height="120" Width="220">
<ColumnModel>
<Columns>
<ext:Column Header="Name" DataIndex="Name" />
<ext:CheckColumn Header="Send Notification" DataIndex="SendNotification" Editable="true" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</form>
</body>
</html>
Last edited by geoffrey.mcgill; Oct 07, 2010 at 11:02 PM.
Reason: [CLOSED]