0

I'm new in Asp and I develop all querys with stored procedures:

I have a method like this:

  Filler.Fill(new PeriodoLogic().lstConsultaParcial(tabla).ConvertAll(o => (object)o), ref this.radcmbPeriodo, "nPeriodo", "nPeriodo", true);

lstConsultaParcial Method:

 public List<object> lstConsultaParcial(object Entidad)
        {
            return new PeriodoData().lstConsultaParcial(Entidad);
        }

View:

<td><telerik:RadComboBox runat="server" ID="radcmbPeriodo" Width="200px" MarkFirstMatch="true" Filter="Contains" DropDownAutoWidth="Enabled"                    
                    EmptyMessage="Seleccionar" ></telerik:RadComboBox></td>    
                     <td><asp:RequiredFieldValidator ID="rfv" runat="server" ErrorMessage="<b class='red'>Requerido</b>" ControlToValidate="radcmbPeriodo"></asp:RequiredFieldValidator></td>

It fills radcombobox, consulting a simple stored procedure, it receive values, 1,2,3,4,5,6,7,8,9,10,11,12 as:

Image

as you can see it returns values 1 to 12, so I think I dont need consult stored procedure, how can I send simple a list of 1 to 12 instead call stored procedure?

1
  • what if the values change in the database that your procedure uses? You will have the wrong data displaying then, Commented Dec 8, 2017 at 21:44

2 Answers 2

1

Answer is simple. You don't want to call that function which goes to call the SP.

Using LINQ below, you can quickly generate a list of numbers from 1 to 12.

List<int> myList = Enumerable.Range(1, 12).ToList();
return myList;

This is what you need to return from the method that your Kendo control calls.

Sign up to request clarification or add additional context in comments.

2 Comments

But what code I need to change to return that list?
I try it as List<int> myList = Enumerable.Range(1, 12).ToList(); return new PeriodoData().lstConsultaParcial(myList);, but it don't show anything.
0

You can generate it like this:

var nums = Enumerable.Range(1, 12).ToList();

1 Comment

You can remove .Select(x => x)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.