C # Use HttpGet

0

good morning, I consult the following, as I do to receive a list < > in C # and send it to javascript in order to display it in a table with data on my website. I can send it using json with POST and send it through a method with the tag [webmethod] but I want to do it in reverse I think I no longer use [webmethod], I hope you can help me.

C #

  protected void LinkButtonBuscar2_Click(object sender, EventArgs e)
    {
        int OpprId = Convert.ToInt32(txtOpprId.Text.Trim());
        int errcode = 0;
        string errmsg = string.Empty;
        string nombreContacto = string.Empty;
        OPR1_ENT[] arrayOOPR = new OPR1_ENT[10];

        OOPR_ENT fila1 = OOPR_BBL.getInstance().FilaOportunidades(OpprId);

        if (fila1 != null)
        {
            txtCardCode.Text = fila1.CardCode;
            txtCardName.Text = fila1.CardName;
            txtOpportunityName.Text = fila1.Name;
            BloqueAlerta.Visible = false;
            if (fila1.OpprType == '\u0001') { OpprTypeR.Checked = true; OpprTypeP.Checked = false; } else { OpprTypeR.Checked = false; OpprTypeP.Checked = true; }
            if (fila1.Status == '\u0002') { txtStatus.Text = "GANADA"; } else if (fila1.Status == '
function sendDataAjax() {
    $.ajax({
        type: "POST",
        url: "Oportunidad.aspx/ListarEtapasPorOprtunidad",
        data: {},
        contentType: 'application/json; charset=utf-8',
        error: function (xhr, ajaxOptions, throwError) {
            console.log(xhr.status + " \n" + xhr.responseText, "\n" + throwError);
        },
        success: function (data) {
             console.log(data);
            //addRowDT(data.d);
        }
    });
}

sendDataAjax(); 
') { txtStatus.Text = "ABIERTO"; } else { txtStatus.Text = "PERDIDA"; } int CntctCode = OCPR_BBL.getInstance().MostrarContactoPorCliente(OpprId); ddlPersonContac.SelectedValue = OCPR_BBL.getInstance().MostrarContactoPorCliente(OpprId).ToString(); txtOpenDate.Value = fila1.OpenDate.ToShortDateString(); txtCloseDate.Value = (fila1.CloseDate.ToShortDateString() == "30/12/1899") ? string.Empty : fila1.CloseDate.ToShortDateString(); txtImportFact.Text = string.Format("{0:C}", fila1.ImportFact); ddlEmpDepVtas1.SelectedValue = fila1.SlpCode.ToString(); txtNumActivity.Text = fila1.NumActivity.ToString(); //ESTE ES EL LIST<> QJUE QUIERO ENVIA A JAVASCRIPT Lista = OPR1_BBL.getInstance().ListarEtapasPorOprtunidad(OpprId); } else { errcode = OOPR_DAL.getInstance().sErrorCodeDal; errmsg = OOPR_DAL.getInstance().sErrorMsgDal; lblMsgAlerta.Text = errcode + ", " + errmsg; BloqueAlerta.Visible = true; } }

JS

  protected void LinkButtonBuscar2_Click(object sender, EventArgs e)
    {
        int OpprId = Convert.ToInt32(txtOpprId.Text.Trim());
        int errcode = 0;
        string errmsg = string.Empty;
        string nombreContacto = string.Empty;
        OPR1_ENT[] arrayOOPR = new OPR1_ENT[10];

        OOPR_ENT fila1 = OOPR_BBL.getInstance().FilaOportunidades(OpprId);

        if (fila1 != null)
        {
            txtCardCode.Text = fila1.CardCode;
            txtCardName.Text = fila1.CardName;
            txtOpportunityName.Text = fila1.Name;
            BloqueAlerta.Visible = false;
            if (fila1.OpprType == '\u0001') { OpprTypeR.Checked = true; OpprTypeP.Checked = false; } else { OpprTypeR.Checked = false; OpprTypeP.Checked = true; }
            if (fila1.Status == '\u0002') { txtStatus.Text = "GANADA"; } else if (fila1.Status == '
function sendDataAjax() {
    $.ajax({
        type: "POST",
        url: "Oportunidad.aspx/ListarEtapasPorOprtunidad",
        data: {},
        contentType: 'application/json; charset=utf-8',
        error: function (xhr, ajaxOptions, throwError) {
            console.log(xhr.status + " \n" + xhr.responseText, "\n" + throwError);
        },
        success: function (data) {
             console.log(data);
            //addRowDT(data.d);
        }
    });
}

sendDataAjax(); 
') { txtStatus.Text = "ABIERTO"; } else { txtStatus.Text = "PERDIDA"; } int CntctCode = OCPR_BBL.getInstance().MostrarContactoPorCliente(OpprId); ddlPersonContac.SelectedValue = OCPR_BBL.getInstance().MostrarContactoPorCliente(OpprId).ToString(); txtOpenDate.Value = fila1.OpenDate.ToShortDateString(); txtCloseDate.Value = (fila1.CloseDate.ToShortDateString() == "30/12/1899") ? string.Empty : fila1.CloseDate.ToShortDateString(); txtImportFact.Text = string.Format("{0:C}", fila1.ImportFact); ddlEmpDepVtas1.SelectedValue = fila1.SlpCode.ToString(); txtNumActivity.Text = fila1.NumActivity.ToString(); //ESTE ES EL LIST<> QJUE QUIERO ENVIA A JAVASCRIPT Lista = OPR1_BBL.getInstance().ListarEtapasPorOprtunidad(OpprId); } else { errcode = OOPR_DAL.getInstance().sErrorCodeDal; errmsg = OOPR_DAL.getInstance().sErrorMsgDal; lblMsgAlerta.Text = errcode + ", " + errmsg; BloqueAlerta.Visible = true; } }
    
asked by Carlos Valenzuela 02.10.2018 в 00:18
source

0 answers