private Dictionary <string, object> ExtractValuesFromEditForm(ASPxGridView grid)
    {
        Dictionary <string, object> pairs = new Dictionary <string, object>();

        // EmployeeID
        pairs.Add("EmployeeID", null);
        string employeeIDStr = ((ASPxLabel)grid.FindEditFormTemplateControl("lblEmployeeID")).Text;

        if (!string.IsNullOrEmpty(employeeIDStr))
        {
            pairs["EmployeeID"] = Int32.Parse(employeeIDStr);
        }
        // PageControl
        ASPxPageControl pageControl = (ASPxPageControl)grid.FindEditFormTemplateControl("pgcEditForm");
        /// First page
        TabPage firstPage = pageControl.TabPages[0];

        pairs.Add("FirstName", ((ASPxTextBox)firstPage.FindControl("tbFirstName")).Text);
        pairs.Add("LastName", ((ASPxTextBox)firstPage.FindControl("tbLastName")).Text);
        pairs.Add("BirthDate", ((ASPxDateEdit)firstPage.FindControl("deBirthDate")).Date);
        /// Second page
        TabPage secondPage = pageControl.TabPages[1];

        pairs.Add("City", ((ASPxTextBox)secondPage.FindControl("tbCity")).Text);
        pairs.Add("Country", ((ASPxTextBox)secondPage.FindControl("tbCountry")).Text);
        /// Third page
        pairs.Add("Notes", ((ASPxMemo)pageControl.TabPages[2].FindControl("txtNotes")).Text);
        /// Fourth page
        TabPage fourthPage = pageControl.TabPages[3];

        pairs.Add("OccupationID", ((ASPxComboBox)fourthPage.FindControl("cbOccupation")).Value);
        pairs.Add("Subscriber", ((ASPxCheckBox)fourthPage.FindControl("chbSubscriber")).Checked);

        return(pairs);
    }
Beispiel #2
0
    void SetSupplierLabel(DataRowView supplierRecord, TabPage tabPage, string labelId, string fieldName)
    {
        Label label = tabPage.FindControl(labelId) as Label;

        if (label != null)
        {
            label.Text = Convert.ToString(supplierRecord[fieldName]);
        }
    }