Ir para conteúdo
Fórum Script Brasil
  • 0

Componente Para Paginação Sem Banco De Dados


mestre fyoda

Pergunta

2 respostass a esta questão

Posts Recomendados

  • 0

Cara fiz um código onde eu leio os arquivos de um diretório, alimento um DataTable, e a partir do DataTable eu alimento minha grid, e a grid tem paginação normal, sem usar banco de dados, a paginação ficou assim:

gv.PageIndex = e.NewPageIndex
gv.DataBind(

Link para o comentário
Compartilhar em outros sites

  • 0

Estranho o campo TextBox não está aparecendo porque ?

<%@ Page Language="C#" Debug="true" %>

<%@ import Namespace="System" %>

<%@ import Namespace="System.IO" %>

<%@ import Namespace="System.Data" %>

<%@ import Namespace="System.Data.Odbc" %>

<%@ import Namespace="System.Collections" %>

<%@ import Namespace="System.Text" %>

public void Preenche_Carrinho() {

Table1.CellPadding = 0;

Table1.CellSpacing = 0;

Table1.GridLines = GridLines.Both;

TableRow headerLine = new TableRow();

headerLine.BackColor = System.Drawing.Color.LightYellow;

headerLine.ForeColor = System.Drawing.Color.Black;

headerLine.Font.Bold = true;

headerLine.Font.Name = "Verdana";

Table1.Rows.Add(headerLine);

TableCell titulo1 = new TableCell();

// ********** FOTO **********

titulo1.Text = "<div align='center' style='font-size: 12px; font-family: Verdana,Arial,Tahoma; width: 100px;'> &nbsp; </div>";

// ********** PRODUTO **********

TableCell titulo2 = new TableCell();

titulo2.Text = "<div align='left' style='text-transform: uppercase; font-size: 11px; font-family: Verdana,Arial,Tahoma; width: 30%;'> Produto </div>";

// ********** QUANTIDADE **********

TableCell titulo3 = new TableCell();

titulo3.Text = "<div align='center' style='text-transform: uppercase; font-size: 11px; font-family: Verdana,Arial,Tahoma; width: 60px;'> Quantidade </div>";

// ********** OPÇÃO PARA PRESENTE **********

TableCell titulo4 = new TableCell();

titulo4.Text = "<div align='center' style='text-transform: uppercase; font-size: 11px; font-family: Verdana,Arial,Tahoma; width: 100px;'> Opção para presente </div>";

// ********** REMOVER PRODUTO **********

TableCell titulo5 = new TableCell();

titulo5.Text = "<div align='center' style='text-transform: uppercase; font-size: 11px; font-family: Verdana,Arial,Tahoma; width: 90px;'> Remover Produto </div>";

// ********** PREÇO UNITÁRIO **********

TableCell titulo6 = new TableCell();

titulo6.Text = "<div align='center' style='text-transform: uppercase; font-size: 11px; font-family: Verdana,Arial,Tahoma; width: 95px;'>Preço Unitário R$ </div>";

// ********** SUBTOTAL **********

TableCell titulo7 = new TableCell();

titulo7.Text = "<div align='center' style='text-transform: uppercase; font-size: 11px; font-family: Verdana,Arial,Tahoma; width: 100px;'>Subtotal R$ </div>";

headerLine.Cells.Add(titulo1);

headerLine.Cells.Add(titulo2);

headerLine.Cells.Add(titulo3);

headerLine.Cells.Add(titulo4);

headerLine.Cells.Add(titulo5);

headerLine.Cells.Add(titulo6);

headerLine.Cells.Add(titulo7);

try {

string ind = Request.Form["indice"];

TableRow linha = new TableRow();

linha.BackColor = System.Drawing.Color.White;

linha.ForeColor = System.Drawing.Color.Black;

linha.Font.Name = "Verdana";

Table1.Rows.Add(linha);

// ********** FOTO **********

TableCell c1 = new TableCell();

c1.Text = "<div align=center' style='font-size: 11px; font-family: Verdana,Arial,Tahoma;'> <img src='"+ Request.Cookies[ind]["Imagem] +"' border='0' alt='Colocar no carrinho' /></div>";

// ********** PRODUTO **********

TableCell c2 = new TableCell();

c2.Text = "<div style='font-size: 10px; font-family: Verdana,Arial,Tahoma;'> "+ Request.Cookies[ind]["Produto"] + "</div>";

// ********** QUANTIDADE **********

TableCell c3 = new TableCell();

c3.Text = " <asp:TextBox id=quantidade' runat='server' /> </asp:TextBox>";

// ********** OPÇÃO PARA PRESENTE **********

TableCell c4 = new TableCell();

c4.Text = "<div align='center' style='font-size: 10px; font-family: Verdana,Arial,Tahoma;'>" + Request.Cookies[ind]["Presente] + "</div>";

if( Request.Cookies[ind]["Presente"] == "Não" ) {

c4.Text = "<div align=center' style='font-size: 11px; font-family: Verdana,Arial,Tahoma;'> <input type='checkbox' id='presente' runat='server' /> <img src='imagens/presente.png' alt='Enviar Presete' width='30' height='34' runat='server' /> </div>";

}

if( Request.Cookies[ind]["Presente] == "Sim" ) {

c4.Text = "<div align='center' style='font-size: 11px; font-family: Verdana,Arial,Tahoma;'> <input type='checkbox' id='presente' checked='checked' runat='server' /> <img src='imagens/presente.png' alt='Enviar Presete' width='30' height='34' runat='server' /> </div>";

}

// ********** PREÇO UNITARIO **********

TableCell c5 = new TableCell();

c5.Text = "<div align='center' style='font-size: 10px; font-family: Verdana,Arial,Tahoma;'> <img src='imagens/excluir_produto.png' alt='Remover produto do carrinho' runat='server' /> </div>";

// ********** SUBTOTAL **********

TableCell c6 = new TableCell();

c6.Text = "<div align='center' style='font-size: 10px; font-family: Verdana,Arial,Tahoma;'>" + Request.Cookies[ind]["VLR_Unitario"] + "</div>";

// ********** SUBTOTAL **********

TableCell c7 = new TableCell();

c7.Text = "<div align=center' style='font-size: 10px; font-family: Verdana,Arial,Tahoma;'>" + Request.Cookies[ind]["SubTotal] + "</div>";

linha.Cells.Add(c1);

linha.Cells.Add(c2);

linha.Cells.Add(c3);

linha.Cells.Add(c4);

linha.Cells.Add(c5);

linha.Cells.Add(c6);

linha.Cells.Add(c7);

}

catch (NullReferenceException nre) {

Response.Write(" Erro ao listar o carrinho");

Response.Write(nre.Message);

}

}

public void AlterarQuantidade(Object Sender, EventArgs e) {

quantidade.Text = "Certinho";

}

<asp:Table id="Table1" runat="server"></asp:Table>

EDITANDO...

Achei qual ero o problema, era ali na foto, aonde mostrava a foto, mas agora tenho um outro problema, quando eu faço uma função para escrever no campo quantidade (campo texto) da o seguinte erro :

CS0103: The name 'quantidade' does not exist in the current context

Editado por mestre fyoda
Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...