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

Empty control values in InsertCommand event.

1 Answer 23 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brady
Top achievements
Rank 1
Brady asked on 11 Mar 2009, 07:46 PM
I'm using a telerik RadGrid, with a UserControl edit form. When the InsertCommand event fires, I get the user control, and find edit controls on it, but there Text properties are all string.Empty. I suspect this has something to do with ViewState, but I don't know where to begin looking.
protected void jobGrid_InsertCommand(object source, GridCommandEventArgs e) 
    var editControl = e.Item.FindControl(GridEditFormItem.EditFormUserControlID) as JobEditControl; 
    SqlJobProvider.InsertJob(GetFieldValues(editControl)); 
 
private Dictionary<stringobject> GetFieldValues(UserControl editControl) 
    string tb = (editControl.FindControl("aspText"as TextBox).Text; 
 

Here tb == "", even when in the browser it contains a value.



1 Answer, 1 is accepted

Sort by
0
Brady
Top achievements
Rank 1
answered on 11 Mar 2009, 09:22 PM
I solved this one with some aid from someone on StackOverflow.  I just needed to only bind in the DataSourceNeeded, where I was binding on every page load.
Tags
Grid
Asked by
Brady
Top achievements
Rank 1
Answers by
Brady
Top achievements
Rank 1
Share this question
or