/// <summary> /// Bind status to status dropdown /// </summary> public void Add_Status() { try { DataTable dt = new DataTable(); dt.Columns.Add("Value"); dt.Rows.Add("Published"); dt.Rows.Add("Draft"); dt.Rows.Add("Archived"); DDLStatus.DataSource = dt; DDLStatus.DataTextField = "Value"; DDLStatus.DataValueField = "Value"; DDLStatus.DataBind(); DDLStatus.Select("Published"); DDLStatus.Select("Draft"); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
protected void GetIndexStatus() { DDLStatus.DataValueField = "ID"; DDLStatus.DataTextField = "Adi"; DDLStatus.DataSource = clSsql.getDT("Select * from SiyahiOlkeBeynelxalq"); DDLStatus.DataBind(); DDLStatus.Items.Insert(0, new ListItem("Seçin", "0")); }
public void FillFollowup() { string str = "select Name as Id from [Come2myCityDB].[dbo].[tbl_Main_ID] where Sub_Id='5'"; SqlDataAdapter da = new SqlDataAdapter(str, con); DataSet ds = new DataSet(); da.Fill(ds); DDLStatus.DataSource = ds; if (ds.Tables[0].Rows.Count > 0) { DDLStatus.DataValueField = "Id"; } DDLStatus.DataBind(); DDLStatus.Items.Add("Select"); }
public void txtchange(DropDownList ddl, TextBox tb) { string str1 = "select Name,ID from [Come2myCityDB].[dbo].[tbl_Main_ID] where UserId='" + Session["User"].ToString() + "' and Sub_ID='5'"; DataSet ds = cc.ExecuteDataset(str1); //string str = Convert.ToString(ds.Tables[0].Rows[0]["Name"]); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (Convert.ToString(txtStatus.Text) == Convert.ToString(ds.Tables[0].Rows[i]["Name"])) { //string abc = txtStatus.Text; ViewState["abc"] = txtStatus.Text; } } if (Convert.ToString(txtStatus.Text) == Convert.ToString(ViewState["abc"])) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('this type of Status Already Present')", true); DDLStatus.Visible = true; txtStatus.Visible = false; ViewState["abc"] = null; } else { string st = txtStatus.Text.ToUpper(); string str3 = "insert into [Come2myCityDB].[dbo].[tbl_Main_ID](Sub_ID,Name,UserId)values('5','" + st + "','" + Session["User"].ToString() + "')"; int row = cc.ExecuteNonQuery(str3); string str2 = "select Name,ID from [Come2myCityDB].[dbo].[tbl_Main_ID] where UserId='" + Session["User"].ToString() + "'"; DataSet ds1 = cc.ExecuteDataset(str2); DDLStatus.DataSource = ds; DDLStatus.DataTextField = "Name"; DDLStatus.DataValueField = "ID"; DDLStatus.DataBind(); DDLStatus.Items.Insert(0, new ListItem("select", "0")); DDLStatus.SelectedIndex = 0; ddl.Visible = true; tb.Visible = false; } }
public void fill() { string str = "select Name as Id from [Come2myCityDB].[dbo].[tbl_Main_ID] where UserId='" + Session["User"].ToString() + "'"; DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(str, con); da.Fill(ds); DDLStatus.DataSource = ds; if (ds.Tables[0].Rows.Count > 0) { DDLStatus.DataValueField = "Id"; } DDLStatus.DataBind(); DDLStatus.Items.Add("Add New"); DDLStatus.Items.Add("Select"); DDLStatus.Items.Insert(0, new ListItem("select", "0")); DDLStatus.SelectedIndex = 0; }
public void QueryTypesDdl() { try { MySqlConnection con = new MySqlConnection(connectionString); con.Open(); String query2 = @"SELECT * FROM TYPES"; MySqlCommand com2 = new MySqlCommand(query2, con); MySqlDataAdapter adapter = new MySqlDataAdapter(com2); DataTable dt = new DataTable(); adapter.Fill(dt); DDLStatus.DataSource = dt; DDLStatus.DataBind(); DDLStatus.DataTextField = "TYPEV"; DDLStatus.DataValueField = "TYPEN"; DDLStatus.DataBind(); } catch (Exception ex) { Response.Write(ex.Message); } }
/// <summary> /// Bind status to status dropdown /// </summary> public void Add_VettingStatus() { try { DataTable dt = new DataTable(); dt.Columns.Add("Value"); dt.Rows.Add("Planned"); dt.Rows.Add("In-Progress"); dt.Rows.Add("Completed"); dt.Rows.Add("Failed"); DDLStatus.DataSource = dt; DDLStatus.DataTextField = "Value"; DDLStatus.DataValueField = "Value"; DDLStatus.DataBind(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }