Hi everybody,
I am desperate now... I MUST understand something...
I have a grid with some data Bind to a DataTable. Here is my ItemDataBound Event (column4 is the GridBoundColumn's UniqueName):
Where I want you to look is the last part "
Now let's see my JS function:
So you can see that the only things this is doing is showing the value of the textbox after clicking on Update. This work fine! Example: If the current value is "toto" and I change it to "tata" and press Update, it will show "tata".
After that, it fire the update event and enter in the UpdateCommand event. So here is my code:
The thing I CAN'T understand is why txtbx.Text is equal to "toto" instead of "tata" ?
I'm on that since 2 days ago and now I don't know what to do to get the new value...
I hope someone will be able to tell me why this is happening.
I am desperate now... I MUST understand something...
I have a grid with some data Bind to a DataTable. Here is my ItemDataBound Event (column4 is the GridBoundColumn's UniqueName):
Protected
Sub
gridAllergies_ItemDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridItemEventArgs)
Handles
gridAllergies.ItemDataBound
If
(
TypeOf
e.Item
Is
GridEditableItem
AndAlso
CType
(e.Item, GridEditableItem).IsInEditMode)
Then
Dim
editedItem
As
GridEditableItem =
CType
(e.Item, GridEditableItem)
Dim
allergie
As
clsAllergie =
CType
(
CType
(e.Item.DataItem, DataRowView).Row, clsAllergie)
Dim
editor
As
GridDropDownListColumnEditor =
CType
(editedItem.EditManager.GetColumnEditor(
"column7"
), GridDropDownListColumnEditor)
editor.DataSource = ExecuteSql(
"Select '' as gral_numero ,'' as gral_description union all Select gral_numero, gral_description "
& _
" from phfgrall where pram_sequence = "
+ GetStr(GSite_phfgrall) +
" order by gral_description"
).Tables(0).DefaultView
editor.DataBind()
Dim
txtbx
As
TextBox =
CType
(editedItem(
"column4"
).Controls(0), TextBox)
If
Not
allergie.NoGroupe =
""
Then
editor.SelectedValue = allergie.NomGroupe
End
If
Dim
update
As
LinkButton =
CType
(editedItem.FindControl(
"UpdateButton"
), LinkButton)
If
(update IsNot
Nothing
)
Then
update.Attributes.Add(
"onclick"
,
"return Validate('"
+ txtbx.ClientID +
"')"
)
End
If
End
If
End
Sub
Where I want you to look is the last part "
update.Attributes.Add(
"onclick"
,
"return Validate('"
+ txtbx.ClientID +
"')"
)
"Now let's see my JS function:
function
Validate(txt)
{
var
txtbx = document.getElementById(txt)
alert(txtbx.value);
return
true
}
So you can see that the only things this is doing is showing the value of the textbox after clicking on Update. This work fine! Example: If the current value is "toto" and I change it to "tata" and press Update, it will show "tata".
After that, it fire the update event and enter in the UpdateCommand event. So here is my code:
Protected
Sub
gridAllergies_UpdateCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
gridAllergies.UpdateCommand
Dim
editItem
As
GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim
txtbx
As
TextBox =
CType
(editItem(
"column4"
).Controls(0), TextBox)
Debug.WriteLine(txtbx.Text)
End
Sub
The thing I CAN'T understand is why txtbx.Text is equal to "toto" instead of "tata" ?
I'm on that since 2 days ago and now I don't know what to do to get the new value...
I hope someone will be able to tell me why this is happening.