I have many API data but i take only few data of that..
mean in my API Data i have 10 records and i need only 5 of them.
so,how to take few data of them?
please,explain with example and give code of that..
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jul 11, 2013, 4:09 AM
hi,
I am little bit confused about your requirement.
In above post i mean to
MyAPI a =new MyAPI();
var ClassA = A.GetMovieData();
label1.Text = ClassA.movieId;
label2.Text = ClassA.moviename;
label3.Text = ClassA.movieimg; // here you have write special code to show img...
label4.Text = ClassA.screen;
label5.Text = ClassA.showtime;
how you under stand now...
Dipika ShahPosted Jul 11, 2013, 3:36 AM
it display whole data.
but i will display 5 of them.
plz,tell solution of this.
Jignesh TrivediPosted Jul 10, 2013, 11:06 PM
Ok, so your return type is class then simply you can assign property of class to lables or text boxes
like....
label1.Text = ClassA.Prop1;
hope this will help you.
Dipika ShahPosted Jul 10, 2013, 7:45 AM
Jignesh TrivediPosted Jul 9, 2013, 10:46 PM
what is return type of your API function i.e datatable, colloection of class or return any class?
Dipika ShahPosted Jul 9, 2013, 11:56 AM
Dipika ShahPosted Jul 9, 2013, 9:16 AM
now i display data on panel not a gridview..
mean in my application i display 5 data(movieId,moviename,movieimg,screen,showtime) on label and this all data are in panel.
i have already API data but i display only above 5 data and i display this data in panel.
Jignesh TrivediPosted Jul 8, 2013, 5:11 AM
you have 10 field (it is column not row) and out of them you want to show 5 field right?
are you able to connect API and retrieve all 10 field? if yes if you are showing data using datagrid view then you can do one thing stop auto generate coumn to false
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.autogeneratecolumns.aspx
now create your own column which you required.
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.columns.aspx
Please refer more details
http://msdn.microsoft.com/en-us/library/System.Windows.Forms.DataGridView.aspx
hope this will help you.
Dipika ShahPosted Jul 8, 2013, 4:37 AM
my API is third party..
can u tell me how to filter the data?
sorry, it's my mistake.i have 10 field and i get 5 of them..
i develop movie multiplex software inthat i have movieId,name,image,screen,showtime,cast,genre,duration,releasedate etc...
and i want to display first 5 of them..
plz, give me rply as fast as soon possible.
thanx in advance.
Jignesh TrivediPosted Jul 8, 2013, 4:06 AM
this API is created by you or it is third party?
if it is created by you, than you can write one over load method in API which is return less amount data that you want.
if API is third party than you have write extra code to further filter data.
for example i have one API in form of dll called Abc and i want to call xyz method from API which is return collection of string.
first i will create object of abc (it might be class or assabmly)
Abc test = new Abc();
than i called its method
List
this method returns 15 record and i want to only five record from this collection.
List
this will return only five data from whole data list
hope this will help you.
Dipika ShahPosted Jul 8, 2013, 3:32 AM
plz,give me example.
Dipika ShahPosted Jul 8, 2013, 2:17 AM
Jignesh TrivediPosted Jul 8, 2013, 2:02 AM
generally API is in form of dll.
so you have to take reference on API to your project and create instance of API provider class and direct call methods. also from ASP.net MVC 4.0 web api is also available
http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
please refer
http://www.c-sharpcorner.com/UploadFile/mahesh/dll12222005064058AM/dll.aspx
hope this will help you.
Dipika ShahPosted Jul 8, 2013, 1:45 AM
but i have no idea how to take data from API..
can u give me example of this.
Jignesh TrivediPosted Jul 7, 2013, 11:44 PM
hi,
you mean to say you required less amount of data which return from API right?
so in this case I think you have to put some extra filter on the data which is return from API or you can change API function that return amount of data that you want...
hope this will help you.