I have an issue with add functionality
Issue is if i know the customer numbers for ex-408567346 etc ;I can write it in textboxes and by clicking on add button it has to add the customernumbers but its not working
beside add button I have serach button where we can search customernumbers and click on return it will add.
Basically two ways to add
1.Add button ---not working
2.Search button--is working
Here is the code below
private void btnAddCustNum_Click(object sender, System.EventArgs e)
{
ArrayList soldTos = new ArrayList(5);
if (txtCustNum1.Text != "") soldTos.Add(txtCustNum1.Text);
if (txtCustNum2.Text != "") soldTos.Add(txtCustNum2.Text);
if (txtCustNum3.Text != "") soldTos.Add(txtCustNum3.Text);
if (txtCustNum4.Text != "") soldTos.Add(txtCustNum4.Text);
ArrayList companies = proxy.GetCustomerList(soldTos,"");
if (Session["USERSOLDTO"] == null)
{
Session["USERSOLDTO"] = companies;
dgCustomers.DataSource = companies;
dgCustomers.DataBind();
}
else
{
AddToCustomerGrid(companies);
}
Session["UPDATESOLDTOS"] = "true";
}
Any help that could be appreciated
mcfar parkPosted Jul 16, 2013, 2:35 PM
mcfar parkPosted Jul 12, 2013, 10:49 AM
Jignesh TrivediPosted Jul 10, 2013, 11:12 PM
hi,
I think, in your case "companies"(you pass from button click) has already has value ehich one you trying to insert.
so kindly check it..
mcfar parkPosted Jul 10, 2013, 7:23 PM
private void AddToCustomerGrid(ArrayList companies)
{
//add customers to the customer Grid. Don't add duplicate customers
bool addCompany = true;
ArrayList newList = new ArrayList();
ArrayList userList = null;
if (Session["USERSOLDTO"] != null)
{
userList = (ArrayList) Session["USERSOLDTO"];
}
else
{
userList = new ArrayList();
}
foreach (Company tCompany in companies)
{
foreach (Company company in userList)
{
if (tCompany.CompanyId.Equals(company.CompanyId))
{
addCompany = false;
break;
}
}
if (addCompany) userList.Add(tCompany);
addCompany = true;
}
Session["USERSOLDTO"] = userList;
dgCustomers.DataSource = userList;
dgCustomers.DataBind();
}
Jignesh TrivediPosted Jul 9, 2013, 10:51 PM
As per you search code is working fine right?
can you please share AddToCustomerGrid function code?
in this function are you add customer in to data base or just in memory?