Hello,
I am trying to prevent the user from using
negative values in two columns in my radgrid. I think that it might be easier for us to make a check in code behind.
We have made a method in code behind which should
get the value/values of the cells that has been edited by the user(only two
columns). And for some reason that method returns the old value, look below.
Example;
An order has a total price of 500 euro. If I change
this to 450 euro and push save changes then our method should print out 450
euro.. but it doesn’t. It prints out the first value of 500 euro which
frustrates me.
This method Is called using “onitemupdated” in the
radgrid
SubCheckFields(sender AsObject, e As Telerik.Web.UI.GridUpdatedEventArgs)
Dim item
As
GridDataItem =TryCast(e.Item, GridDataItem)
Dim
itemValue AsString= item("Quantity").Text
MsgBox(itemValue)
EndSub
I want to make a check in our method to see if the
value is negative or not.. if negative it shouldn’t save anything and just show
a message to the user.. if the edited value is positive
It should save the changes.
So basically we need;
When the save changes is pressed it should;
1. Call the method in the code-behind.
2. Check if some of the values in the two colums are negative.
3. If negative – Abort/error message
4. If positive – Save changes
Furthermore it shouldn’t use the aspx
Updatecommand (since we use the code behind), how do we turn off this?
Also, is there an easier way to do this?
Code: code
Kind Regards
I am trying to prevent the user from using
negative values in two columns in my radgrid. I think that it might be easier for us to make a check in code behind.
We have made a method in code behind which should
get the value/values of the cells that has been edited by the user(only two
columns). And for some reason that method returns the old value, look below.
Example;
An order has a total price of 500 euro. If I change
this to 450 euro and push save changes then our method should print out 450
euro.. but it doesn’t. It prints out the first value of 500 euro which
frustrates me.
This method Is called using “onitemupdated” in the
radgrid
SubCheckFields(sender AsObject, e As Telerik.Web.UI.GridUpdatedEventArgs)
Dim item
As
GridDataItem =TryCast(e.Item, GridDataItem)
Dim
itemValue AsString= item("Quantity").Text
MsgBox(itemValue)
EndSub
I want to make a check in our method to see if the
value is negative or not.. if negative it shouldn’t save anything and just show
a message to the user.. if the edited value is positive
It should save the changes.
So basically we need;
When the save changes is pressed it should;
1. Call the method in the code-behind.
2. Check if some of the values in the two colums are negative.
3. If negative – Abort/error message
4. If positive – Save changes
Furthermore it shouldn’t use the aspx
Updatecommand (since we use the code behind), how do we turn off this?
Also, is there an easier way to do this?
Code: code
Kind Regards