0

I have a GridView with a few TemplateField (label), and I have some control that will change the text of the label (with jquery), all works fine except the new value is available while checking in the post back like following, I keep getting the original values of the cell, what else do I have to update to make backend aware of the DOM change (via jquery)? thanks

foreach (GridViewRow row in gv.Rows)
{
    decimal value= decimal.Parse(((Label)row.FindControl("LabelID")).Text);
}
John
  • 2,107
  • 3
  • 22
  • 39
  • Labels are just `Spans` at the end of the day. Your best bet would be to use a `HiddenField` and a Label together. – Hugo Yates Mar 16 '15 at 17:06
  • Perhaps http://stackoverflow.com/questions/26538330/textbox-in-gridview-not-holding-its-value-on-postback and http://stackoverflow.com/questions/7428762/two-way-databinding-in-asp-net may be of use. Also, the problem can be with `Label` elements themselves - it is probable that asp.net does not consider `Label` to be something that can be changed on client side and thus doesn't send (or modify) its `ViewState` related data. And your code in the last question used `Eval` that does not mean two-way binding for sure. – Eugene Podskal Mar 16 '15 at 20:03
  • It is a good idea to provide [Minimal Complete Verifiable Example](http://stackoverflow.com/help/mcve). It greatly improves the appeal the question has and can greatly simplify problem solving (or at least describe the setup in a much more detailed way). – Eugene Podskal Mar 16 '15 at 20:10

0 Answers0