Nov 17, 2010, 8:42 AM
[CLOSED] Gridview - Rows with Checkbox
Good morning,
I am working in a gridview with the following structure:
My problem is how to add a checkbox to every row ( in red ).
This is the code:
Thank you.
I am working in a gridview with the following structure:
My problem is how to add a checkbox to every row ( in red ).
This is the code:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Resultados.DataSource = new List<Project>
{
new Project("Obra A","Artigo1","Descricao","Documento",23.4,2,1,23.4),
new Project("Obra A","Artigo2","Descricao","Documento",23.1,1,3,23.2),
new Project("Obra B","Artigo3","Descricao","Documento",23.1,1,3,23.2),
new Project("Obra B","Artigo4","Descricao","Documento",23.1,1,3,23.2)
};
this.Resultados.DataBind();
}
public class Project
{
public Project(string Obra, string Artigo, string Descricao, string Documento, double PrecoUnit, int Quantd, double UN, double VLiquido)
{
this.Obra = Obra;
this.Artigo = Artigo;
this.Descricao = Descricao;
this.Documento = Documento;
this.PrecoUnit = PrecoUnit;
this.Quantd = Quantd;
this.UN = UN;
this.VLiquido = VLiquido;
}
public string Obra { get; set; }
public string Artigo { get; set; }
public string Descricao { get; set; }
public string Documento { get; set; }
public double PrecoUnit { get; set; }
public int Quantd { get; set; }
public double UN { get; set; }
public double VLiquido { get; set; }
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="Resultados" runat="server" GroupField="Obra">
<SortInfo Direction="ASC" Field="Artigo" />
<Reader>
<ext:JsonReader IDProperty="Artigo">
<Fields>
<ext:RecordField Name="Obra" />
<ext:RecordField Name="Artigo" />
<ext:RecordField Name="Descricao" />
<ext:RecordField Name="Documento" />
<ext:RecordField Name="PrecoUnit" />
<ext:RecordField Name="Quantd" />
<ext:RecordField Name="UN" />
<ext:RecordField Name="VLiquido" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel ID="GridPanel1" runat="server" Frame="true" StoreID="Resultados" StripeRows="true"
Title="Mapa Comparativo de Fornecimentos" AutoExpandColumn="Obra" Collapsible="true"
AnimCollapse="false" Icon="ApplicationViewColumns" TrackMouseOver="false" Width="800"
Height="450" ClicksToEdit="1">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="Artigo" Header="Artigo" Sortable="true" DataIndex="Artigo"
Hideable="false" />
<ext:Column ColumnID="Obra" Header="Obra" DataIndex="Obra">
</ext:Column>
<ext:Column ColumnID="Descricao" Header="Descrição" DataIndex="Descricao" Width="20" />
<ext:Column ColumnID="Documento" Width="25" Header="Documento" Sortable="true" DataIndex="Documento" />
<ext:Column Width="20" ColumnID="PrecoUnit" Header="Preço Unit." Sortable="true"
DataIndex="PrecoUnit" />
<ext:Column Width="20" ColumnID="Quantd" Header="Quantd." Sortable="true" DataIndex="Quantd" />
<ext:Column Width="20" ColumnID="UN" Header="UN" Sortable="false" Groupable="false"
DataIndex="UN" />
<ext:Column ColumnID="VLiquido" Header="V. Líquido" />
</Columns>
</ColumnModel>
<View>
<ext:GroupingView ID="GroupingView1" runat="server" ForceFit="true" MarkDirty="false"
ShowGroupName="false" EnableNoGroups="true" HideGroupedColumn="true" />
</View>
</ext:GridPanel>
</form>
</body>
</html>
I hope I've explained myself properly.Thank you.
Last edited by FilipeCosta; Nov 17, 2010 at 10:36 AM.