HOW TO SELECT VALUES FROM CHECKBOX LIST IN C# ASP.NET

Norman Reedus

Total Post:45

Points:315
Posted by  Norman Reedus
C#  ASP.Net 
 859  View(s)
Ratings:
Rate this:
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:





Here is the code which I am using currently
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"]));
|
  1. Pawan Shukla

    Post:29

    Points:203
    Re: How to Select Values From Checkbox List In C# Asp.Net

    Hi....

    Are you developing a search engine ??

    The parameters are the values of the checkboxlist ??

    Then, as far as my knowledge goes, it should be like -
    -----------
    string p = string.empty;
    foreach items in checkboxlist
    {
    if items[1].isSelected == true {p=p+items[1].selectedvalue+",";}
    if items[2].isSelected == true {p=p+items[2].selectedvalue+",";}
    }
    Then, remove the last character i.e. "," and send all these values as parameters.

      Modified On Mar-17-2016 04:11:22 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!