protected void ddlVendor_SelectedIndexChanged(object sender, EventArgs e) { Int64 id = Int64.Parse(ddlVendor.SelectedValue.ToString()); try { VendorMaster vm = new VendorMaster(); DataTable dt = new DataTable(); Cls_VendorMaster_b clsbrand = new Cls_VendorMaster_b(); vm = clsbrand.SelectById(id); txtMobile.Text = vm.MobileNo1.ToString(); txtEmail.Text = vm.email.ToString(); //txtCity.Text = vm.fk_cityId.ToString(); //txtState.Text = vm.fk_stateId.ToString(); //txtCountry.Text = vm.fk_countryId.ToString(); txtCity.Text = vm.city.ToString(); txtState.Text = vm.state.ToString(); txtCountry.Text = vm.country.ToString(); txtAddress.Text = vm.Address1.ToString(); } catch (Exception ex) { ErrHandler.writeError(ex.Message, ex.StackTrace); //return null; } finally { con.Close(); } }
private void Bind() { DataTable dtVendorName = new DataTable(); DataTable dtCategory = new DataTable(); if (dtProduct == null) { System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select Product(s)--", "0"); ddlProduct.Items.Insert(0, objListItem); } try { //ProductMaster objProductMaster = new ProductMaster(); Cls_VendorMaster_b clsbrand = new Cls_VendorMaster_b(); dtVendorName = clsbrand.SelectAll(); Cls_category_b clsCategory = new Cls_category_b(); dtCategory = clsCategory.SelectAll(); } catch { } finally { con.Close(); } if (dtVendorName != null) { if (dtVendorName.Rows.Count > 0) { ddlVendor.DataSource = dtVendorName; ddlVendor.DataTextField = "vendorName"; ddlVendor.DataValueField = "vid"; ddlVendor.DataBind(); System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select Vendor--", "0"); ddlVendor.Items.Insert(0, objListItem); } } if (dtCategory != null) { if (dtCategory.Rows.Count > 0) { ddlCategory.DataSource = dtCategory; ddlCategory.DataTextField = "categoryname"; ddlCategory.DataValueField = "cid"; ddlCategory.DataBind(); System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select Category--", "0"); ddlCategory.Items.Insert(0, objListItem); } } }
public void Bindvendor() { try { //if (ddlUserType.SelectedItem.Value == "Dealer") //{ Cls_VendorMaster_b obj = new Cls_VendorMaster_b(); DataTable dtVendor = new DataTable(); dtVendor = obj.SelectAll(); if (dtVendor.Rows.Count > 0) { ddlname.DataSource = dtVendor; ddlname.DataTextField = "vendorName"; ddlname.DataValueField = "vid"; ddlname.DataBind(); ddlname.Items.Insert(0, "---select---"); } else { } //} //else if (ddlUserType.SelectedItem.Value == "Customer") //{ // string Getallcusotmer = "select distinct uid,fname+''+mname+''+lname as name from userregistration where isactive=1 and isdelete=0 "; // SqlDataAdapter dacust = new SqlDataAdapter(Getallcusotmer, con); // DataTable dtcustoemr = new DataTable(); // dacust.Fill(dtcustoemr); // if (dtcustoemr.Rows.Count > 0) // { // ddlname.DataSource = dtcustoemr; // ddlname.DataTextField = "name"; // ddlname.DataValueField = "uid"; // ddlname.DataBind(); // ddlname.Items.Insert(0, "---select---"); // } // else // { // } //} } catch (Exception ex) { Response.Write(ex.Message + ex.StackTrace); } }
private void BindVendors() { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["cnstring"].ConnectionString); try { Cls_VendorMaster_b clsbrand = new Cls_VendorMaster_b(); dtSuppliers = clsbrand.SelectAll(); if (dtSuppliers != null) { if (dtSuppliers.Rows.Count > 0) { ddlVendor.DataSource = dtSuppliers; ddlVendor.DataTextField = "vendorName"; ddlVendor.DataValueField = "vid"; ddlVendor.DataBind(); System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select Vendor--", "0"); ddlVendor.Items.Insert(0, objListItem); } else { ddlVendor.DataSource = dtSuppliers; ddlVendor.DataTextField = "vendorName"; ddlVendor.DataValueField = "vid"; ddlVendor.DataBind(); System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select Vendor--", "0"); ddlVendor.Items.Insert(0, objListItem); } } { ddlVendor.DataSource = dtSuppliers; ddlVendor.DataTextField = "vendorName"; ddlVendor.DataValueField = "vid"; ddlVendor.DataBind(); System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select Vendor--", "0"); ddlVendor.Items.Insert(0, objListItem); } } catch { } finally { con.Close(); } }
private void Bind() { DataTable dtVendors = new DataTable(); try { Cls_VendorMaster_b objVendors = new Cls_VendorMaster_b(); dtVendors = objVendors.SelectAll(); } catch { } finally { con.Close(); } if (dtVendors != null) { if (dtVendors.Rows.Count > 0) { ddlVendor.DataSource = dtVendors; ddlVendor.DataTextField = "vendorname"; ddlVendor.DataValueField = "vid"; ddlVendor.DataBind(); System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select Supplier--", "0"); ddlVendor.Items.Insert(0, objListItem); } else { ddlVendor.DataSource = dtVendors; ddlVendor.DataTextField = "vendorname"; ddlVendor.DataValueField = "vid"; ddlVendor.DataBind(); } } else { ddlVendor.DataSource = dtVendors; ddlVendor.DataTextField = "vendorname"; ddlVendor.DataValueField = "vid"; ddlVendor.DataBind(); } }
private void Bindsupplier() { try { Cls_VendorMaster_b obj = new Cls_VendorMaster_b(); DataTable dtVendor = new DataTable(); dtVendor = obj.SelectAll(); if (dtVendor.Rows.Count > 0) { lstCustomer.DataSource = dtVendor; lstCustomer.DataTextField = "vendorName"; lstCustomer.DataValueField = "vid"; lstCustomer.DataBind(); lstCustomer.Items.Insert(0, "---select---"); } else { } } catch { } finally { } }