Click here to Skip to main content
15,891,936 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
Hi,


I Have a search application in which contains the checkbox list of projects and text boxes for each projects with start date and end date, checklist items are binding dynamically from the databse, if there more projects then there are more checkboxes coming, while selecting all check boxes and searching the item(Search Button is there) then there is lots of round trip process is going on(3-Tier Application) which taking lots of time to fill the grid control, Is there any process to send the whole checkbox list's data and text boxe's data into database(Stored procedure) in single roundtrip and fetch records.

Customer List:Customer 1 StartDateTextBox EndatedateTextBox
Customer 2 StartDateTextBox EndatedateTextBox
Customer 3 StartDateTextBox EndatedateTextBox
Customer 4 StartDateTextBox EndatedateTextBox
Customer 5 StartDateTextBox EndatedateTextBox
Customer 6 StartDateTextBox EndatedateTextBox
Customer 7 StartDateTextBox EndatedateTextBox

Button Search



GridVew Result:
Posted
Comments
SRS(The Coder) 20-Oct-14 7:39am    
You can go for passing the comma separated values to database like IDs of the items selected and fetch project data as result(DataTable) for all those IDs.
santoshkumar413 20-Oct-14 7:44am    
yeah but round trip also occurs how you have told,

here the code will be like...,

if (lbxProjectList.Items[i].Selected.Equals(true))
{

EmployeeBillingService gs = new EmployeeBillingService(this.ContextBO);

List<employeebillingbo> gList = gs.GetEmployeeProjectDetails(Convert.ToInt32(ddlCustomerList.SelectedValue), Convert.ToInt32(lbxProjectList.Items[i].Value), Convert.ToDateTime(Session["DtStartDate"]), Convert.ToDateTime(Session["DtEndDate"]));
}
SRS(The Coder) 20-Oct-14 7:57am    
Rather than calling this operation to be called repeatedly for each selected value just make all the selected values concatenated into single string and make a single call to database with that string parameter.

Then to get values separating and fetching the result by those parameter will be done by stored procedure.
santoshkumar413 20-Oct-14 7:45am    
i want to send the all the selected check box list values and dates in single roundtrip and fetch the records
SRS(The Coder) 20-Oct-14 7:53am    
You can do like
|~|Customer1|#|StartDate1|#|EndDate1|~|Customer2|#|StartDate2|#|EndDate2|~|

and in procedure you can split it by '|~|' and '|#|' strings to get your desired values to use for filtering data.

Here you can see two sets of data can be sent in one go.

1 solution

Rather than calling this operation to be called repeatedly for each selected value just make all the selected values concatenated into single string and make a single call to database with that string parameter.

Then to get values separating and fetching the result by those parameter will be done by stored procedure.

Ex :-

You can do like
SQL
|~|Customer1|#|StartDate1|#|EndDate1|~|Customer2|#|StartDate2|#|EndDate2|~|


and in procedure you can split it by '|~|' and '|#|' strings to get your desired values to use for filtering data.

Here you can see two sets of data can be sent in one go.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900