Pass Javascript values to an Asp.net class

Asked

Viewed 44 times

0

I need to create some buttons dynamically in c# and pass to them some event, that by clicking them pass two values to a select variable to bring x number of lines of the same

the class with select

public DataSet MaxId()
{
    cldBancoDados cldBancoDados = new cldBancoDados();

    StringBuilder strQuery = new StringBuilder();
    strQuery.Append("SELECT ");
    strQuery.Append("MAX (ID_OFERTA) ");
    strQuery.Append("FROM TB_OFERTA");
    return cldBancoDados.RetonarDataSet(strQuery.ToString());
}

public DataSet TrazerProdutosDesconto(int a, int b)
{
    cldBancoDados cldBancoDados = new cldBancoDados();

    StringBuilder strQuery = new StringBuilder();
    strQuery.Append("SELECT ");
    strQuery.Append("CONCAT(P.NOME_PRODUTO, ");
    strQuery.Append("CONCAT(CONCAT(' ',P.MARCA_PRODUTO),");
    strQuery.Append("CONCAT(CONCAT(' ',P.DESCRICAO_PRODUTO),");
    strQuery.Append("CONCAT(' ',P.PESO_PRODUTO)))),");
    strQuery.Append("PE.PRECO_PRODUTO, ");
    strQuery.Append("O.DESCONTO, ");
    strQuery.Append("O.DURACAO_OFERTA, ");
    strQuery.Append("P.IMG, ");
    strQuery.Append("LJ.IMG ");
    strQuery.Append("FROM TB_OFERTA O ");
    strQuery.Append("INNER JOIN TB_PRODUTO_ESTOQUE PE ");
    strQuery.Append("ON PE.ID_PRODUTO_ESTOQUE = O.ID_PRODUTO_ESTOQUE ");
    strQuery.Append("INNER JOIN TB_PRODUTO P ");
    strQuery.Append("ON P.ID_PRODUTO = PE.ID_PRODUTO ");
    strQuery.Append("INNER JOIN TB_LOJA LJ ");
    strQuery.Append("ON LJ.ID_LOJA = PE.ID_LOJA ");
    strQuery.Append("WHERE ROWNUM BETWEEN " + a + " AND " + b);
    return cldBancoDados.RetonarDataSet(strQuery.ToString());
}

in case I need to pass such values by javascript to the variables 'a' and 'b'.

  • If you can associate any button to an event this is very simple, but your current question context does not tell us where, and it is very broad and can generate responses not appropriate to your model. If you could please put a better context, editing your question?

  • I don’t know how to use javasjavascript, I need a function that passes two values at the click of the button

  • Correct, but, the question is still vague ... impossible to know where !!! had to have a minimal example. apologies, but, remains broad, a tip if not able to mess with javascript first stop and will learn this will be very important!

  • I edited the question to be more detailed, I hope someone can help

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.