Usuário com melhor resposta
grid personalizado

Pergunta
-
Respostas
-
Olá! Boa tarde!
Aqui está um exemplo de como criar uma tabela dinânica em C#:
Table tabela = new Table(); tabela.BorderWidth = 1; tabela.Width = 200; TableRow tr; TableCell td; #region Cabecalho TableHeaderRow thr = new TableHeaderRow(); TableHeaderCell thc = new TableHeaderCell(); thc.Text = "Formulário de exemplo"; thc.ColumnSpan = 2; thr.Cells.Add(thc); tabela.Rows.Add(thr); #endregion Label lblTitulo; TextBox txtNome; for (int i = 0; i < 20; i++) { tr = new TableRow(); #region Coluna de titulo td = new TableCell(); td.HorizontalAlign = HorizontalAlign.Left; lblTitulo = new Label(); lblTitulo.Text = "Campo - " + (i + 1).ToString(); td.Controls.Add(lblTitulo); tr.Cells.Add(td); #endregion #region Coluna com o campo td = new TableCell(); td.HorizontalAlign = HorizontalAlign.Left; txtNome = new TextBox(); txtNome.Width = 60; txtNome.MaxLength = 100; td.Controls.Add(txtNome); tr.Cells.Add(td); #endregion tabela.Rows.Add(tr); } PanelPrincipal.Controls.Add(tabela);//adicione na página .aspx um panel para a tabela ser colocada dentro dele
Espero ter lhe ajudado!!
Se esta resposta lhe ajudou, marque!! Obrigado!!Thiago Rogerio
www.thiagorogerio.com.br
thiagorogeriobr@hotmail.com- Marcado como Resposta Harley Araujo quinta-feira, 1 de março de 2012 14:55
-
Tem este exemplo de como dar merge nas células do gridview:
http://www.codeproject.com/Articles/36536/Cell-Merging-In-GridView
http://samuelcazelli.blogspot.com/
- Marcado como Resposta Harley Araujo quinta-feira, 1 de março de 2012 14:55
Todas as Respostas
-
Boa tarde.
Só conheco com ferramentas de terceiros, segue:
http://devexpress.com/Subscriptions/DXperience/asp-features.xml
Consultoria .NET
ANALISTA DESENVOLVEDOR
Se esta sugestão for útil, por favor, classifique-a como útil.
Se ela lhe ajudar a resolver o problema, por favor, marque-a como resposta.
Blog .Net Descomplicado -
Algo assim não lhe atenderia?
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="subproduto" HeaderText="subproduto" /> <asp:TemplateField> <ItemTemplate> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="VF" HeaderText="VF" /> <asp:BoundField DataField="DV01" HeaderText="DV01" /> </Columns> </asp:GridView> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
no databound do grid principal vc trataria o bind do grid secundário.
Marquinhos Não esqueça de qualificar a resposta.
-
-
-
Olá! Boa tarde!
Aqui está um exemplo de como criar uma tabela dinânica em C#:
Table tabela = new Table(); tabela.BorderWidth = 1; tabela.Width = 200; TableRow tr; TableCell td; #region Cabecalho TableHeaderRow thr = new TableHeaderRow(); TableHeaderCell thc = new TableHeaderCell(); thc.Text = "Formulário de exemplo"; thc.ColumnSpan = 2; thr.Cells.Add(thc); tabela.Rows.Add(thr); #endregion Label lblTitulo; TextBox txtNome; for (int i = 0; i < 20; i++) { tr = new TableRow(); #region Coluna de titulo td = new TableCell(); td.HorizontalAlign = HorizontalAlign.Left; lblTitulo = new Label(); lblTitulo.Text = "Campo - " + (i + 1).ToString(); td.Controls.Add(lblTitulo); tr.Cells.Add(td); #endregion #region Coluna com o campo td = new TableCell(); td.HorizontalAlign = HorizontalAlign.Left; txtNome = new TextBox(); txtNome.Width = 60; txtNome.MaxLength = 100; td.Controls.Add(txtNome); tr.Cells.Add(td); #endregion tabela.Rows.Add(tr); } PanelPrincipal.Controls.Add(tabela);//adicione na página .aspx um panel para a tabela ser colocada dentro dele
Espero ter lhe ajudado!!
Se esta resposta lhe ajudou, marque!! Obrigado!!Thiago Rogerio
www.thiagorogerio.com.br
thiagorogeriobr@hotmail.com- Marcado como Resposta Harley Araujo quinta-feira, 1 de março de 2012 14:55
-
-
-
Tem este exemplo de como dar merge nas células do gridview:
http://www.codeproject.com/Articles/36536/Cell-Merging-In-GridView
http://samuelcazelli.blogspot.com/
- Marcado como Resposta Harley Araujo quinta-feira, 1 de março de 2012 14:55