protected void gridMain_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { int recSkip = gridMain.CurrentPageIndex * gridMain.PageSize; int recTake = gridMain.PageSize; string recFilter = gridMain.MasterTableView.FilterExpression; GridSortExpressionCollection gridSortExxpressions = gridMain.MasterTableView.SortExpressions; try { DistancesController cont = new DistancesController(); gridMain.VirtualItemCount = cont.CountDistances(recFilter); gridMain.DataSource = cont.GetDistances(recSkip, recTake, recFilter, gridSortExxpressions); } catch (Exception) { } }
protected void gridMain_ItemDataBound(object sender, GridItemEventArgs e) { /* * if (e.Item.OwnerTableView.Name == "Master") { * if (e.Item is GridDataItem) { * GridDataItem item = (GridDataItem)e.Item; * if (item.OwnerTableView.DataSource != null) { * TaskB curTask = (item.OwnerTableView.DataSource as List<TaskB>)[item.DataSetIndex]; * TableCell curCell = item["RegNo"]; * string curComments = curTask.Comments; * string curTooltip = "<span><span class=\"tooltip tooltip-effect-4\"><span class=\"tooltip-item\">"; * curTooltip += curCell.Text; * curTooltip += "</span><span class=\"tooltip-content clearfix\"><span class=\"tooltip-text\"><strong>Παρατηρήσεις:</strong><br/>"; * curTooltip += curComments; * curTooltip += "</span></span></span></span>"; * if (!string.IsNullOrWhiteSpace(curComments)) { curCell.Text = curTooltip; } * System.Drawing.Color hColor = System.Drawing.Color.FromArgb(0, 0, 0); * if (curTask.IsLocked == true) { hColor = System.Drawing.Color.FromArgb(200, 0, 0); } * item["ID"].ForeColor = hColor; * item["RegNo"].ForeColor = hColor; * item["OrderDate"].ForeColor = hColor; * item["CustomerID"].ForeColor = hColor; * item["JobsID"].ForeColor = hColor; * item["DateTimeStartActual"].ForeColor = hColor; * if (curTask.IsLocked == true && loggedUser.UserGroupID != 1) { * item["EditCommandColumn"].Controls[0].Visible = false; * item["btnDelete"].Controls[0].Visible = false; * item["ExapandColumn"].Controls[0].Visible = false; * } * } * } * } */ if (e.Item.OwnerTableView.Name == "Master") { if (e.Item is GridFilteringItem) { GridFilteringItem filterItem = (GridFilteringItem)e.Item; RadDropDownList clist = (RadDropDownList)filterItem.FindControl("ddlCustomersFilter"); RadDropDownList jlist = (RadDropDownList)filterItem.FindControl("ddlJobsFilter"); RadDropDownList plist = (RadDropDownList)filterItem.FindControl("ddlPositionsFilter"); try { CustomersController ccont = new CustomersController(); clist.DataSource = ccont.GetCustomers(); clist.DataTextField = "NameGR"; clist.DataValueField = "ID"; clist.DataBind(); clist.Items.Insert(0, new DropDownListItem("Κανένα Φίλτρο", "0")); JobsController jcont = new JobsController(); jlist.DataSource = jcont.GetJobs(); jlist.DataTextField = "Name"; jlist.DataValueField = "ID"; jlist.DataBind(); jlist.Items.Insert(0, new DropDownListItem("Κανένα Φίλτρο", "0")); DistancesController dcont = new DistancesController(); plist.DataSource = dcont.GetDistances(); plist.DataTextField = "Description"; plist.DataValueField = "ID"; plist.DataBind(); plist.Items.Insert(0, new DropDownListItem("Κανένα Φίλτρο", "0")); } catch (Exception) { } } if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; ImageButton editButton = item["EditCommandColumn"].Controls[0] as ImageButton; editButton.ImageUrl = "~/Images/mag.png"; } } }