user9065477
user9065477

Reputation:

Return list of values c#

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?

Upvotes: 0

Views: 3000

Answers (2)

CodingYoshi
CodingYoshi

Reputation: 27039

You can generate it like this:

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

Upvotes: 0

Adrian
Adrian

Reputation: 8597

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.

Upvotes: 1

Related Questions