protected void butSubmit_Click(object sender, EventArgs e) { string userName = Session["userid"].ToString(); string XmlFilePath = "C:\\Users\\Samarth\\Documents\\Visual Studio 2010\\WebSites\\Apartment\\" + pageName + ".xml"; if (File.Exists(XmlFilePath)) { XmlDocument doc = new XmlDocument(); doc.Load(XmlFilePath); XmlNode discussion = doc.CreateNode(XmlNodeType.Element, "Discussion", null); XmlNode name = doc.CreateElement("Name"); name.InnerText = userName; XmlNode comment = doc.CreateElement("Comment"); comment.InnerText = txtComments.Text.ToString(); XmlNode date = doc.CreateElement("Date"); date.InnerText = DateTime.Now.ToString(); discussion.AppendChild(name); discussion.AppendChild(comment); discussion.AppendChild(date); XmlNodeList l = doc.GetElementsByTagName("Discussions"); l[0].AppendChild(discussion); doc.Save(XmlFilePath); } else { using (XmlWriter writer = XmlWriter.Create(XmlFilePath)) { writer.WriteStartDocument(); writer.WriteStartElement("Discussions"); writer.WriteStartElement("Discussion"); writer.WriteElementString("Name", userName); writer.WriteElementString("Comment", txtComments.Text.ToString()); writer.WriteElementString("Date", DateTime.Now.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndDocument(); } } DataSet ds = new DataSet(); string path = "\\Apartment\\" + pageName + ".xml"; ds.ReadXml(Server.MapPath(path)); DataTable dt = ds.Tables[0]; DataGrid1.DataSource = dt; DataGrid1.DataBind(); txtComments.Text = ""; }
private void ButtonSearch_Click(object sender, RoutedEventArgs e) { DataGrid1.Bind(); }
protected void Button1_Click(object sender, System.EventArgs e) { string query1 = ""; string query3 = ""; if (DropDownList1.SelectedIndex == 0) { query1 = "tradeid=" + "'" + TextBox1.Text + "'"; query3 = "tradeid!=" + "'" + TextBox1.Text + "'"; } if (DropDownList1.SelectedIndex == 1) { query1 = "carid=" + "'" + TextBox1.Text + "'"; query3 = "carid!=" + "'" + TextBox1.Text + "'"; } if (DropDownList1.SelectedIndex == 2) { query1 = "userid=" + "'" + TextBox1.Text + "'"; query3 = "userid!=" + "'" + TextBox1.Text + "'"; } if (DropDownList1.SelectedIndex == 3) { query1 = "operid=" + "'" + TextBox1.Text + "'"; query3 = "operid!=" + "'" + TextBox1.Text + "'"; } if (DropDownList1.SelectedIndex == 4) { query1 = "subpoint=" + "'" + TextBox1.Text + "'"; query3 = "subpoint!=" + "'" + TextBox1.Text + "'"; } if (DropDownList1.SelectedIndex == 5) { query1 = "begintime=" + "'" + TextBox1.Text + "'"; query3 = "begintime!=" + "'" + TextBox1.Text + "'"; } if (DropDownList1.SelectedIndex == 6) { query1 = "endtime=" + "'" + TextBox1.Text + "'"; query3 = "endtime!=" + "'" + TextBox1.Text + "'"; } string query2 = ""; string query4 = ""; if (DropDownList3.SelectedIndex == 0) { query2 = "tradeid=" + "'" + TextBox2.Text + "'"; query4 = "tradeid!=" + "'" + TextBox2.Text + "'"; } if (DropDownList3.SelectedIndex == 1) { query2 = "carid=" + "'" + TextBox2.Text + "'"; query4 = "carid!=" + "'" + TextBox2.Text + "'"; } if (DropDownList3.SelectedIndex == 2) { query2 = "userid=" + "'" + TextBox2.Text + "'"; query4 = "userid!=" + "'" + TextBox2.Text + "'"; } if (DropDownList3.SelectedIndex == 3) { query2 = "operid=" + "'" + TextBox2.Text + "'"; query4 = "operid!=" + "'" + TextBox2.Text + "'"; } if (DropDownList3.SelectedIndex == 4) { query2 = "subpoint=" + "'" + TextBox2.Text + "'"; query4 = "subpoint!=" + "'" + TextBox2.Text + "'"; } if (DropDownList3.SelectedIndex == 5) { query2 = "begintime=" + "'" + TextBox2.Text + "'"; query4 = "begintime!=" + "'" + TextBox2.Text + "'"; } if (DropDownList3.SelectedIndex == 6) { query2 = "endtime=" + "'" + TextBox2.Text + "'"; query4 = "endtime!=" + "'" + TextBox2.Text + "'"; } string sql = ""; if (TextBox1.Text == "") { sql = "select * from trade where " + query2; } else if (TextBox2.Text == "") { sql = "select * from trade where " + query1; } else { if (DropDownList2.SelectedIndex == 0) { sql = "select * from trade where " + query1 + " and " + query2; } if (DropDownList2.SelectedIndex == 1) { sql = "select * from trade where " + query1 + " or " + query2; } if (DropDownList2.SelectedIndex == 2) { sql = "select * from trade where " + query3 + " and " + query4; } } DBClass db = new DBClass(sql); DataSet ds = new DataSet(); ds = db.returnSet("trade"); DataView dv = ds.Tables["trade"].DefaultView; DataGrid1.DataSource = dv; DataGrid1.DataBind(); ShowPageStatus(dv.Count); db.dbClose(); }
private void LoadUsers() { DataGrid1.DataSource = dataTable; DataGrid1.DataBind(); }
protected void DataGrid1_OnPageIndexChanged(object source, DataGridPageChangedEventArgs e) { DataGrid1.CurrentPageIndex = e.NewPageIndex; DataGrid1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { var subscribers = Connect(); DataTable table = new DataTable(); table.Columns.Add("Name"); table.Columns.Add("Last Name"); table.Columns.Add("Age"); table.Columns.Add("Email"); table.Columns.Add("Password"); table.Columns.Add("Collegiate Number"); table.Columns.Add("Province where he practice"); table.Columns.Add("Specialty"); foreach (BsonDocument doc in subscribers) { var name = ""; var last_name = ""; var age = ""; var email = ""; var password = ""; var collegiate_number = ""; var province_practice = ""; var specialty = ""; if (doc.Contains("name")) { name += doc.GetValue("name"); } if (doc.Contains("last_name")) { last_name += doc.GetValue("last_name"); } if (doc.Contains("age")) { age += doc.GetValue("age"); } if (doc.Contains("email")) { email += doc.GetValue("email"); } if (doc.Contains("password")) { password += doc.GetValue("password"); } if (doc.Contains("collegiate_number")) { collegiate_number += doc.GetValue("collegiate_number"); } if (doc.Contains("province_practice")) { province_practice += doc.GetValue("province_practice"); } if (doc.Contains("specialty")) { specialty += doc.GetValue("specialty"); } table.Rows.Add(name, last_name, age, email, password, collegiate_number, province_practice, specialty); } DataGrid1.DataSource = table; DataGrid1.DataBind(); foreach (BsonDocument doc in subscribers) { ListBox1.Items.Add((string)doc.GetValue("collegiate_number", null)); } ListBox1.DataBind(); }
public void BindData() { DataGrid1.AllowCustomPaging = false; DataGrid1.DataSource = LoadDataTable(); DataGrid1.DataBind(); }
private void GetTopPerformingTypes() { DataGrid1.DataSource = dh.GetTopPerformingTypes(); DataGrid1.DataBind(); }
//-----------------Load gridview public void _loadGroup() { DataGrid1.DataSource = GroupNewsController.GetAll(); DataGrid1.DataBind(); }
protected void DataGrid_Cancel(Object sender, DataGridCommandEventArgs e) { DataGrid1.EditItemIndex = -1; DataGrid1.DataSource = LoadDataInfo(); DataGrid1.DataBind(); }
private void FilterAdvandedEx_Click(object sender, RoutedEventArgs e) { try { if (System.Windows.MessageBox.Show("Tiến hành lọc Id", "Xác nhận lọc Id", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { Dic = new Dictionary <string, dynamic>(); List <dynamic> listMapEx = new List <dynamic>(); string str = ""; string type = "ex"; List <string> listex = new List <string>(); List <string> listbt = new List <string>(); List <string> listregex = CreatRegex(); str = listregex[0]; strfile = listregex[1]; Regex rx = new Regex(str); listMapEx = classlist.mapNewFile(rx, type, listPath); if ((listMapEx == null || listMapEx.Count == 0)) { System.Windows.MessageBox.Show("Không có câu hỏi nào trắc nghiệm được lọc ra", "Thoát"); } List <string> listLabel = new List <string>(); List <SortId> listsort = new List <SortId>(); Dic = new Dictionary <string, dynamic>(); var listDataGrid = new List <DataGrid1>(); foreach (var item in listMapEx) { string stringId = item["codeId"]; string stringEcer = item["exersice"]; if (listLabel.Contains(stringId)) { Dic[stringId].Add(stringEcer); } else { List <string> listEcer = new List <string>(); listEcer.Add(stringEcer); Dic.Add(stringId, listEcer); listLabel.Add(stringId); SortId sort = new SortId(); sort.ClassId = int.Parse(stringId[0].ToString()); if (stringId[1] == 'D') { sort.ObjectId = 1; } else { sort.ObjectId = 2; } sort.CharterId = int.Parse(stringId[2].ToString()); switch (stringId[3]) { case 'Y': sort.LevelId = 1; break; case 'B': sort.LevelId = 2; break; case 'K': sort.LevelId = 3; break; case 'G': sort.LevelId = 5; break; case 'T': sort.LevelId = 4; break; } sort.SectionId = int.Parse(stringId[4].ToString()); sort.CodeId = stringId; listsort.Add(sort); } } Dic.Add("listid", listsort); Dic.Add("listCodeId", listLabel); foreach (var item in listLabel) { DataGrid1 getDataGrid1 = new DataGrid1(); int classId = Int32.Parse(item[0].ToString()); if (classId > 3) { getDataGrid1.ClassName = "Lớp " + classId; } if (classId <= 3) { getDataGrid1.ClassName = "Lớp 1" + classId; } char strChapterName1 = item[1]; char strChapterName2 = item[2]; if (strChapterName1 == 'H') { getDataGrid1.ChapterName = "Hình chương " + strChapterName2; } if (strChapterName1 == 'D') { getDataGrid1.ChapterName = "Đại chương " + strChapterName2; } char strSectionName = item[4]; getDataGrid1.SectionName = "Bài " + strSectionName; char levelName = item[3]; if (levelName == 'Y') { getDataGrid1.LevelId = "Yếu"; } if (levelName == 'B') { getDataGrid1.LevelId = "Trung bình"; } if (levelName == 'K') { getDataGrid1.LevelId = "Khá"; } if (levelName == 'G') { getDataGrid1.LevelId = "Giỏi"; } getDataGrid1.CodeId = item; getDataGrid1.NumberExersice = Dic[item].Count; getDataGrid1.NumberExersiceSelect = 0; getDataGrid1.IsSelected = false; listDataGrid.Add(getDataGrid1); } DataGridCollectionViewSource source = GridTotal.FindResource("cvsDataGrid") as DataGridCollectionViewSource; source.Source = listDataGrid; } } catch (Exception a) { System.Windows.MessageBox.Show(a.Message, "Thoát"); } }
private void bunifuFlatButton1_Click(object sender, EventArgs e) { DataGrid1.Refresh(); }
public void BindData(int type) { DataGrid1.AllowCustomPaging = false; DataGrid1.BindData(Advertisements.GetAdvertisements(type)); }
private void SaveTopicType_Click(object sender, EventArgs e) { #region 保存主题分类编辑 //下四行取编辑行的更新值 int rowid = 0; bool error = false; foreach (object o in DataGrid1.GetKeyIDArray()) { string id = o.ToString(); string name = DataGrid1.GetControlValue(rowid, "name"); string displayorder = DataGrid1.GetControlValue(rowid, "displayorder"); string description = DataGrid1.GetControlValue(rowid, "description"); //判断主题分类表中是否有与要更新的重名 if (!CheckValue(name, displayorder, description) || TopicTypes.IsExistTopicType(name, int.Parse(id))) { error = true; continue; } //取得主题分类的缓存 Discuz.Common.Generic.SortedList <int, string> topictypearray = new Discuz.Common.Generic.SortedList <int, string>(); topictypearray = Caches.GetTopicTypeArray(); DataTable dt = Forums.GetExistTopicTypeOfForum(); DataTable topicTypes = TopicTypes.GetTopicTypes(); foreach (DataRow dr in dt.Rows) { //用新名更新dnt_forumfields表的topictypes字段 string topictypes = dr["topictypes"].ToString(); if (topictypes.Trim() == "") //如果主题列表为空则不处理 { continue; } string oldTopicType = GetTopicTypeString(topictypes, topictypearray[Int32.Parse(id)].ToString().Trim()); //获取修改名字前的旧主题列表 if (oldTopicType == "") //如果主题列表中不包含当前要修改的主题,则不处理 { continue; } string newTopicType = oldTopicType.Replace("," + topictypearray[Int32.Parse(id)].ToString().Trim() + ",", "," + name + ","); topictypes = topictypes.Replace(oldTopicType + "|", ""); //将旧的主题列表从论坛主题列表中删除 ArrayList topictypesal = new ArrayList(); foreach (string topictype in topictypes.Split('|')) { if (topictype != "") { topictypesal.Add(topictype); } } bool isInsert = false; for (int i = 0; i < topictypesal.Count; i++) { int curDisplayOrder = GetDisplayOrder(topictypesal[i].ToString().Split(',')[1], topicTypes); if (curDisplayOrder > int.Parse(displayorder)) { topictypesal.Insert(i, newTopicType); isInsert = true; break; } } if (!isInsert) { topictypesal.Add(newTopicType); } topictypes = ""; foreach (object t in topictypesal) { topictypes += t.ToString() + "|"; } TopicTypes.UpdateForumTopicType(topictypes, int.Parse(dr["fid"].ToString())); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TopicTypesOption" + dr["fid"].ToString()); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TopicTypesLink" + dr["fid"].ToString()); } //更新主题分类表(dnt_topictypes) TopicTypes.UpdateTopicTypes(name, int.Parse(displayorder), description, int.Parse(id)); rowid++; } //更新缓存 DNTCache cache = DNTCache.GetCacheService(); cache.RemoveObject("/Forum/TopicTypes"); if (error) { base.RegisterStartupScript("", "<script>alert('数据库中已存在相同的主题分类名称或为空,该记录不能被更新!');window.location.href='forum_topictypesgrid.aspx';</script>"); } else { base.RegisterStartupScript("PAGE", "window.location.href='forum_topictypesgrid.aspx';"); } return; #endregion }
protected void Page_Load(object sender, System.EventArgs e) { Chart1.Series["Series1"].IsXValueIndexed = XIndexed.Checked; DataGrid1.DataSource = this.GetSeriesValues(); DataGrid1.DataBind(); }
private void SaveRotatepic_Click(object sender, EventArgs e) { #region 保存轮换图片修改 int rowid = 0; bool error = false; XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNodeList __xmlnodelist = doc.SelectSingleNode(targetNode).ChildNodes; if ((__xmlnodelist != null) && (__xmlnodelist.Count > 0)) { doc.InitializeNode(targetNode); } foreach (object o in DataGrid1.GetKeyIDArray()) { #region 轮换图片 string rotatepicid = DataGrid1.GetControlValue(rowid, "rotatepicid"); //string name = ((TextBox)E.Item.FindControl("rotatepicid")).Text; string img = DataGrid1.GetControlValue(rowid, "img"); string url = DataGrid1.GetControlValue(rowid, "url"); string titlecontent = DataGrid1.GetControlValue(rowid, "titlecontent").Trim(); if (!Utils.IsNumeric(rotatepicid) || !Utils.IsURL(img) || !Utils.IsURL(url) || titlecontent == "") { //base.RegisterStartupScript("", "<script>alert('序号、图片路径或点击链接可能是非法URL或说明文字为空');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>"); //return; error = true; //continue; break;//如果用continue,则导致正确的设置可以被保存,有错误的设置却被删除,即使被修改之前是正确的。会丢失数据 } bool insert = false; XmlElement rotatepicNode = doc.CreateElement(nodeName); doc.AppendChildElementByNameValue(ref rotatepicNode, "rotatepicid", rotatepicid); doc.AppendChildElementByNameValue(ref rotatepicNode, "pagetype", "1"); doc.AppendChildElementByNameValue(ref rotatepicNode, "img", img); doc.AppendChildElementByNameValue(ref rotatepicNode, "url", url); doc.AppendChildElementByNameValue(ref rotatepicNode, "titlecontent", titlecontent); foreach (XmlNode __node in __xmlnodelist) { if (int.Parse(__node["rotatepicid"].InnerText) > int.Parse(rotatepicid)) { doc.SelectSingleNode(targetNode).InsertBefore(rotatepicNode, __node); insert = true; break; } } if (!insert) { doc.SelectSingleNode(targetNode).AppendChild(rotatepicNode); } rowid++; #endregion } AggregationFacade.BaseAggregation.ClearAllDataBind(); if (!error) { SiteUrls.SetInstance(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "聚合页面论坛广告编辑", ""); doc.Save(configPath); base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';"); return; } else { base.RegisterStartupScript("", "<script>alert('某行序号、图片路径或点击链接可能是非法URL或说明文字为空,不能进行更新.');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>"); return; } #endregion }
protected void Page_Load(object sender, EventArgs e) { MultiView1.SetActiveView(View1); DataGrid1.DataSource = db.DataReturn("select enquiry_id as ID, name as HOSPITAL, description as ENQUIRY, reply as REPLY, enquiry_date as DATE from enquiries inner join hospital on enquiries.hospital_id = hospital.hospital_id where enquiries.user_id = " + Session["user_id"].ToString()); DataGrid1.DataBind(); }
private void BindDataGrid1(DataView dt) { DataGrid1.DataSource = dt; DataGrid1.DataBind(); }
public void BindData() { DataGrid1.AllowCustomPaging = false; DataGrid1.BindData(Forum.Announcements.GetAnnouncementList()); }
protected void LoadInitData(string prefInventario, string numInventario) { string sql = String.Format( "SELECT mrol.prinf_codigo AS Rol, \n" + " MNI.mnit_nit AS Nit, \n" + " MNI.mnit_nombres concat ' ' concat COALESCE(MNI.mnit_nombre2,' ') concat ' ' concat MNI.mnit_apellidos concat ' ' concat COALESCE(MNI.mnit_apellido2,' ') AS Nombre \n" + "FROM mrolinventariofisico mrol \n" + " LEFT JOIN mnit MNI ON mrol.mnit_nit = MNI.mnit_nit \n" + "WHERE pdoc_codigo = '{0}' \n" + "AND minf_numeroinf = {1}" , prefInventario , numInventario); DataSet ds = new DataSet(); DataTable dtGerente = new DataTable(); DataTable dtAuditor = new DataTable(); DataTable dtDigitadores = new DataTable(); DataTable dtPatinadores = new DataTable(); DataTable dtCoordinadores = new DataTable(); DataTable dtContadores = new DataTable(); dtGerente.Columns.Add(new DataColumn("Rol", typeof(string))); dtGerente.Columns.Add(new DataColumn("Nit", typeof(string))); dtGerente.Columns.Add(new DataColumn("Nombre", typeof(string))); dtAuditor.Columns.Add(new DataColumn("Rol", typeof(string))); dtAuditor.Columns.Add(new DataColumn("Nit", typeof(string))); dtAuditor.Columns.Add(new DataColumn("Nombre", typeof(string))); dtDigitadores.Columns.Add(new DataColumn("Rol", typeof(string))); dtDigitadores.Columns.Add(new DataColumn("Nit", typeof(string))); dtDigitadores.Columns.Add(new DataColumn("Nombre", typeof(string))); dtPatinadores.Columns.Add(new DataColumn("Rol", typeof(string))); dtPatinadores.Columns.Add(new DataColumn("Nit", typeof(string))); dtPatinadores.Columns.Add(new DataColumn("Nombre", typeof(string))); dtCoordinadores.Columns.Add(new DataColumn("Rol", typeof(string))); dtCoordinadores.Columns.Add(new DataColumn("Nit", typeof(string))); dtCoordinadores.Columns.Add(new DataColumn("Nombre", typeof(string))); dtContadores.Columns.Add(new DataColumn("Rol", typeof(string))); dtContadores.Columns.Add(new DataColumn("Nit", typeof(string))); dtContadores.Columns.Add(new DataColumn("Nombre", typeof(string))); ds = DBFunctions.Request(ds, IncludeSchema.NO, sql); foreach (DataRow dr in ds.Tables[0].Select("ROL=1")) { dtGerente.Rows.Add(dr.ItemArray); } foreach (DataRow dr in ds.Tables[0].Select("ROL=2")) { dtAuditor.Rows.Add(dr.ItemArray); } foreach (DataRow dr in ds.Tables[0].Select("ROL=3")) { dtDigitadores.Rows.Add(dr.ItemArray); } foreach (DataRow dr in ds.Tables[0].Select("ROL=4")) { dtPatinadores.Rows.Add(dr.ItemArray); } foreach (DataRow dr in ds.Tables[0].Select("ROL=5")) { dtCoordinadores.Rows.Add(dr.ItemArray); } foreach (DataRow dr in ds.Tables[0].Select("ROL=6")) { dtContadores.Rows.Add(dr.ItemArray); } if (dtGerente.Rows.Count > 0) { DataRow drGerente = dtGerente.Rows[0]; TextBox1.Text = drGerente["NOMBRE"].ToString(); TextBox1a.Value = drGerente["NIT"].ToString(); } if (dtAuditor.Rows.Count > 0) { DataRow drAuditor = dtAuditor.Rows[0]; TextBox2.Text = drAuditor["NOMBRE"].ToString(); TextBox2a.Value = drAuditor["NIT"].ToString(); } DataGrid1.DataSource = dtDigitadores; DataGrid2.DataSource = dtPatinadores; DataGrid3.DataSource = dtCoordinadores; DataGrid4.DataSource = dtContadores; DataGrid1.Visible = dtDigitadores.Rows.Count > 0; DataGrid2.Visible = dtPatinadores.Rows.Count > 0; DataGrid3.Visible = dtCoordinadores.Rows.Count > 0; DataGrid4.Visible = dtContadores.Rows.Count > 0; DataGrid1.DataBind(); DataGrid2.DataBind(); DataGrid3.DataBind(); DataGrid4.DataBind(); dig.Text = numdig.Text = dtDigitadores.Rows.Count.ToString(); pat.Text = numpat.Text = dtPatinadores.Rows.Count.ToString(); cont.Text = numcont.Text = dtCoordinadores.Rows.Count.ToString(); cor.Text = numcor.Text = dtContadores.Rows.Count.ToString(); }
private void ButtonPromeni_Click(object sender, RoutedEventArgs e) { int indeks = DataGrid1.SelectedIndex; if (DataGrid1.SelectedIndex < 0) { MessageBox.Show("Odaberi osobu"); return; } if (!Validacija()) { return; } Osoba os = DataGrid1.SelectedItem as Osoba; os.Ime = TextBoxIme.Text; os.Prezime = TextBoxPrezime.Text; if (RadioMuski.IsChecked == true) { os.Pol = false; } else { os.Pol = true; } string staraSlika = Putanja.VratiPutanjuSlike(os.Slika); string novaSlika = ""; if (odabranaSlika != "") { //menjamo sliku novaSlika = Putanja.KreirajOdrediste(odabranaSlika); os.Slika = Path.GetFileName(novaSlika); } int rez = OsobaDal.PromeniOsobu(os); if (rez == 0) { if (odabranaSlika != "") { try { //slika promenjena File.Copy(odabranaSlika, novaSlika); //stara slika obrisana File.Delete(staraSlika); } catch (Exception xcp) { MessageBox.Show(xcp.Message); return; } } PrikaziOsobe(); DataGrid1.Focus(); DataGrid1.SelectedIndex = indeks; DataGrid1.ScrollIntoView(DataGrid1.Items[indeks]); odabranaSlika = ""; MessageBox.Show("Podaci promenjeni"); } else { MessageBox.Show("Greska pri promeni podataka"); } }
protected void Cargar_Tabla_Rtns(object sender, EventArgs e) { if (numdig.Text != "" && Convert.ToInt32(dig.Text) != Convert.ToInt32(numdig.Text)) { dig.Text = numdig.Text; dig.Visible = true; dt = new DataTable(); dt.Columns.Add(new DataColumn("Nombre", typeof(string))); dt.Columns.Add(new DataColumn("Nit", typeof(string))); for (int i = 0; i < Convert.ToInt32(numdig.Text); i++) { DataRow fila = dt.NewRow(); dt.Rows.Add(fila); } DataGrid1.DataSource = dt; DataGrid1.DataBind(); DataGrid1.Visible = true; } if (numpat.Text != "" && Convert.ToInt32(pat.Text) != Convert.ToInt32(numpat.Text)) { pat.Text = numpat.Text; pat.Visible = true; numeropat = Convert.ToInt32(numpat.Text); dt = new DataTable(); dt.Columns.Add(new DataColumn("Nombre", typeof(string))); dt.Columns.Add(new DataColumn("Nit", typeof(string))); for (int i = 0; i < Convert.ToInt32(numpat.Text); i++) { DataRow fila = dt.NewRow(); dt.Rows.Add(fila); } DataGrid2.DataSource = dt; DataGrid2.DataBind(); DataGrid2.Visible = true; } if (numcont.Text != "" && Convert.ToInt32(cont.Text) != Convert.ToInt32(numcont.Text)) { cont.Text = numcont.Text; cont.Visible = true; numerocont = Convert.ToInt32(numcont.Text); dt = new DataTable(); dt.Columns.Add(new DataColumn("Nombre", typeof(string))); dt.Columns.Add(new DataColumn("Nit", typeof(string))); for (int i = 0; i < Convert.ToInt32(numcont.Text); i++) { DataRow fila = dt.NewRow(); dt.Rows.Add(fila); } DataGrid3.DataSource = dt; DataGrid3.DataBind(); DataGrid3.Visible = true; } if (numcor.Text != "" && Convert.ToInt32(cor.Text) != Convert.ToInt32(numcor.Text)) { cor.Text = numcor.Text; cor.Visible = true; numerocor = Convert.ToInt32(numcor.Text); dt = new DataTable(); dt.Columns.Add(new DataColumn("Nombre", typeof(string))); dt.Columns.Add(new DataColumn("Nit", typeof(string))); for (int i = 0; i < Convert.ToInt32(numcor.Text); i++) { DataRow fila = dt.NewRow(); dt.Rows.Add(fila); } DataGrid4.DataSource = dt; DataGrid4.DataBind(); DataGrid4.Visible = true; } }
protected void DataGrid_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { DataGrid1.LoadCurrentPageIndex(e.NewPageIndex); }
protected void Button1_Click(object sender, EventArgs e) { string ConnectionString; SqlConnection MyCon; ConnectionString = "server=WSLKCMP5F-582;user id=sa;password=slk@SOFT;database=Adventure Works"; MyCon = new SqlConnection(ConnectionString); MyCon.Open(); try { String val = TextBox1.Text; if (TextBox1.Text != "") { if ((int)Session["Role1"] != 20001) { if (DropDownList1.SelectedValue == "EmpId" || DropDownList1.SelectedValue == "EmpName") { string Query = "select EmpId,EmpName,convert(Varchar(10),DOB) as Date_of_Birth,Gender,ContactNo,EmailId,Department,Designation from Tbl_Employee where (EmpId like'" + val + "' or EmpName like'" + val + "') and DeleteFlag='N'"; SqlDataAdapter sde = new SqlDataAdapter(Query, MyCon); DataSet ds = new DataSet(); sde.Fill(ds); if (ds.Tables[0].Rows.Count != 0) { DataGrid1.DataSource = ds; DataGrid1.DataBind(); lblMsg.Text = ""; } else { lblMsg.Text = "No record found"; } } } else if ((int)Session["Role1"] == 20001) { if (DropDownList1.SelectedValue == "EmpId" || DropDownList1.SelectedValue == "EmpName") { string Query = "select EmpId,EmpName,convert(Varchar(10),DOB)as Date_Of_Birth,Gender,ContactNo,EmailId,convert(Varchar(10),DOJ) as Date_Of_Joining,Department,Designation,Salary,Password1,RoleId,DeleteFlag from Tbl_Employee where EmpId ='" + val + "' or EmpName ='" + val + "'"; SqlDataAdapter sde = new SqlDataAdapter(Query, MyCon); DataSet ds = new DataSet(); sde.Fill(ds); if (ds.Tables[0].Rows.Count != 0) { DataGrid1.DataSource = ds; DataGrid1.DataBind(); lblMsg.Text = ""; } else { lblMsg.Text = "No record found"; } } } } else { lblMsg.Text = "Enter a valid Employee Id or Employee name"; } } catch (Exception ee) { lblMsg.Text = "the error is" + ee.Message; } //finally { } MyCon.Close(); }
public void Display() { DataGrid1.DataSource = mb.film2.ToList(); DataGrid1.DataBind(); // Label1.Text = mb.film2.Find(2).titre; }
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e) { DataGrid1.CurrentPageIndex = e.NewPageIndex; DataGrid1.DataBind(); }
public void PageChanger(object sender, DataGridPageChangedEventArgs e) { DataGrid1.CurrentPageIndex = e.NewPageIndex; DataGrid1.DataSource = CreateSource("select * from trade", "trade"); DataGrid1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { MultiView1.SetActiveView(View1); DataGrid1.DataSource = db.DataReturn("select enquiry_id as ID, (first_name +' '+last_name) as NAME, description as ENQUIRY, reply as REPLY, enquiry_date as DATE from enquiries inner join users on users.user_id = enquiries.user_id where enquiries.reply='Pending' and enquiries.hospital_id = " + Session["hospital_id"].ToString()); DataGrid1.DataBind(); }
private void InitializeComponent() { this.DataGrid1.ItemDataBound += new DataGridItemEventHandler(this.DataGrid_ItemDataBound); DataGrid1.LoadEditColumn(); }
private void btnChart_Click(object sender, EventArgs e) { btnTable_Click(sender, e); DataGrid1.Sort(DataGrid1.Columns[0], ListSortDirection.Ascending); chart1.Series.Clear(); chart1.BringToFront(); int x, y; string type; if (chartType == "Bar") { if (displayMode == "Separate") { chart1.Series.Add("Maintenance"); chart1.Series.Add("Inventory"); chart1.Series.Add("Employee"); chart1.Series.Add("Bills"); chart1.Series.Add("Loans"); chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column; chart1.Series[1].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column; chart1.Series[2].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column; chart1.Series[3].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column; chart1.Series[4].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column; chart1.Series[0].IsValueShownAsLabel = true; chart1.Series[1].IsValueShownAsLabel = true; chart1.Series[2].IsValueShownAsLabel = true; chart1.Series[3].IsValueShownAsLabel = true; chart1.Series[4].IsValueShownAsLabel = true; foreach (DataGridViewRow DGVR in DataGrid1.Rows) { x = int.Parse(DGVR.Cells[0].Value.ToString()); y = int.Parse(DGVR.Cells[2].Value.ToString()); type = DGVR.Cells[1].Value.ToString(); chart1.Series[type].Points.AddXY(x, y); } } else { chart1.Series.Add("Expenses"); chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column; chart1.Series[0].IsValueShownAsLabel = true; foreach (DataGridViewRow DGVR in DataGrid1.Rows) { x = int.Parse(DGVR.Cells[0].Value.ToString()); y = int.Parse(DGVR.Cells[1].Value.ToString()); chart1.Series["Expenses"].Points.AddXY(x, y); } } } else if (chartType == "Line") { if (displayMode == "Separate") { chart1.Series.Add("Maintenance"); chart1.Series.Add("Inventory"); chart1.Series.Add("Employee"); chart1.Series.Add("Bills"); chart1.Series.Add("Loans"); chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart1.Series[1].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart1.Series[2].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart1.Series[3].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart1.Series[4].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart1.Series[0].IsValueShownAsLabel = true; chart1.Series[1].IsValueShownAsLabel = true; chart1.Series[2].IsValueShownAsLabel = true; chart1.Series[3].IsValueShownAsLabel = true; chart1.Series[4].IsValueShownAsLabel = true; foreach (DataGridViewRow DGVR in DataGrid1.Rows) { x = int.Parse(DGVR.Cells[0].Value.ToString()); y = int.Parse(DGVR.Cells[2].Value.ToString()); type = DGVR.Cells[1].Value.ToString(); chart1.Series[type].Points.AddXY(x, y); } } else { chart1.Series.Add("Expenses"); chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart1.Series[0].IsValueShownAsLabel = true; foreach (DataGridViewRow DGVR in DataGrid1.Rows) { x = int.Parse(DGVR.Cells[0].Value.ToString()); y = int.Parse(DGVR.Cells[1].Value.ToString()); chart1.Series["Expenses"].Points.AddXY(x, y); } } } else { if (displayMode == "Separate") // Cannot display data in a pie chart { } else { chart1.Series.Add("Expenses"); chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Pie; chart1.Series[0].IsValueShownAsLabel = true; foreach (DataGridViewRow DGVR in DataGrid1.Rows) { x = int.Parse(DGVR.Cells[0].Value.ToString()); y = int.Parse(DGVR.Cells[1].Value.ToString()); //type = DGVR.Cells[1].Value.ToString(); chart1.Series["Expenses"].Points.AddXY(x, y); } } } }