This is a migrated thread and some comments may be shown as answers.

How do you extract values indidivually from edit form

1 Answer 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andre Vovan
Top achievements
Rank 1
Andre Vovan asked on 26 Jul 2008, 12:51 AM
the 2 examples provided does not extract individual textbox property from edit form.  I've built my entire grid through code behind.  But I can not extract the new value thats being changed in the edit mode.

        protected void CreateGrids(RadPageView PageView)  
        {  
            Control Control = new Control();  
            RadGrid temp = new RadGrid();  
            temp.ID = "RadGrid_" + PageView.ID;  
            temp.Skin = "Hay";  
            temp.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;  
            temp.AutoGenerateColumns = false;  
            temp.Width = 500;  
            //temp.ItemDataBound += RadGrid1_ItemDataBound;  
              
            temp.AllowAutomaticInserts = false;  
            temp.AllowAutomaticUpdates = false;  
            temp.AllowAutomaticDeletes = false;  
            temp.InsertCommand += new GridCommandEventHandler(RadGrid_Insert);  
            temp.UpdateCommand += new GridCommandEventHandler(RadGrid_Update);  
            temp.DeleteCommand += new GridCommandEventHandler(RadGrid_Delete);  
            //temp.ItemCommand +=new GridCommandEventHandler(RadGrid_Commands);  
            temp.EnableViewState = false;  
            temp.MasterTableView.EditMode = GridEditMode.EditForms;  
            if (PageView.ID == "Address")  
            {  
                //temp.NeedDataSource += new GridNeedDataSourceEventHandler(this.tem temp_NeedDataSource);                 
 
                GridEditCommandColumn EditColumn = new GridEditCommandColumn();  
                temp.MasterTableView.Columns.Add(EditColumn);  
 
                GridBoundColumn AddressColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(AddressColumn);  
                AddressColumn.DataField = "Address";  
                AddressColumn.HeaderText = "Address";  
                AddressColumn.UniqueName = "Address";  
 
 
                GridBoundColumn AddressColumn2 = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(AddressColumn2);  
                AddressColumn2.DataField = "Address2";  
                AddressColumn2.HeaderText = "Address2";  
                AddressColumn2.UniqueName = "Address2";  
 
                GridBoundColumn CityColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(CityColumn);  
                CityColumn.DataField = "City";  
                CityColumn.HeaderText = "City";  
                CityColumn.UniqueName = "City";  
 
                GridBoundColumn StateColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(StateColumn);  
                StateColumn.DataField = "StateOrRegion";  
                StateColumn.HeaderText = "State";  
                StateColumn.UniqueName = "State";  
 
                GridBoundColumn ZipColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(ZipColumn);  
                ZipColumn.DataField = "PostalCode";  
                ZipColumn.HeaderText = "Zip Code";  
                ZipColumn.UniqueName = "PostalCode";  
 
                GridButtonColumn DeleteColumn = new GridButtonColumn();  
                temp.MasterTableView.Columns.Add(DeleteColumn);  
                DeleteColumn.CommandName = "Delete";  
                DeleteColumn.Text = "Delete";  
                DeleteColumn.ButtonType = GridButtonColumnType.ImageButton;  
 
                  
 
 
                temp.DataSource = SynergieEMR.GetAddress(new Guid("992740df-ebac-4409-854a-0a16637c8b00"));  
 
            }  
            else if (PageView.ID == "Phone")  
            {  
                GridBoundColumn TypeColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(TypeColumn);  
                TypeColumn.DataField = "Type";  
                TypeColumn.HeaderText = "Type";  
                TypeColumn.UniqueName = "Type";  
 
 
                GridBoundColumn ContactNumberColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(ContactNumberColumn);  
                ContactNumberColumn.DataField = "ContactNumber";  
                ContactNumberColumn.HeaderText = "Contact Number";  
                ContactNumberColumn.UniqueName = "ContactNumber";  
 
                GridBoundColumn NotesColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(NotesColumn);  
                NotesColumn.DataField = "SpecialInstructions";  
                NotesColumn.HeaderText = "Notes";  
                NotesColumn.UniqueName = "Notes";  
 
                GridButtonColumn DeleteColumn = new GridButtonColumn();  
                DeleteColumn.CommandName = "Delete";  
                DeleteColumn.Text = "Delete";  
                DeleteColumn.ButtonType = GridButtonColumnType.ImageButton;  
                temp.MasterTableView.Columns.Add(DeleteColumn);  
 
                temp.DataSource = SynergieEMR.GetTeleCommunications(new Guid("992740df-ebac-4409-854a-0a16637c8b00"));  
            }  
            else if (PageView.ID == "Email")  
            {  
                GridBoundColumn TypeColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(TypeColumn);  
                TypeColumn.DataField = "Type";  
                TypeColumn.HeaderText = "Type";  
                TypeColumn.UniqueName = "Type";  
 
 
                GridBoundColumn ContactNumberColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(ContactNumberColumn);  
                ContactNumberColumn.DataField = "ContactAddress";  
                ContactNumberColumn.HeaderText = "Email Address";  
                ContactNumberColumn.UniqueName = "ContactAddress";  
 
                GridBoundColumn NotesColumn = new GridBoundColumn();  
                temp.MasterTableView.Columns.Add(NotesColumn);  
                NotesColumn.DataField = "SpecialInstructions";  
                NotesColumn.HeaderText = "Notes";  
                NotesColumn.UniqueName = "Notes";  
 
                GridButtonColumn DeleteColumn = new GridButtonColumn();  
                DeleteColumn.CommandName = "Delete";  
                DeleteColumn.Text = "Delete";  
                DeleteColumn.ButtonType = GridButtonColumnType.ImageButton;  
                temp.MasterTableView.Columns.Add(DeleteColumn);  
 
                temp.DataSource = SynergieEMR.GetECommunication(new Guid("992740df-ebac-4409-854a-0a16637c8b00"));  
            }  
            //temp.DataBind();  
 
            Control.Controls.Add(temp);  
 
            PageView.Controls.Add(Control);  
        } 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Jul 2008, 04:27 AM
Hi Peter,

Try accessing the new value from the edit form in  the UpdateCommand event as shown below.

CS:
 protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) 
    { 
        GridEditableItem edititem = (GridEditableItem)e.Item; 
        TextBox txtbx = (TextBox)edititem["City"].Controls[0]; 
        string strtxt = txtbx.Text; 
    } 


Thanks
Shinu.
Tags
Grid
Asked by
Andre Vovan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or