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

Access EditFormInsertItem from ObjectDataSource_Inserting command

2 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jfkrueger
Top achievements
Rank 1
jfkrueger asked on 02 Sep 2010, 12:09 AM
I think the subject says it all...

I need to access the EditFormInsertItem from within the ObjectDataSource_Inserting command:

Private Sub ObjectDataSourceRenewal_Inserting(ByVal sender As Object, ByVal e As ObjectDataSourceMethodEventArgs) Handles ObjectDataSourceRenewal.Inserting
  
    Dim lEditFormInsertItem As GridEditFormInsertItem = ???
  
    Dim lRadTextBoxGroupNumber As RadTextBox = lEditFormInsertItem.FindControl("RadTextBoxGroupNumber")
    Dim lRadDatePickerRenewalBegin As RadDatePicker = lEditFormInsertItem.FindControl("RadDatePickerRenewalBegin")
    Dim lRadDatePickerRenewalEnd As RadDatePicker = lEditFormInsertItem.FindControl("RadDatePickerRenewalEnd")
    Dim lRadComboBoxRenewalAccountManager As RadComboBox = lEditFormInsertItem.FindControl("RadComboBoxRenewalAccountManager")
    Dim lCheckBoxSuppressInGrid As CheckBox = lEditFormInsertItem.FindControl("CheckBoxSuppressInGrid")
  
    e.InputParameters("CaseNumber") = lRadTextBoxGroupNumber.Text.Trim 
    e.InputParameters("RenewalBegin") = lRadDatePickerRenewalBegin.SelectedDate 
    e.InputParameters("RenewalEnd") = lRadDatePickerRenewalEnd.SelectedDate  
    e.InputParameters("RenewalAM") = lRadComboBoxRenewalAccountManager.SelectedValue 
    e.InputParameters("SuppressAMInRenewal") = lCheckBoxSuppressInGrid.Checked 
  
End Sub

I'm sure it's easy, i just can't guess or find the syntax. Finding the editforminsertitem was no problem on the ObjectDataSource_Updating command.

Thanks!

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Sep 2010, 07:35 AM
Hello Joe,

You can try the following method to access the GridEditFormInsertItem.

VB.Net:
Protected Sub ObjectDataSourceRenewal_Inserting(sender As Object, e As SqlDataSourceCommandEventArgs)
    Dim lEditFormInsertItem As GridEditFormInsertItem = DirectCast(RadGrid1.MasterTableView.GetInsertItem(), GridEditFormInsertItem)
    Dim txt As TextBox = DirectCast(insertItem.FindControl("RadTextBoxGroupNumber"), TextBox)
End Sub

Thanks,
Princy.
0
jfkrueger
Top achievements
Rank 1
answered on 05 Oct 2010, 09:10 PM
Worked like a charm! Thank you!
Tags
Grid
Asked by
jfkrueger
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
jfkrueger
Top achievements
Rank 1
Share this question
or