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

How to refer to controls in a PopUp Edit Form?

1 Answer 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Newbery
Top achievements
Rank 1
Steve Newbery asked on 16 Nov 2008, 06:01 PM
I have a RadGrid with template colums and  edit mode PopUp. So I can refer to text boxes like so:

    Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)  
        '-----------------------------------------------------------------------  
        ' If inserting, set the default competitor number, ie SiteNr + a seq nr  
        '-----------------------------------------------------------------------  
        If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then  
            If e.Item.OwnerTableView.IsItemInserted Then  
                Dim item As GridEditableItem = TryCast(e.Item, GridEditableItem)  
                  
                 ' Find the CompNr textbox  
                Dim CompNrRadTextBox As RadTextBox = TryCast(item("CompNr").FindControl("CompNrTextBox"), RadTextBox)  
 
 

Works fine, but when I use a form template (ie FormTemplate in EditFormSettings), that code no longer works, and the control isn't found any more.

Can anyone tell me how I should adapt the code?

Thanks, Steve

1 Answer, 1 is accepted

Sort by
0
Steve Newbery
Top achievements
Rank 1
answered on 16 Nov 2008, 10:14 PM
D'oh ok I figured it out, I just have to put:

Dim CompNrRadTextBox As RadTextBox = TryCast(item.FindControl("CompNrTextBox"), RadTextBox) 


 

Instead of

Dim CompNrRadTextBox As RadTextBox = TryCast(item("CompNr").FindControl("CompNrTextBox"), RadTextBox) 



Tags
Grid
Asked by
Steve Newbery
Top achievements
Rank 1
Answers by
Steve Newbery
Top achievements
Rank 1
Share this question
or