I have a grid which uses the pop-up inline insert and edit form. In it a have a dropdown list that updates a text box in the form after a selection from it. The problem I have is that I have no alternative to the GetInsertItem method on the grid object. I have researched for alternatives but so far all examples leads to either the UpdatedCommand or ItemCreated or ItemCommand events, which don't apply to my case. Here's my code.
So as you can see, there is no problem on insert mode. Incredibly, the problem is that I have no method for Edit mode to replicate what I'm doing on insert mode. How can I reference the text box control within the edit form when in edit mode.
Thanks
Private
Sub
RGExpenses_ItemCreated(sender
As
Object
, e
As
GridItemEventArgs)
Handles
RGExpenses.ItemCreated
If
(
TypeOf
e.Item
Is
GridEditableItem
AndAlso
e.Item.IsInEditMode)
Then
Dim
list
As
DropDownList =
CType
(
CType
(e.Item, GridEditableItem
​Description").Controls(0), DropDownList)
list.AutoPostBack =
True
AddHandler
list.SelectedIndexChanged,
AddressOf
list_SelectedIndexChanged
SetAmount(list)
End
If
End
Sub
Private
Sub
list_SelectedIndexChanged(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
'sets Item amount when change selected value
SetAmount(
CType
(sender, DropDownList))
End
Sub
Private
Sub
SetAmount(
ByVal
ddl
As
DropDownList)
If
Not
IsNothing(ddl.SelectedItem)
Then
Dim
decPAmount
As
Decimal
= cDB.dbConsult(Application(
"db"
), "SELECT TOP 1 Amount FROM Table1)
If
RGExpenses.MasterTableView.IsItemInserted
Then
CType
(RGExpenses.MasterTableView.GetInsertItem.FindControl(
"TB_Amount"
), TextBox).Text = decPAmount
Else
'here is where I need to find the control, but no method to do so
CType
(RGExpenses.MasterTableView.FindControl(
"TB_Amount"
), TextBox).Text = decPAmount
End
If
End
If
End
Sub
So as you can see, there is no problem on insert mode. Incredibly, the problem is that I have no method for Edit mode to replicate what I'm doing on insert mode. How can I reference the text box control within the edit form when in edit mode.
Thanks