protected void SalesRepresentative_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow && SalesRepresentativeGridView.EditIndex == e.Row.RowIndex) { SalesRepresentativeReportingChild li = new SalesRepresentativeReportingChild(); //Find the DropDownList in the Row DropDownList ddlSalesRepTypeNameList = (e.Row.FindControl("SalesRepTypeName") as DropDownList); ddlSalesRepTypeNameList.DataSource = li.SalesRepTypeNameList().Tables[0]; ddlSalesRepTypeNameList.DataTextField = "SalesRepTypeName"; ddlSalesRepTypeNameList.DataValueField = "SalesRepTypeName"; ddlSalesRepTypeNameList.DataBind(); //Add Default Item in the DropDownList ddlSalesRepTypeNameList.Items.Insert(0, new ListItem("Select One")); //Select the Country of Customer in DropDownList string salesRepTypeNames = (e.Row.FindControl("lblSalesRepTypeName") as Label).Text; ddlSalesRepTypeNameList.Items.FindByValue(salesRepTypeNames).Selected = true; //Find the DropDownList in the Row DropDownList ddlTerritoryNameList = (e.Row.FindControl("TerritoryName") as DropDownList); ddlTerritoryNameList.DataSource = li.TerritoryNameList().Tables[0]; ddlTerritoryNameList.DataTextField = "TerritoryName"; ddlTerritoryNameList.DataValueField = "TerritoryName"; ddlTerritoryNameList.DataBind(); //Add Default Item in the DropDownList ddlTerritoryNameList.Items.Insert(0, new ListItem("Select One")); //Select the Country of Customer in DropDownList string territoryNames = (e.Row.FindControl("lblTerritoryName") as Label).Text; ListItem item = ddlTerritoryNameList.Items.FindByValue(territoryNames); if (item != null) { ddlTerritoryNameList.SelectedValue = territoryNames; } //Find the DropDownList in the Row DropDownList ddlRegionNameList = (e.Row.FindControl("RegionName") as DropDownList); ddlRegionNameList.DataSource = li.RegionNameList().Tables[0]; ddlRegionNameList.DataTextField = "RegionName"; ddlRegionNameList.DataValueField = "RegionName"; ddlRegionNameList.DataBind(); //Add Default Item in the DropDownList ddlRegionNameList.Items.Insert(0, new ListItem("Select One")); //Select the Country of Customer in DropDownList string regionNames = (e.Row.FindControl("lblRegionName") as Label).Text; ListItem item1 = ddlRegionNameList.Items.FindByValue(regionNames); if (item1 != null) { ddlRegionNameList.SelectedValue = regionNames; } //DropDownList ddlDistributionRegionNameList = (e.Row.FindControl("DistributionRegionName") as DropDownList); //ddlDistributionRegionNameList.DataSource = li.DistributionRegionNameList().Tables[0]; //ddlDistributionRegionNameList.DataTextField = "DistributionRegionName"; //ddlDistributionRegionNameList.DataValueField = "DistributionRegionName"; //ddlDistributionRegionNameList.DataBind(); ////Add Default Item in the DropDownList //ddlDistributionRegionNameList.Items.Insert(0, new ListItem("Select One")); ////Select the Country of Customer in DropDownList //string distributionRegionNames = (e.Row.FindControl("lblDistributionRegionName") as Label).Text; //ddlDistributionRegionNameList.Items.FindByValue(distributionRegionNames).Selected = true; //Find the DropDownList in the Row DropDownList ddlSubBusinessUnitNameList = (e.Row.FindControl("SubBusinessUnitName") as DropDownList); ddlSubBusinessUnitNameList.DataSource = li.SubBusinessUnitNameList().Tables[0]; ddlSubBusinessUnitNameList.DataTextField = "SubBusinessUnitName"; ddlSubBusinessUnitNameList.DataValueField = "SubBusinessUnitName"; ddlSubBusinessUnitNameList.DataBind(); //Add Default Item in the DropDownList ddlSubBusinessUnitNameList.Items.Insert(0, new ListItem("Select One")); //Select the Country of Customer in DropDownList string subBusinessUnitNames = (e.Row.FindControl("lblSubBusinessUnitName") as Label).Text; ListItem item2 = ddlSubBusinessUnitNameList.Items.FindByValue(subBusinessUnitNames); if (item2 != null) { ddlSubBusinessUnitNameList.SelectedValue = subBusinessUnitNames; } //Find the DropDownList in the Row DropDownList ddlBusinessUnitNameList = (e.Row.FindControl("BusinessUnitName") as DropDownList); ddlBusinessUnitNameList.DataSource = li.BusinessUnitNameList().Tables[0]; ddlBusinessUnitNameList.DataTextField = "BusinessUnitName"; ddlBusinessUnitNameList.DataValueField = "BusinessUnitName"; ddlBusinessUnitNameList.DataBind(); //Add Default Item in the DropDownList ddlBusinessUnitNameList.Items.Insert(0, new ListItem("Select One")); //Select the Country of Customer in DropDownList string businessUnitNames = (e.Row.FindControl("lblBusinessUnitName") as Label).Text; ListItem item3 = ddlBusinessUnitNameList.Items.FindByValue(businessUnitNames); if (item3 != null) { ddlBusinessUnitNameList.SelectedValue = businessUnitNames; } //Find the DropDownList in the Row DropDownList ddlCompanyNameList = (e.Row.FindControl("CompanyName") as DropDownList); ddlCompanyNameList.DataSource = li.CompanyNameList().Tables[0]; ddlCompanyNameList.DataTextField = "CompanyName"; ddlCompanyNameList.DataValueField = "CompanyName"; ddlCompanyNameList.DataBind(); //Add Default Item in the DropDownList ddlCompanyNameList.Items.Insert(0, new ListItem("Select One")); //Select the Country of Customer in DropDownList string companyNames = (e.Row.FindControl("lblCompanyName") as Label).Text; ddlCompanyNameList.Items.FindByValue(companyNames).Selected = true; } }
protected void Page_Load(object sender, EventArgs e) { //VBFunctions.ADFunctions obj = new VBFunctions.ADFunctions(); //string userID = obj.GetUserName(); //// string dirEntry = obj.GetDirectoryEntry(); //memberships = obj.VerifyGroupMemberships("LDAP://192.168.100.3/ou=Cooper Network Users,dc=coopersurgical1,dc=com", "webapps", "Yankees#1", userID); if (!Page.IsPostBack) { //if (memberships == 1 || memberships == 4) //{ SalesRepresentativeReportingChild li = new SalesRepresentativeReportingChild(); DataTable table = new DataTable(); ddlSalesRepLastName.DataSource = li.LastNameList().Tables[0]; ddlSalesRepLastName.DataTextField = "SalesRepLastName"; ddlSalesRepLastName.DataBind(); ddlSalesRepTypeName.DataSource = li.SalesRepTypeNameList().Tables[0]; ddlSalesRepTypeName.DataTextField = "SalesRepTypeName"; ddlSalesRepTypeName.DataBind(); newSalesRepTypeName.DataSource = ddlSalesRepTypeName.DataSource; newSalesRepTypeName.DataTextField = "SalesRepTypeName"; newSalesRepTypeName.DataBind(); ddlTerritoryName.DataSource = li.TerritoryNameList().Tables[0]; ddlTerritoryName.DataTextField = "TerritoryName"; ddlTerritoryName.DataBind(); newTerritoryName.DataSource = ddlTerritoryName.DataSource; newTerritoryName.DataTextField = "TerritoryName"; newTerritoryName.DataBind(); ddlRegionName.DataSource = li.RegionNameList().Tables[0]; ddlRegionName.DataTextField = "RegionName"; ddlRegionName.DataBind(); newRegionName.DataSource = ddlRegionName.DataSource; newRegionName.DataTextField = "RegionName"; newRegionName.DataBind(); ddlDistributionRegionName.DataSource = li.DistributionRegionNameList().Tables[0]; ddlDistributionRegionName.DataTextField = "DistributionRegionName"; ddlDistributionRegionName.DataBind(); newDistributionRegionName.DataSource = ddlDistributionRegionName.DataSource; newDistributionRegionName.DataTextField = "DistributionRegionName"; newDistributionRegionName.DataBind(); ddlSubBusinessUnitName.DataSource = li.SubBusinessUnitNameList().Tables[0]; ddlSubBusinessUnitName.DataTextField = "SubBusinessUnitName"; ddlSubBusinessUnitName.DataBind(); newSubBusinessUnitName.DataSource = ddlSubBusinessUnitName.DataSource; newSubBusinessUnitName.DataTextField = "SubBusinessUnitName"; newSubBusinessUnitName.DataBind(); ddlBusinessUnitName.DataSource = li.BusinessUnitNameList().Tables[0]; ddlBusinessUnitName.DataTextField = "BusinessUnitName"; ddlBusinessUnitName.DataBind(); newBusinessUnitName.DataSource = ddlBusinessUnitName.DataSource; newBusinessUnitName.DataTextField = "BusinessUnitName"; newBusinessUnitName.DataBind(); ddlCompanyName.DataSource = li.CompanyNameList().Tables[0]; ddlCompanyName.DataTextField = "CompanyName"; ddlCompanyName.DataBind(); newCompanyName.DataSource = ddlCompanyName.DataSource; newCompanyName.DataTextField = "CompanyName"; newCompanyName.DataBind(); newCountryName.DataSource = li.CountryNameList().Tables[0]; newCountryName.DataTextField = "CountryName"; newCountryName.DataBind(); newStateProvinceName.DataSource = li.StateProvinceNameList().Tables[0]; newStateProvinceName.DataTextField = "StateProvinceName"; newStateProvinceName.DataBind(); //newCustomerNumber.DataSource = li.CustomerNumberList().Tables[0]; //newCustomerNumber.DataTextField = "CustomerID"; //newCustomerNumber.DataBind(); BindGridView(); // } } }