protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["name"] == null) { Response.Redirect("~/loginPage.aspx"); } else { string username = Session["name"].ToString(); this.Label8.Text = string.Format("Hi {0}", Session["name"].ToString() + "!"); //Label8.Visible = false; //Label8.Text = username; string connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString; SqlConnection con = null; try { con = new SqlConnection(connString); /*For State Dropdown Load*/ string com = "Select RowID, ast_lvl_ast_lvl from ast_lvl (nolock)"; SqlDataAdapter adpt = new SqlDataAdapter(com, con); DataTable dt = new DataTable(); adpt.Fill(dt); DropDownState.DataSource = dt; DropDownState.DataBind(); DropDownState.DataTextField = "ast_lvl_ast_lvl"; DropDownState.DataValueField = "RowID"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("ALL", "0")); /*For District Dropdown Load*/ DropDownDistrict.Items.Insert(0, new ListItem("ALL", "0")); /*For Clinic Cate Dropdown Load*/ DropDownCliniccat.Items.Insert(0, new ListItem("Dental Delivery Units", "1")); DropDownCliniccat.Items.Insert(0, new ListItem("CHAIRS, EXAMINATION/TREATMENT, DENTISTRY, SPECIALIST", "2")); DropDownCliniccat.Items.Insert(0, new ListItem("Chairs, Examination/Treatment, Dentistry", "3")); DropDownCliniccat.Items.Insert(0, new ListItem("ALL", "0")); } catch (Exception ex) { //log error //display friendly error to user string msg = "Insert Error:"; msg += ex.Message; throw new Exception(msg); } finally { con.Close(); } } } }
private void fillddl() { DropDownState.DataSource = db.manage_state(0, "", 4); DropDownState.DataTextField = "StateName"; DropDownState.DataValueField = "StateId"; DropDownState.DataBind(); DropDownState.Items.Insert(0, "--Select State--"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["name"] == null) { Session["prevUrl"] = Request.Url; Response.Redirect("~/loginPage.aspx"); } else { string username = Session["name"].ToString(); this.Label8.Text = string.Format("Hi {0}", Session["name"].ToString() + "!"); string connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString; SqlConnection con = null; try { con = new SqlConnection(connString); /*For State Dropdown Load*/ string com = "Select RowID, ast_lvl_ast_lvl from ast_lvl (nolock)"; SqlDataAdapter adpt = new SqlDataAdapter(com, con); DataTable dt = new DataTable(); adpt.Fill(dt); DropDownState.DataSource = dt; DropDownState.DataBind(); DropDownState.DataTextField = "ast_lvl_ast_lvl"; DropDownState.DataValueField = "RowID"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("--Select--", "0")); DropDownClinicCategory.Items.Insert(0, new ListItem("KESIHATAN", "1")); DropDownClinicCategory.Items.Insert(0, new ListItem("PERGIGIAN", "2")); DropDownClinicCategory.Items.Insert(0, new ListItem("ALL", "0")); // MyReportViewer.ServerReport.ReportServerUrl = new Uri("http://chs015-2-3/ReportServer"); MyReportViewer.ServerReport.ReportServerUrl = new Uri("http://Localhost/ReportServer"); MyReportViewer.ServerReport.ReportPath = "/AdditionalEB EquipmentList FORMVAR2/MEET"; MyReportViewer.ServerReport.Refresh(); } catch (Exception ex) { //log error //display friendly error to user string msg = "Insert Error:"; msg += ex.Message; throw new Exception(msg); } finally { con.Close(); } } } }
private void OnDropStateChange(DropDownState state) { var dropStateChange = DropStateChange; if (dropStateChange != null) { dropStateChange(state); } }
protected void loadstate() { if (DropDowncountry.SelectedIndex != 0) { int conutryId = Convert.ToInt32(DropDowncountry.SelectedValue); DataTable dt = mpDetailsBAL.loadState(conutryId); DropDownState.DataSource = dt; DropDownState.DataTextField = "state"; DropDownState.DataValueField = "stateId"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("Select State", "0")); string estate = dt1.Rows[0]["state"].ToString(); DropDownState.Items.FindByText(estate).Selected = true; loadconstituency();// to load and select the relevant constituency. DropDownpermanentState.DataSource = dt; DropDownpermanentState.DataTextField = "state"; DropDownpermanentState.DataValueField = "stateId"; DropDownpermanentState.DataBind(); DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0")); string pstate = dt1.Rows[0]["permanentState"].ToString(); DropDownpermanentState.Items.FindByText(pstate).Selected = true; loadpermanentDistrict(); DropDowncurrentState.DataSource = dt; DropDowncurrentState.DataTextField = "state"; DropDowncurrentState.DataValueField = "stateId"; DropDowncurrentState.DataBind(); DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0")); string cstate = dt1.Rows[0]["currentState"].ToString(); DropDowncurrentState.Items.FindByText(cstate).Selected = true; loadcurrentDistrict(); // put party in party combo box. dt.Dispose(); dt = mpDetailsBAL.loadParty(conutryId); DropDownparty.DataSource = dt; DropDownparty.DataTextField = "partyName"; DropDownparty.DataValueField = "partyId"; DropDownparty.DataBind(); DropDownparty.Items.Insert(0, new ListItem("Select Party", "0")); string pparty = dt1.Rows[0]["partyName"].ToString(); DropDownparty.Items.FindByText(pparty).Selected = true; } else { DropDownState.Items.Clear(); DropDownState.Items.Insert(0, new ListItem("Select State", "0")); DropDownpermanentState.Items.Clear(); DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0")); DropDowncurrentState.Items.Clear(); DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0")); } }
public void CloseDropDown() { if (fDropContainer == null) { return; } fDropState = DropDownState.Closing; fDropContainer.Freeze = false; fDropContainer.Close(); }
public DropDownState GetStateIDByGSTIN(string gstin) { DropDownState dropDownState = new DropDownState(); BAL_Common bAL_Common = new BAL_Common(); State state = new State(); state = bAL_Common.GetStateByGSTIN(gstin); if (state != null) { dropDownState.text = state.Name; dropDownState.Value = state.ID; } return(dropDownState); }
protected void DropDownZone_SelectedIndexChanged(object sender, EventArgs e) { string connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString; SqlConnection con = null; try { con = new SqlConnection(connString); /*For Zone Dropdown Load*/ if (DropDownZone.SelectedItem.Text == "ALL") { /*For State Dropdown Load*/ string com = "Select RowID, ast_lvl_ast_lvl from ast_lvl (nolock)"; SqlDataAdapter adpt = new SqlDataAdapter(com, con); DataTable dt = new DataTable(); adpt.Fill(dt); DropDownState.DataSource = dt; DropDownState.DataBind(); DropDownState.DataTextField = "ast_lvl_ast_lvl"; DropDownState.DataValueField = "RowID"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("ALL", "0")); } else { /*For State Dropdown Load*/ string com = "Select distinct Dense_rank() Over(order by ast_loc_state) as RowID, ast_loc_state as ast_lvl_ast_lvl from ast_loc (Nolock) where ast_loc_zone = '" + DropDownZone.SelectedItem.Text + "'"; SqlDataAdapter adpt = new SqlDataAdapter(com, con); DataTable dt = new DataTable(); adpt.Fill(dt); DropDownState.DataSource = dt; DropDownState.DataBind(); DropDownState.DataTextField = "ast_lvl_ast_lvl"; DropDownState.DataValueField = "RowID"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("ALL", "0")); } } catch (Exception ex) { //log error //display friendly error to user string msg = "Insert Error:"; msg += ex.Message; } }
private void dropContainer_Closed(object sender, FormClosedEventArgs e) { if (!fDropContainer.IsDisposed) { fDropContainer.DropStateChange -= dropContainer_DropStateChange; fDropContainer.FormClosed -= dropContainer_Closed; ParentForm.Move -= ParentForm_Move; fDropContainer.Dispose(); } fDropContainer = null; fClosedWhileInControl = (RectangleToScreen(ClientRectangle).Contains(Cursor.Position)); fDropState = DropDownState.Closed; Invalidate(); }
public void fillData() { DropDownState.DataTextField = objBusinessLayer.BusinessFillState().Columns[0].ToString(); objDataTableOne = objBusinessLayer.BusinessFillState(); DropDownState.DataSource = objDataTableOne; DropDownState.DataBind(); DropDownPlan.DataTextField = objBusinessLayer.BusinessFillPlan().Columns[0].ToString(); objDataTableTwo = objBusinessLayer.BusinessFillPlan(); DropDownPlan.DataSource = objDataTableTwo; DropDownPlan.DataBind(); Random rnd = new Random(); lblPatientID.Text = Convert.ToString(rnd.Next(10000, 99999)); }
public List <DropDownState> GetListOfStates() { BAL_Common bAL_Common = new BAL_Common(); List <State> stateList = new List <State>(); stateList = bAL_Common.GetStateListForDropDown(); List <DropDownState> dropDownStateList = new List <DropDownState>(); foreach (State state in stateList) { DropDownState dropDownState = new DropDownState(); dropDownState.text = state.Name; dropDownState.Value = state.ID; dropDownStateList.Add(dropDownState); } return(dropDownStateList); }
public void State() { cn.Open(); //Response.Write(DropDownCountry.SelectedValue); using (SqlCommand cmd = new SqlCommand("select StateName,stateid from Statetable where CountryId='" + DropDownCountry.SelectedValue + "'", cn)) { using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)) { DropDownState.DataSource = dr; DropDownState.Items.Clear(); DropDownState.Items.Add("Please Select State"); DropDownState.DataTextField = "StateName"; DropDownState.DataValueField = "StateId"; DropDownState.DataBind(); } } }
protected void DropDowncountry_SelectedIndexChanged(object sender, EventArgs e) { if (DropDowncountry.SelectedIndex != 0) { int conutryId = Convert.ToInt32(DropDowncountry.SelectedValue); DataTable dt = mpDetailsBAL.loadState(conutryId); DropDownState.DataSource = dt; DropDownState.DataTextField = "state"; DropDownState.DataValueField = "stateId"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("Select State", "0")); DropDownpermanentState.DataSource = dt; DropDownpermanentState.DataTextField = "state"; DropDownpermanentState.DataValueField = "stateId"; DropDownpermanentState.DataBind(); DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0")); DropDowncurrentState.DataSource = dt; DropDowncurrentState.DataTextField = "state"; DropDowncurrentState.DataValueField = "stateId"; DropDowncurrentState.DataBind(); DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0")); // put party in party combo box. dt.Dispose(); dt = mpDetailsBAL.loadParty(conutryId); DropDownparty.DataSource = dt; DropDownparty.DataTextField = "partyName"; DropDownparty.DataValueField = "partyId"; DropDownparty.DataBind(); DropDownparty.Items.Insert(0, new ListItem("Select Party", "0")); } else { DropDownState.Items.Clear(); DropDownState.Items.Insert(0, new ListItem("Select State", "0")); DropDownpermanentState.Items.Clear(); DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0")); DropDowncurrentState.Items.Clear(); DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0")); } }
public void InitializeDropDown(Control dropDownItem) { if (fDropDownItem != null) { throw new Exception("The drop down item has already been implemented!"); } fDesignView = false; fDropState = DropDownState.Closed; Size = fAnchorSize; fAnchorClientBounds = new Rectangle(2, 2, fAnchorSize.Width - 21, fAnchorSize.Height - 4); // removes the dropDown item from the controls list so it // won't be seen until the drop-down window is active if (Controls.Contains(dropDownItem)) { Controls.Remove(dropDownItem); } fDropDownItem = dropDownItem; }
protected void OpenDropDown() { if (fDropDownItem == null) { throw new NotImplementedException("The drop down item has not been initialized! Use the InitializeDropDown() method to do so."); } if (!CanDrop) { return; } fDropContainer = new DropDownContainer(fDropDownItem); fDropContainer.Bounds = GetDropDownBounds(); fDropContainer.DropStateChange += dropContainer_DropStateChange; fDropContainer.FormClosed += dropContainer_Closed; ParentForm.Move += ParentForm_Move; fDropState = DropDownState.Dropping; fDropContainer.Show(this); fDropState = DropDownState.Dropped; Invalidate(); }
protected void ChooseLeague(LeagueViewModel chosenLeague) { SelectedLeague = chosenLeague; DropDownState.SetLeague(SelectedLeague); }
private void dropContainer_DropStateChange(DropDownState state) { fDropState = state; }
protected void ChooseCompetition(CompetitionConfigViewModel chosenCompetition) { SelectedCompetition = chosenCompetition; DropDownState.SetSelectedCompetition(SelectedCompetition); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["name"] == null) { Session["prevUrl"] = Request.Url; Response.Redirect("~/loginPage.aspx"); } else { string username = Session["name"].ToString(); this.Label8.Text = string.Format("Hi {0}", Session["name"].ToString() + "!"); string connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString; SqlConnection con = null; try { con = new SqlConnection(connString); /*For State Dropdown Load*/ string com = "Select RowID, ast_lvl_ast_lvl from ast_lvl (nolock)"; SqlDataAdapter adpt = new SqlDataAdapter(com, con); DataTable dt = new DataTable(); adpt.Fill(dt); DropDownState.DataSource = dt; DropDownState.DataBind(); DropDownState.DataTextField = "ast_lvl_ast_lvl"; DropDownState.DataValueField = "RowID"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("--Select--", "0")); DropDownDistrict.Items.Insert(0, new ListItem("--Select--", "0")); DropDownDocType.Items.Insert(0, new ListItem("PPM B03 & CHECKLIST", "1")); // DropDownDocType.Items.Insert(0, new ListItem("PPM CHECKLIST", "2"));//commented by muruganantham DropDownDocType.Items.Insert(0, new ListItem("--Select--", "0")); freq_DropDownList1.Items.Insert(0, new ListItem("--Select--", "0")); freq_DropDownList1.Items.Insert(1, new ListItem("1", "1")); freq_DropDownList1.Items.Insert(2, new ListItem("2", "2")); string com1 = "WITH Years(No , Year) AS ( SELECT 1, 2013 year UNION ALL SELECT No+1,year+1 FROM Years AS d where Year < Year(getdate())) SELECT No , Year FROM Years order by year desc"; SqlDataAdapter adpt1 = new SqlDataAdapter(com1, con); DataTable dt1 = new DataTable(); adpt1.Fill(dt1); DropDownYear.DataSource = dt1; DropDownYear.DataBind(); DropDownYear.DataTextField = "Year"; DropDownYear.DataValueField = "No"; DropDownYear.DataBind(); DropDownYear.Items.Insert(0, new ListItem("--Select--", "0")); } catch (Exception ex) { //log error //display friendly error to user string msg = "Insert Error:"; msg += ex.Message; throw new Exception(msg); } finally { con.Close(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["name"] == null) { Session["prevUrl"] = Request.Url; Response.Redirect("~/loginPage.aspx"); } else { string username = Session["name"].ToString(); this.Label8.Text = string.Format("Hi {0}", Session["name"].ToString() + "!"); // Label8.Visible = false; // Label8.Text = username; string connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString; SqlConnection con = null; try { con = new SqlConnection(connString); /*For Zone Dropdown Load*/ string com01 = "select distinct ast_loc_zone , ast_loc_zone from ast_loc (nolock)"; SqlDataAdapter adptzo = new SqlDataAdapter(com01, con); DataTable dtzo = new DataTable(); adptzo.Fill(dtzo); DropDownZone.DataSource = dtzo; DropDownZone.DataBind(); DropDownZone.DataTextField = "ast_loc_zone"; DropDownZone.DataValueField = "ast_loc_zone"; DropDownZone.DataBind(); DropDownZone.Items.Insert(0, new ListItem("ALL", "0")); /*For State Dropdown Load*/ string com = "Select RowID, ast_lvl_ast_lvl from ast_lvl (nolock)"; SqlDataAdapter adpt = new SqlDataAdapter(com, con); DataTable dt = new DataTable(); adpt.Fill(dt); DropDownState.DataSource = dt; DropDownState.DataBind(); DropDownState.DataTextField = "ast_lvl_ast_lvl"; DropDownState.DataValueField = "RowID"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("ALL", "0")); /*For District Dropdown Load*/ DropDownDistrict.Items.Insert(0, new ListItem("ALL", "0")); /*For Circle Dropdown Load*/ DropDowncircle.Items.Insert(0, new ListItem("ALL", "0")); /*For Clinic Cate Dropdown Load*/ DropDownCliniccat.Items.Insert(0, new ListItem("KESIHATAN", "1")); DropDownCliniccat.Items.Insert(0, new ListItem("PERGIGIAN", "2")); DropDownCliniccat.Items.Insert(0, new ListItem("ALL", "0")); /*For BE Category Cate Dropdown Load*/ string com4 = "select ast_grp_grp_cd , ast_grp_category from ast_grp (nolock) order by ast_grp_category "; SqlDataAdapter adpt4 = new SqlDataAdapter(com4, con); DataTable dt4 = new DataTable(); adpt4.Fill(dt4); DropDownBECate.DataSource = dt4; DropDownBECate.DataBind(); DropDownBECate.DataTextField = "ast_grp_category"; DropDownBECate.DataValueField = "ast_grp_grp_cd"; DropDownBECate.DataBind(); DropDownBECate.Items.Insert(0, new ListItem("ALL", "0")); /*For BE Category Cate Dropdown Load*/ string com5 = "select wrk_sts_status ,wrk_sts_desc from wrk_sts (nolock) where wrk_sts_disable_flag = 0"; SqlDataAdapter adpt5 = new SqlDataAdapter(com5, con); DataTable dt5 = new DataTable(); adpt5.Fill(dt5); DropDownList1.DataSource = dt5; DropDownList1.DataBind(); DropDownList1.DataTextField = "wrk_sts_desc"; DropDownList1.DataValueField = "wrk_sts_status"; DropDownList1.DataBind(); DropDownList1.Items.Insert(0, new ListItem("ALL", "0")); } catch (Exception ex) { //log error //display friendly error to user string msg = "Insert Error:"; msg += ex.Message; throw new Exception(msg); } finally { con.Close(); } } } }
/// <summary> /// Draw a drop-down menu for selecting among a list /// of items (strings). /// </summary> /// <param name="buttonRect"> /// specifies the position and size of the /// button that is clicked to open the drop-down list /// </param> /// <param name="items"> /// the list of items (strings) in the drop-down list /// </param> /// <param name="state"> /// the current state of the drop-down list, /// i.e. the currently selected item and whether /// or not the drop-down list is expanded. /// </param> /// <param name="icon"> /// expander icon (arrow) that is drawn /// on the right side of the drop-down button /// </param> /// <param name="buttonStyle"> /// the GUIStyle for the button that opens/closes /// the drop-down list /// </param> /// <param name="listBackgroundStyle"> /// The GUIStyle for the box that is drawn /// behind the drop-down list items. /// </param> /// <param name="listForegroundStyle"> /// The GUIStyle for a box that is drawn /// on top of the drop-down list items. /// This style should be mostly transparent /// so that the individual list items /// are not hidden. I use this style to draw /// the border around the drop-down list /// after the individual list items have /// been rendered. /// </param> /// <param name="listItemStyle"> /// the GUIStyle for the individual items /// in the drop-down list /// </param> /// <returns> /// the new state of the drop-down list /// </returns> public static DropDownState DropDownMenu( Rect buttonRect, List <string> items, DropDownState state, Texture2D icon, GUIStyle buttonStyle, GUIStyle listBackgroundStyle, GUIStyle listForegroundStyle, GUIStyle listItemStyle) { // draw drop-down button GUI.Label(buttonRect, items[state.selectedIndex], buttonStyle); // draw expander icon (arrow) var origColor = GUI.color; GUI.color = Color.black; const int iconMargin = 10; var iconAspect = (float)icon.width / icon.height; var iconHeight = buttonRect.height - 2 * iconMargin; var iconWidth = iconAspect * iconHeight; var iconRect = new Rect( buttonRect.x + buttonRect.width - iconMargin - iconWidth, buttonRect.y + iconMargin, iconWidth, iconHeight); GUI.DrawTexture(iconRect, icon, ScaleMode.ScaleToFit); GUI.color = origColor; // handle mouse clicks on drop-down button var controlID = GUIUtility.GetControlID(FocusType.Passive); switch (Event.current.GetTypeForControl(controlID)) { case EventType.MouseDown: if (buttonRect.Contains(Event.current.mousePosition)) { GUIUtility.hotControl = controlID; state.expanded = !state.expanded; } break; case EventType.MouseUp: if (GUIUtility.hotControl == controlID) { GUIUtility.hotControl = 0; } break; } // draw drop-down menu and handle mouse clicks if (state.expanded) { // calculate total height of drop-down list var listHeight = 0f; foreach (var item in items) { listHeight += listItemStyle.CalcSize(new GUIContent(item)).y; } // Draw background for the list box. // Note that we draw the list box border separately // so that it does not get overwritten by the // individual list items. const float listOffset = 10; var listY = buttonRect.y - listOffset - listHeight; var listRect = new Rect(buttonRect.x, listY, buttonRect.width, listHeight); GUI.Box(listRect, "", listBackgroundStyle); // draw individual list items and handle mouse clicks var y = listY; for (var i = 0; i < items.Count; ++i) { var itemHeight = listItemStyle.CalcSize( new GUIContent(items[i])).y; var itemRect = new Rect(buttonRect.x, y, buttonRect.width, itemHeight); GUI.Box(itemRect, items[i], listItemStyle); switch (Event.current.GetTypeForControl(controlID)) { case EventType.MouseDown: if (itemRect.Contains(Event.current.mousePosition)) { state.selectedIndex = i; state.expanded = false; } break; } y += itemHeight; } // Draw border around drop-down list. // This needs to be drawn last so that the individual list // items don't overwrite the border. GUI.Box(listRect, "", listForegroundStyle); } return(state); }
protected void Page_Load(object sender, EventArgs e) { DropDownState.DataSource = states; DropDownState.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["name"] == null) { Session["prevUrl"] = Request.Url; Response.Redirect("~/loginPage.aspx"); } else { string username = Session["name"].ToString(); this.Label8.Text = string.Format("Hi {0}", Session["name"].ToString() + "!"); //Label8.Visible = false; //Label8.Text = username; string connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString; SqlConnection con = null; try { con = new SqlConnection(connString); string com01 = "select distinct ast_loc_zone , ast_loc_zone from ast_loc (nolock)"; SqlDataAdapter adptzo = new SqlDataAdapter(com01, con); DataTable dtzo = new DataTable(); adptzo.Fill(dtzo); DropDownZone.DataSource = dtzo; DropDownZone.DataBind(); DropDownZone.DataTextField = "ast_loc_zone"; DropDownZone.DataValueField = "ast_loc_zone"; DropDownZone.DataBind(); DropDownZone.Items.Insert(0, new ListItem("ALL", "0")); /*For State Dropdown Load*/ string com = "Select RowID, ast_lvl_ast_lvl from ast_lvl (nolock)"; SqlDataAdapter adpt = new SqlDataAdapter(com, con); DataTable dt = new DataTable(); adpt.Fill(dt); DropDownState.DataSource = dt; DropDownState.DataBind(); DropDownState.DataTextField = "ast_lvl_ast_lvl"; DropDownState.DataValueField = "RowID"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("ALL", "0")); DropDownDistrict.Items.Insert(0, new ListItem("ALL", "0")); DropDownCliniccat.Items.Insert(0, new ListItem("KESIHATAN", "1")); DropDownCliniccat.Items.Insert(0, new ListItem("PERGIGIAN", "2")); DropDownCliniccat.Items.Insert(0, new ListItem("ALL", "0")); /*For State Dropdown Load*/ string comown = "select distinct Ownership_desc as 'Ownership' , Ownership_desc from ownership_mst (nolock)"; SqlDataAdapter adptown = new SqlDataAdapter(comown, con); DataTable dtown = new DataTable(); adptown.Fill(dtown); DropDownownership.DataSource = dtown; DropDownownership.DataBind(); DropDownownership.DataTextField = "Ownership_desc"; DropDownownership.DataValueField = "Ownership"; DropDownownership.DataBind(); DropDownownership.Items.Insert(0, new ListItem("ALL", "0")); MyReportViewer.ProcessingMode = ProcessingMode.Remote; MyReportViewer.ServerReport.ReportServerUrl = new Uri("http://localhost/ReportServer"); MyReportViewer.ServerReport.ReportPath = "/TSD-Performance/TSD-USM-KPIPenalty"; MyReportViewer.ServerReport.Refresh(); } catch (Exception ex) { //log error //display friendly error to user string msg = "Insert Error:"; msg += ex.Message; throw new Exception(msg); } finally { con.Close(); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString; SqlConnection con = null; try { con = new SqlConnection(connString); /*For State Dropdown Load*/ string com = "select Statecode , SatateDesc from PR_location_mst (nolock)"; SqlDataAdapter adpt = new SqlDataAdapter(com, con); DataTable dt = new DataTable(); adpt.Fill(dt); DropDownState.DataSource = dt; DropDownState.DataBind(); DropDownState.DataTextField = "SatateDesc"; DropDownState.DataValueField = "Statecode"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("ALL", "0")); /*For PO Status Dropdown Load*/ string com1 = "select ast_grp_grp_cd ,ast_grp_general_name from ast_grp (nolock) order by ast_grp_general_name"; SqlDataAdapter adpt1 = new SqlDataAdapter(com1, con); DataTable dt1 = new DataTable(); adpt1.Fill(dt1); Category.DataSource = dt1; Category.DataBind(); Category.DataTextField = "ast_grp_general_name"; Category.DataValueField = "ast_grp_grp_cd"; Category.DataBind(); Category.Items.Insert(0, new ListItem("ALL", "0")); /*For PO Status Dropdown Load*/ string com2 = "select mfg_mst_mfg_cd , mfg_mst_mfg_cd as MfgDescription from mfg_mst (nolock) order by mfg_mst_mfg_cd "; SqlDataAdapter adpt2 = new SqlDataAdapter(com2, con); DataTable dt2 = new DataTable(); adpt2.Fill(dt2); Manafacturer.DataSource = dt2; Manafacturer.DataBind(); Manafacturer.DataTextField = "MfgDescription"; Manafacturer.DataValueField = "mfg_mst_mfg_cd"; Manafacturer.DataBind(); Manafacturer.Items.Insert(0, new ListItem("ALL", "0")); } catch (Exception ex) { //log error //display friendly error to user string msg = "Insert Error:"; msg += ex.Message; throw new Exception(msg); } finally { con.Close(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["name"] == null) { Session["prevUrl"] = Request.Url; Response.Redirect("~/loginPage.aspx"); } else { string username = Session["name"].ToString(); this.Label8.Text = string.Format("Hi {0}", Session["name"].ToString() + "!"); //Label8.Visible = false; //Label8.Text = username; string connString = ConfigurationManager.ConnectionStrings["tomms_prodConnectionString"].ConnectionString; SqlConnection con = null; try { con = new SqlConnection(connString); /*For State Dropdown Load*/ string com = "Select RowID, ast_lvl_ast_lvl from ast_lvl (nolock)"; SqlDataAdapter adpt = new SqlDataAdapter(com, con); DataTable dt = new DataTable(); adpt.Fill(dt); DropDownState.DataSource = dt; DropDownState.DataBind(); DropDownState.DataTextField = "ast_lvl_ast_lvl"; DropDownState.DataValueField = "RowID"; DropDownState.DataBind(); DropDownState.Items.Insert(0, new ListItem("ALL", "0")); /*For District Dropdown Load*/ //string com1 = "select RowID , ast_loc_ast_loc from ast_loc (nolock) where ast_loc_state = '" + DropDownState.SelectedItem.Text + "'"; // //SqlDataAdapter adpt1 = new SqlDataAdapter(com1, con); //DataTable dt1 = new DataTable(); //adpt1.Fill(dt1); //DropDownDistrict.DataSource = dt1; //DropDownDistrict.DataBind(); //DropDownDistrict.DataTextField = "ast_loc_ast_loc"; //DropDownDistrict.DataValueField = "RowID"; //DropDownDistrict.DataBind(); DropDownDistrict.Items.Insert(0, new ListItem("ALL", "0")); /*For Circle Dropdown Load*/ //string Com2 = "select RowID , ast_loc_circle from ast_loc (nolock) where ast_loc_state = '" + DropDownState.SelectedItem.Text + "' and ast_loc_ast_loc = '" + DropDownDistrict.SelectedItem.Text + "'"; // //SqlDataAdapter adpt2 = new SqlDataAdapter(Com2, con); //DataTable dt2 = new DataTable(); //adpt2.Fill(dt2); //DropDowncircle.DataSource = dt2; //DropDowncircle.DataBind(); //DropDowncircle.DataTextField = "ast_loc_circle"; //DropDowncircle.DataValueField = "RowID"; //DropDowncircle.DataBind(); DropDowncircle.Items.Insert(0, new ListItem("ALL", "0")); /*For Clinic Cate Dropdown Load*/ DropDownCliniccat.Items.Insert(0, new ListItem("KESIHATAN", "1")); DropDownCliniccat.Items.Insert(0, new ListItem("PERGIGIAN", "2")); DropDownCliniccat.Items.Insert(0, new ListItem("ALL", "0")); /*For Ownership Dropdown Load*/ DropDownOwner.Items.Insert(0, new ListItem("Existing", "1")); DropDownOwner.Items.Insert(0, new ListItem("New Biomedical", "2")); DropDownOwner.Items.Insert(0, new ListItem("Purchase Biomedical", "3")); DropDownOwner.Items.Insert(0, new ListItem("ALL", "0")); /*For BE Category Cate Dropdown Load*/ string com4 = "select ast_grp_grp_cd , ast_grp_category from ast_grp (nolock) order by ast_grp_category "; SqlDataAdapter adpt4 = new SqlDataAdapter(com4, con); DataTable dt4 = new DataTable(); adpt4.Fill(dt4); DropDownBECate.DataSource = dt4; DropDownBECate.DataBind(); DropDownBECate.DataTextField = "ast_grp_category"; DropDownBECate.DataValueField = "ast_grp_grp_cd"; DropDownBECate.DataBind(); DropDownBECate.Items.Insert(0, new ListItem("ALL", "0")); } catch (Exception ex) { //log error //display friendly error to user string msg = "Insert Error:"; msg += ex.Message; throw new Exception(msg); } finally { con.Close(); } } } }