/// <summary> /// Executed only once. Used to place cursor in first editable field. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DetailsView_OnDataBound(object sender, EventArgs e) { DetailsViewRow row = DetailsViewCustomer.Rows[1]; TextBox textBox = row.Cells[1].Controls[0] as TextBox; textBox.Focus(); }
protected void friendDetailsGrid_ItemCreated(object sender, EventArgs e) { // Test FooterRow to make sure all rows have been created if (friendDetailsGrid.FooterRow != null && friendDetailsGrid.Rows.Count > 0) { // The command bar is the last element in the Rows collection int commandRowIndex = friendDetailsGrid.Rows.Count - 1; DetailsViewRow commandRow = friendDetailsGrid.Rows[commandRowIndex]; // Look for the DELETE button DataControlFieldCell cell = (DataControlFieldCell)commandRow.Controls[0]; foreach (Control ctl in cell.Controls) { Button button = ctl as Button; if (button != null) { if (button.CommandName == "Delete") { button.ToolTip = "Click here to delete this record"; button.OnClientClick = "if (!confirm('Do you want to delete this record?')) return false;"; } } } } }
DropDownList GetDDL(string DataField) { int FieldsIndex = -1; for (int i = 0; i < mfDataCollector.Fields.Count; i++) { object f = mfDataCollector.Fields[i]; Type t = f.GetType(); System.Reflection.PropertyInfo pi = t.GetProperty("DataField"); if (pi == null) { continue; } string df = pi.GetValue(f, null).ToString(); if (df == DataField) { FieldsIndex = i; break; } } if (FieldsIndex < 0) { return(null); } DetailsViewRow r = mfDataCollector.Controls[0].Controls[FieldsIndex + 1] as DetailsViewRow; DropDownList ddl = r.Cells[1].Controls[1] as DropDownList; return(ddl); }
protected void dvContratos_ItemCreated(object sender, EventArgs e) { if (!(dvContratos.HeaderRow == null)) { int commandRowIndex = 0; if ((dvContratos.Rows.Count - 1) != -1) { DetailsViewRow commandRow = dvContratos.Rows[commandRowIndex]; DataControlFieldCell cell = (DataControlFieldCell)commandRow.Controls[0]; foreach (Control ctl in cell.Controls) { if (ctl.GetType().Name == "DataControlImageButton") { ImageButton btn = (ImageButton)ctl; if (btn.CommandName == "Delete") { btn.OnClientClick = "if(!confirm('Realmente desea eliminar el Contrato seleccionado')){return false;}"; } } } } } }
void CustomerDetailsView_ItemCommand(Object sender, DetailsViewCommandEventArgs e) { // Use the CommandName property to determine which button // was clicked. if (e.CommandName == "Add") { // Get the DetailsView control that raised the event. DetailsView customerDetailsView = (DetailsView)sender; // Add the current customer to the customer list. // Get the row that contains the company name. In this // example, the company name is in the second row (index 1) // of the DetailsView control. DetailsViewRow row = customerDetailsView.Rows[1]; // Get the company's name from the appropriate cell. // In this example, the company name is in the second cell // (index 1) of the row. String name = row.Cells[1].Text; // Create a ListItem object with the company name. ListItem item = new ListItem(name); // Add the ListItem object to the ListBox, if the // item doesn't already exist. if (!CustomerListBox.Items.Contains(item)) { CustomerListBox.Items.Add(item); } } }
// this initializes all fields when you add a new learner protected void dvLearner_ItemInit(object sender, ImageClickEventArgs e) { panTop.Visible = false; panBot.Visible = true; labError.Text = ""; dvLearner.ChangeMode(DetailsViewMode.Insert); dvLearner.DataBind(); if (dvLearner.FindControl("membId") != null) { ((TextBox)dvLearner.FindControl("membId")).Text = ""; if (se.usesPassword) //se.usesPassword set on SignIn, typically a Profile entry { ((TextBox)dvLearner.FindControl("membPwd")).Text = ""; } else { DetailsViewRow row = dvLearner.Rows[1]; row.Visible = false; } ((TextBox)dvLearner.FindControl("membFirstName")).Text = ""; ((TextBox)dvLearner.FindControl("membLastName")).Text = ""; ((TextBox)dvLearner.FindControl("membEmail")).Text = ""; ((TextBox)dvLearner.FindControl("membOrganization")).Text = ""; ((TextBox)dvLearner.FindControl("membMemo")).Text = ""; DropDownList ctrMembLevel = (DropDownList)dvLearner.FindControl("membLevel"); ctrMembLevel.Items.FindByValue("1").Enabled = false; ctrMembLevel.Items.FindByValue("2").Enabled = true; ctrMembLevel.Items.FindByValue("5").Enabled = false; // disable levels unless beneath your membLevel int seMembLevel = int.Parse(Session["membLevel"].ToString()); if (seMembLevel == 3) { ctrMembLevel.Items.FindByValue("3").Enabled = false; ctrMembLevel.Items.FindByValue("4").Enabled = false; } if (seMembLevel == 4) { ctrMembLevel.Items.FindByValue("3").Enabled = true; ctrMembLevel.Items.FindByValue("4").Enabled = false; } if (seMembLevel == 5) { ctrMembLevel.Items.FindByValue("3").Enabled = true; ctrMembLevel.Items.FindByValue("4").Enabled = true; } Label labMembLevel = (Label)dvLearner.FindControl("labMembLevel"); labMembLevel.Text = ""; // only used for read HiddenField hidMembLevel = (HiddenField)dvLearner.FindControl("hidMembLevel"); hidMembLevel.Value = "2"; managerAccessHide(se.usesPassword); // Hide until membLevel set to 4 or 5 ((CheckBox)dvLearner.FindControl("membActive")).Checked = true; ((CheckBox)dvLearner.FindControl("membEmailAlert")).Checked = true; } }
public static void AddRequiredFieldValidator(DetailsView view, int rowIndex) { DetailsViewRow row = view.Rows[rowIndex]; DataControlFieldCell cell = row.Cells[1] as DataControlFieldCell; string ctlID = ""; foreach (Control c in cell.Controls) { if (c is TextBox) { int pos = c.UniqueID.LastIndexOf("$"); ctlID = c.UniqueID.Substring((pos + 1)); break; } } RequiredFieldValidator Reg = new RequiredFieldValidator(); Reg.Text = String.Format("{0}", "*"); Reg.Display = System.Web.UI.WebControls.ValidatorDisplay.Dynamic; if (ctlID != string.Empty) { Reg.ControlToValidate = ctlID; cell.Controls.Add(Reg); } }
protected void vDataset_ItemCreated(object sender, EventArgs e) { // Test FooterRow to make sure all rows have been created DetailsView dv = (DetailsView)sender; if (dv.FooterRow != null) { // The command bar is the last element in the Rows collection int commandRowIndex = dv.Rows.Count - 1; if (commandRowIndex > 0) { DetailsViewRow commandRow = dv.Rows[commandRowIndex]; // Look for the DELETE button DataControlFieldCell cell = (DataControlFieldCell)commandRow.Controls[0]; foreach (Control ctl in cell.Controls) { ImageButton del = ctl as ImageButton; if (del != null) { if (del.CommandName == "Delete") { del.OnClientClick = "if (!confirm('Er du sikker på at du vil slette denne posten?')) return;"; } } } } } }
protected void dvSystemData_ItemCommand(object sender, DetailsViewCommandEventArgs e) { if (e.CommandName.Equals("Update")) { DetailsViewRow _EdittedRow = dvSystemData.Rows[dvSystemData.DataItemIndex]; CheckBox _DoReoccuringOrdersCheckBox = (CheckBox)_EdittedRow.FindControl("DoReoccuringOrdersCheckBox"); TextBox _LastReoccurringDateTextBox = (TextBox)_EdittedRow.FindControl("LastReoccurringDateTextBox"); TextBox _DateLastPrepDateCalcdTextBox = (TextBox)_EdittedRow.FindControl("DateLastPrepDateCalcdTextBox"); TextBox _MinReminderDateTextBox = (TextBox)_EdittedRow.FindControl("MinReminderDateTextBox"); TextBox _GroupItemTypeIDTextBox = (TextBox)_EdittedRow.FindControl("GroupItemTypeIDTextBox"); Label _IDLabel = (Label)_EdittedRow.FindControl("IDLabel"); control.SysDataTbl _SysData = new control.SysDataTbl(); _SysData.ID = Convert.ToInt32(_IDLabel.Text); _SysData.DoReoccuringOrders = _DoReoccuringOrdersCheckBox.Checked; _SysData.LastReoccurringDate = Convert.ToDateTime(_LastReoccurringDateTextBox.Text); _SysData.DateLastPrepDateCalcd = Convert.ToDateTime(_DateLastPrepDateCalcdTextBox.Text); _SysData.MinReminderDate = Convert.ToDateTime(_MinReminderDateTextBox.Text); _SysData.GroupItemTypeID = Convert.ToInt32(_GroupItemTypeIDTextBox.Text); _SysData.Update(_SysData); dvSystemData.DataBind(); } }
public void DataBindTemplate(object sender, EventArgs e) { Literal templatePlaceHolder = sender as Literal; DetailsViewRow row = templatePlaceHolder.Parent.Parent as DetailsViewRow; SuperForm form = row.Parent.Parent as SuperForm; templatePlaceHolder.Text = DataBinder.Eval(form.DataItem, "Notes").ToString(); }
protected void PollDatabound(object sender, EventArgs e) { DetailsView view = (DetailsView)sender; int pollid = Convert.ToInt32(Request.QueryString["pid"]); DetailsViewRowCollection rows = view.Rows; DetailsViewRow row = rows[2]; ((CheckBox)row.Cells[1].Controls[1].Controls[0].Controls[1]).Checked = (pollid == Config.ActivePoll); }
public void DataBindTemplate(object sender, EventArgs e) { Literal templatePlaceHolder = sender as Literal; DetailsViewRow row = templatePlaceHolder.Parent.Parent as DetailsViewRow; SuperForm form = row.Parent.Parent as SuperForm; string value = DataBinder.Eval(form.DataItem, "Sent").ToString(); templatePlaceHolder.Text = value == "True" ? "Yes" : "No"; }
public void DataBindTemplate(object sender, EventArgs e) { PlaceHolder templatePlaceHolder = sender as PlaceHolder; DetailsViewRow row = templatePlaceHolder.Parent.Parent as DetailsViewRow; SuperForm form = row.Parent.Parent as SuperForm; Obout.ComboBox.ComboBox comboBox = templatePlaceHolder.Controls[0] as Obout.ComboBox.ComboBox; comboBox.SelectedValue = DataBinder.Eval(form.DataItem, "ShipCountry").ToString(); }
public void DataBindTemplate(object sender, EventArgs e) { PlaceHolder templatePlaceHolder = sender as PlaceHolder; DetailsViewRow row = templatePlaceHolder.Parent.Parent as DetailsViewRow; SuperForm form = row.Parent.Parent as SuperForm; Obout.Ajax.UI.HTMLEditor.Editor editor1 = templatePlaceHolder.Controls[0] as Obout.Ajax.UI.HTMLEditor.Editor; if (form.DataItem != null) { editor1.Content = DataBinder.Eval(form.DataItem, "AdditionalInformationHTML").ToString(); } }
public void DataBindTemplate(object sender, EventArgs e) { PlaceHolder templatePlaceHolder = sender as PlaceHolder; DetailsViewRow row = templatePlaceHolder.Parent.Parent as DetailsViewRow; SuperForm form = row.Parent.Parent as SuperForm; Image img = templatePlaceHolder.Controls[0] as Image; img.ImageUrl = "~/Grid/resources/images/products/" + DataBinder.Eval(form.DataItem, "Image").ToString(); img.AlternateText = ""; img.Width = 100; }
protected void vDataset_PreRender(object sender, EventArgs e) { DetailsView dw = (DetailsView)sender; if (dw != null) { DetailsViewRow pagerRow = dw.BottomPagerRow; if (pagerRow != null) { pagerRow.Visible = true; } } }
protected void DetailsView1_ItemCreated(object sender, System.EventArgs e) { int commandRowIndex = DetailsView1.Rows.Count - 1; if (commandRowIndex != -1) { DetailsViewRow row = DetailsView1.Rows[commandRowIndex]; var btnDelete = row.Controls[0].Controls.OfType<LinkButton>().FirstOrDefault(b => b.CommandName == "Delete"); if (btnDelete != null) { btnDelete.Attributes["onclick"] = "return confirm('Do you want to delete this User?')"; } } }
/// <summary> /// Saves data for new or edited customer to database. /// </summary> protected void ButtonSave_Click(object sender, EventArgs e) { CustomerController controller = new CustomerController(); ActionServiceReference.Customer customer; if (CustomerId == 0) { customer = new ActionServiceReference.Customer(); } else { customer = controller.GetCustomer(CustomerId); } // Get Company name from page. DetailsViewRow row = DetailsViewCustomer.Rows[1]; TextBox textBox = row.Cells[1].Controls[0] as TextBox; customer.Company = textBox.Text.Trim(); // Get City from page. row = DetailsViewCustomer.Rows[2]; textBox = row.Cells[1].Controls[0] as TextBox; customer.City = textBox.Text.Trim(); // Get Country from page. row = DetailsViewCustomer.Rows[3]; textBox = row.Cells[1].Controls[0] as TextBox; customer.Country = textBox.Text.Trim(); try { if (CustomerId == 0) { controller.AddCustomer(customer); } else { controller.UpdateCustomer(customer); } } catch (ApplicationException ex) { LabelError.Text = ex.Message.Replace(Environment.NewLine, "<br />"); LabelError.Visible = true; return; } // Return to list of customers. Response.Redirect("Customers.aspx"); }
protected override void OnItemCreated(EventArgs e) { // Test FooterRow to make sure all rows have been created if (this.FooterRow != null) { // The command bar is the last element in the Rows collection int commandRowIndex = this.Rows.Count - 1; if (commandRowIndex > 0) { DetailsViewRow commandRow = this.Rows[commandRowIndex]; DataControlFieldCell cell = (DataControlFieldCell)commandRow.Controls[0]; foreach (Control ctl in cell.Controls) { LinkButton link = ctl as LinkButton; if (link != null) { switch (link.CommandName) { case "Cancel": link.ToolTip = EDS.Intranet.ServerControls.Properties.Resources.CancelToolTip; break; case "Delete": string confirmMessage = EDS.Intranet.ServerControls.Properties.Resources.DeleteConfirmMessage; link.ToolTip = EDS.Intranet.ServerControls.Properties.Resources.DeleteToolTip; link.OnClientClick = "return confirm('" + confirmMessage + "');"; break; case "Edit": link.ToolTip = EDS.Intranet.ServerControls.Properties.Resources.EditToolTip; break; case "Insert": link.ToolTip = EDS.Intranet.ServerControls.Properties.Resources.InsertToolTip; break; case "New": link.ToolTip = EDS.Intranet.ServerControls.Properties.Resources.NewToolTip; break; case "Update": link.ToolTip = EDS.Intranet.ServerControls.Properties.Resources.UpdateToolTip; break; } } } } } }
protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e) { /*if (e.CommandName == "AddToCart") * { * * string url = "cart.aspx?"; * * DetailsViewRow row = DetailsView1.Rows[0]; * string product_id = row.Cells[1].Text; * * url += "product_id=" + product_id; * url += "&qty=" + txt_qty.Text; * * Response.Redirect(url); * }*/ if (e.CommandName == "AddToCart") { DetailsViewRow row = DetailsView1.Rows[0]; string product_id = row.Cells[1].Text; ArrayList prods = new ArrayList(); ArrayList qtys = new ArrayList(); //prods = (ArrayList)Session["cartprod"]; //qtys = (ArrayList)Session["cartqty"]; prods = Session["cartprod"] == null ? prods : (ArrayList)Session["cartprod"]; qtys = Session["cartqty"] == null ? qtys : (ArrayList)Session["cartqty"]; prods.Add(product_id); qtys.Add(txt_qty.Text); Session["cartprod"] = prods; Session["cartqty"] = qtys; Response.Redirect("cart.aspx"); } //for the delete button to work else if (e.CommandName == "SubmitReview") { string url = "review.aspx?"; DetailsViewRow row = DetailsView1.Rows[0]; string product_id = row.Cells[1].Text; url += "product_id=" + product_id; Response.Redirect(url); } }
public void DataBindTemplate(object sender, EventArgs e) { PlaceHolder templatePlaceHolder = sender as PlaceHolder; DetailsViewRow row = templatePlaceHolder.Parent.Parent as DetailsViewRow; SuperForm form = row.Parent.Parent as SuperForm; OboutRadioButton OboutRadioButton1 = templatePlaceHolder.Controls[0] as OboutRadioButton; OboutRadioButton OboutRadioButton2 = templatePlaceHolder.Controls[1] as OboutRadioButton; object value = DataBinder.Eval(form.DataItem, "Sent"); OboutRadioButton1.Checked = value != null && value.ToString() == "True"; OboutRadioButton2.Checked = value == null || value.ToString() == "False"; }
protected void UserInfo_DataBound(object sender, EventArgs e) { ProfileCommon userProfile = Profile.GetProfile(username); if (UserInfo.CurrentMode == DetailsViewMode.ReadOnly) { Label lbl = (Label)UserInfo.FindControl("lbAgency"); Label lblEmployee = (Label)UserInfo.FindControl("lblLocation"); lbl.Text = ReturnDepartment(userProfile.DistrictID); lblEmployee.Text = ReturnProvince(userProfile.ProvinceID); } if (UserInfo.CurrentMode == DetailsViewMode.Edit) { DropDownList ddlAg = (DropDownList)UserInfo.FindControl("DDLAgency"); DropDownList ddlEmp = (DropDownList)UserInfo.FindControl("ddlLocation"); if (!string.IsNullOrEmpty(userProfile.DistrictID.ToString())) { ddlAg.SelectedValue = userProfile.DistrictID.ToString(); } if (!string.IsNullOrEmpty(userProfile.ProvinceID.ToString())) { // BindCombo("select ID,Name from staff union select null,'--Select--' order by ID", ddlEmp); ddlEmp.SelectedValue = userProfile.ProvinceID.ToString(); } } int commandRowIndex = UserInfo.Rows.Count - 1; if (commandRowIndex > 0) { DetailsViewRow commandRow = UserInfo.Rows[commandRowIndex]; DataControlFieldCell cell = (DataControlFieldCell)commandRow.Controls[0]; foreach (Control ctrl in cell.Controls) { if (ctrl is Button) { Button ibt = (Button)ctrl; if (ibt.CommandName == "Delete") { ibt.ToolTip = "Click here to Delete"; //ibt.CommandName = "Delete"; ibt.Attributes["onClick"] = "if (!confirm('آیا شما میخواهید این کاربر را حذف نماید؟')) return;"; } } } } }
protected void PricingDetailsView_ItemCreated(object sender, EventArgs e) { // As each button in the command field is created, it detects if the button is the delete button. // If it is, an attribute is added to make a javascript prompt display to confirm the action when pressed. int commandRowIndex = PricingDetailsView.Rows.Count - 1; if (commandRowIndex != -1) { DetailsViewRow row = PricingDetailsView.Rows[commandRowIndex]; if (row.Controls[0].Controls.OfType <Button>().Where(b => b.CommandName == "Delete").Count() > 0) { Button btnDelete = row.Controls[0].Controls.OfType <Button>().Where(b => b.CommandName == "Delete").FirstOrDefault(); btnDelete.Attributes["onclick"] = "if(!confirm('Do you want to delete this Pricing?')){ return false; };"; } } PricingGridView.DataBind(); }
protected void LinkButton1_Click(object sender, EventArgs e) { DetailsViewRow dr = DetailsView1.Rows[0]; HiddenField hf = dr.FindControl("HiddenField1") as HiddenField; DataTable dt = con.getOwnerDetail(hf.Value, Request.QueryString["Id"].ToString()); (DetailsView1.Rows[0].FindControl("Label11") as Label).Text = "Name : " + dt.Rows[0][1].ToString(); (DetailsView1.Rows[0].FindControl("Label12") as Label).Text = "Phone Number : " + dt.Rows[0][2].ToString(); (DetailsView1.Rows[0].FindControl("Label13") as Label).Text = "Email ID : " + dt.Rows[0][3].ToString(); int propertyCount = con.getOwnerPropertyCount(dt.Rows[0][0].ToString()); if (propertyCount > 1) { (DetailsView1.Rows[0].FindControl("Label11") as Label).ForeColor = System.Drawing.Color.Red; (DetailsView1.Rows[0].FindControl("Label12") as Label).ForeColor = System.Drawing.Color.Red; (DetailsView1.Rows[0].FindControl("Label13") as Label).ForeColor = System.Drawing.Color.Red; } }
public void DetailsViewRowCollection_CopyTo() { DetailsViewRow[] rows = new DetailsViewRow[6]; ArrayList myRows = new ArrayList(); myRows.Add(new DetailsViewRow(0, DataControlRowType.DataRow, DataControlRowState.Insert)); myRows.Add(new DetailsViewRow(1, DataControlRowType.Footer, DataControlRowState.Edit)); myRows.Add(new DetailsViewRow(2, DataControlRowType.Header, DataControlRowState.Normal)); DetailsViewRowCollection coll = new DetailsViewRowCollection(myRows); coll.CopyTo(rows, 0); Assert.AreEqual(6, rows.Length, "CopyTo1"); Assert.AreEqual(0, rows[0].RowIndex, "CopyTo2"); Assert.AreEqual(DataControlRowType.Footer, rows[1].RowType, "CopyTo3"); Assert.AreEqual(DataControlRowState.Normal, rows[2].RowState, "CopyTo4"); Assert.AreEqual(2, rows[2].RowIndex, "CopyTo5"); Assert.AreEqual(null, rows[3], "CopyTo6"); }
}//DataPage() /// <summary>ButtonSubmitDetailsView_Click().</summary> public void ButtonSubmitDetailsView_Click ( Object sender, EventArgs e ) { String fieldName = null; String fieldValue = null; DetailsViewRow detailsViewContactCurrent = null; LiteralFeedback.Text = ""; foreach (DetailsViewRow detailsViewRow in DetailsViewContact.Rows) { // Use the Text property to access the value of // each cell. In this example, the cells in the // first column (index 0) contains the field names, // while the cells in the second column (index 1) // contains the field value. // LiteralFeedback.Text += row.Cells[0].Text + " = " + row.Cells[1].Text + "<br/>"; fieldName = detailsViewRow.Cells[0].Text; if ( fieldName == null ) { fieldName = ""; } fieldValue = detailsViewRow.Cells[1].Text; if ( fieldValue == null ) { fieldValue = ""; } //LiteralFeedback.Text += fieldName + ": " + fieldValue + " | "; if ( fieldName == "ScriptureReference" ) { break; } }//foreach (DetailsViewRow row in ItemDetailsView.Rows) }//public void ButtonSubmitDetailsView_Click()
protected void dvEmployee_DataBound(object sender, EventArgs e) { DataRowView drView = (DataRowView)dvEmployee.DataItem; //將英文國家名稱轉換成中文名稱 switch (drView["Country"].ToString().ToUpper()) { case "USA": drView["Country"] = "美國"; break; case "UK": drView["Country"] = "英國"; break; case "TAIWAN": drView["Country"] = "台灣"; break; } //上面將Country由英文替換成中文國家後必須再繫結一次 dvEmployee.Rows[5].DataBind(); AddPagerIndex(); //Pager列 DetailsViewRow bottomPagerRow = dvEmployee.BottomPagerRow; //動態建立分頁按鈕 for (int i = 0; i < dvEmployee.PagerSettings.PageButtonCount; i++) { LinkButton PageNo = new LinkButton(); PageNo.Text = Convert.ToString(i + 1); PageNo.ID = (PageNo + i.ToString()); PageNo.CommandArgument = i.ToString(); PageNo.Click += new EventHandler(PageNo_Click); bottomPagerRow.Cells[0].Controls.Add(PageNo); Literal blank = new Literal(); blank.Text = " "; bottomPagerRow.Cells[0].Controls.Add(blank); } }
// same process as Bingham protected void dtv_lady_minto_DataBound(object sender, EventArgs e) { // This is a pager row. DetailsViewRow pagerRow = dtv_lady_minto.BottomPagerRow; // These labels display the current page number and the total number of pages. Label pageNum = (Label)pagerRow.Cells[0].FindControl("lbl_pageNumber"); Label totalNum = (Label)pagerRow.Cells[0].FindControl("lbl_totalPages"); if ((pageNum != null) && (totalNum != null)) { // Page number and total number of pages int page = dtv_lady_minto.DataItemIndex + 1; int count = dtv_lady_minto.DataItemCount; pageNum.Text = page.ToString(); totalNum.Text = count.ToString(); } }
/// <summary> /// Возвращает true, если контрол отображается. /// Проверяет родителей на видимость, обрабатывает вложенность в DetailsView. /// </summary> /// <param name="control"></param> /// <returns></returns> public static bool IsControlDisplayed(Control control) { if (!control.Visible || control.Parent == null) { return(control.Visible); } DetailsViewRow detailsViewRow = control as DetailsViewRow; if (detailsViewRow != null) { DetailsView detailsView = GetDetailsView(detailsViewRow); if (detailsView != null && !detailsView.Fields[detailsViewRow.RowIndex].Visible) { return(false); } } return(IsControlDisplayed(control.Parent)); }
private Control FindControlFromDetailsView(DetailsView dv, string ctrlName) { Control ctrl = null; for (int i = 0; i < dv.Rows.Count; i++) { DetailsViewRow dr = dv.Rows[i]; for (int j = 0; j < dr.Cells.Count; j++) { TableCell tc = dr.Cells[j]; for (int k = 0; k < tc.Controls.Count; k++) { if (tc.Controls[k].FindControl(ctrlName) != null) { return(tc.Controls[k].FindControl(ctrlName)); } } } } return(ctrl); }
// Methods public void CopyTo(DetailsViewRow[] array, int index) {}