Dear Telerik Team
I have a RadGrid with GridTemplateColumn that have a RadNumericTextBox as an ItemTemplate.
The user has the ability to change the values on the RadNumericTextBox.
On Save button click, I Foreach the RadGrid to save the updated values to Database.
The Question is:
How to check if the value of the RadNumericTextBox is changed or not at server side using C# ?
Thanks
I have a RadGrid with GridTemplateColumn that have a RadNumericTextBox as an ItemTemplate.
The user has the ability to change the values on the RadNumericTextBox.
On Save button click, I Foreach the RadGrid to save the updated values to Database.
The Question is:
How to check if the value of the RadNumericTextBox is changed or not at server side using C# ?
Thanks
6 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 21 May 2012, 12:16 PM
Hello Noha,
Try the following code.
C#:
Thanks,
Princy.
Try the following code.
C#:
protected
void
Button2_Click(
object
sender, EventArgs e)
l{
foreach
(GridDataItem item
in
RadGrid1.MasterTableView.Items)
{
RadNumericTextBox txt = (RadNumericTextBox)item.FindControl(
"RadNumericTextBox3"
);
string
value = txt.Text;
}
}
Thanks,
Princy.
0
0
Princy
Top achievements
Rank 2
answered on 22 May 2012, 05:27 AM
Hello Noha,
You can attach TextChanged event as shown below.
aspx:
C#:
Thanks,
Princy.
You can attach TextChanged event as shown below.
aspx:
<
telerik:RadNumericTextBox
ID
=
"RadNumericTextBox3"
runat
=
"server"
AutoPostBack
=
"true"
ontextchanged
=
"RadNumericTextBox3_TextChanged"
></
telerik:RadNumericTextBox
>
protected
void
RadNumericTextBox3_TextChanged(
object
sender, EventArgs e)
{
RadNumericTextBox txt = (RadNumericTextBox)sender;
string
v = txt.Value.ToString();
}
Thanks,
Princy.
0
Noha
Top achievements
Rank 1
answered on 22 May 2012, 09:02 AM
@Princy
Thank you so much princy :)
by that way I can access the value changed at client side, that's ok.
But, Finally at Save button clicked at post back to server side, How I check if this textbox is changed or not !! that's my QUESTION.
anyway I got a silly solution, at the textchanged event fires at client side i'll set its empty message to lets say "U" means Updated
and at server side I'll check the empty message of the current textbox at the RadGrid.
What do you think of that solution ?
Thank you so much princy :)
by that way I can access the value changed at client side, that's ok.
But, Finally at Save button clicked at post back to server side, How I check if this textbox is changed or not !! that's my QUESTION.
anyway I got a silly solution, at the textchanged event fires at client side i'll set its empty message to lets say "U" means Updated
and at server side I'll check the empty message of the current textbox at the RadGrid.
What do you think of that solution ?
0
Accepted
Hello Noha,
Your solution will work, but please note that the Princy's one is actually for server side. RadNumericTextBox3_TextChanged is C# function written in the code behind.
Regards,
Vasil
the Telerik team
Your solution will work, but please note that the Princy's one is actually for server side. RadNumericTextBox3_TextChanged is C# function written in the code behind.
Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Noha
Top achievements
Rank 1
answered on 22 May 2012, 01:19 PM
Thank you Vasil, yes you're right.