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

reference a GridBoundColumn

2 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Minh
Top achievements
Rank 1
Minh asked on 22 Aug 2011, 05:07 PM
Hi,

I'm having problem finding the correct syntax to reference a GridBoundColumn in the aspx. the following is my syntax.

this is the aspx code 

<telerik:GridBoundColumn FilterControlAltText="Filter Equipmentcolumn column"  

HeaderText="Equipment" UniqueName="Equipmentcolumn" DataField="_Equipment">  

 

</telerik:GridBoundColumn>

 


this is the c# code 

GridDataInsertItem insertedItem = (GridDataInsertItem)e.Item;

GridBoundColumn

 

 

Equipment = insertedItem.FindControl("Equipmentcolumn") as GridBoundColumn;

the error is
Error 322 Cannot convert type 'System.Web.UI.Control' to 'Telerik.Web.UI.GridBoundColumn' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion C:\Development\GHG-MCA\GHG-MCA\ChevronPortEquip.aspx.cs 300 45 GHG-MCA

thanks,
Minh Bui

 

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Aug 2011, 06:37 PM
Hello,

GridDataInsertItem insertedItem = (GridDataInsertItem)e.Item;
 
TextBox txtEquipment = insertedItem["Equipmentcolumn"].Controls[0] as TextBox;       
String strEquipment = txtEquipment.Text; // Your Text

Let me know if any concern.

Thanks,
Jayesh Goyani
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Aug 2011, 06:42 PM
Hello,

if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                //first reference the edited grid item
                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager editMan = editedItem.EditManager;
 
                //reference the column editor which holds the second dropdown list instance in the edit form
                GridTextColumnEditor editor = editMan.GetColumnEditor("Equipmentcolumn") as GridTextColumnEditor;


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Minh
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or