Last post Dec 20, 2018 08:53 AM by jafferpg
Dec 19, 2018 09:14 AM|jafferpg|LINK
I have a task ,which if records contains more than 299, i need to pass the value 299 for each call to the backend
eg : Total Rows = 1000, i need to send each call as 299 i,e(0-299, 300-599, 600-899 ......)
output : response. totalrows = 1000;
/// how to write a condition/calculation here
return response ; //after that i need to add all the Readdata statement output and bind in final response .
Thanks in advance </div>
Dec 20, 2018 02:39 AM|Ackerly Xu|LINK
According to your description, do you want 299 when the record is in 300-599 ,want 599 when record is in 600-899 , want 899 when record is in 900-1199?
If so , you could try the code below.To show the range , I use the method DivideRecords, you could only use the method GetResult.
protected void Page_Load(object sender, EventArgs e)
static double GetResult(int number)
double count = Math.Ceiling((number+1) * 1.0 / 300); //get how many 300 there are in the number
return (count - 1) * 300 - 1; //get the final result according to how many 300 there are in the number
static string DivideRecords(int number)
string result = "";
double count = Math.Ceiling(number * 1.0 / 300);
for (int i = 0; i < count-1; i++)
string temp = i * 300 + "-" + ((i + 1) * 300 - 1)+",";
result += temp;
result += (count - 1) * 300 + "-" + (number-1);
Below is the result.
If it is not your case , please specify your problem and provide the code your have tried,it is not clear about your method Readdata(reponsexml, response).
Dec 20, 2018 08:53 AM|jafferpg|LINK
Thanks Ackerly for your response!!
I done by using the below method
if (response.TotalCountRows > 299)
for (int i = 300; i <= response.TotalCountRows; i++)
search.firstvalue = i;
if ((i + 299) <= response.TotalCountRows)
search.lastvalue = i + 299;
search.lastvalue = Convert.ToInt32(response.TotalCountRows);
SplitData(search, messageID, response);
i = i + 299;