I used Javascript on the client to update an ASP Textbox control which was rendered as an HTML textbox.
When I tried to access the value in the textbox control on the server, I wasn't too surprised that the Textbox's updated value was not accessible through the normal Text property of the TextBox server control, since the state of that value, I assume was probably saved off in the ViewState and the Server was unaware that Client script had changed it.
Is the best way to get the updated value using something like:
Request.Form(TextBox.UniqueID)?
I suspect that because the textbox is populated within a row of a GridView control and the row was added at run time when doing a DataBind, that I may be getting different results than if the TextBox were drawn on the control at Design time.
I confirmed that the value placed into the textbox by the client is accessible via this:
Request.Form( CType(Row.Cells.Item(4).FindControl("txtTotal"), TextBox).UniqueID)
but not accessible via this:
CType(Row.Cells.Item(4).FindControl("txtTotal"), TextBox).Text
the latter returning an empty string.
I think these two lines tell the whole story.
It seems ugly to have two properties to get the value of the textbox and even uglier when you consider that they return different results.
Is there a better way or is this just client side development in all its glory?
I'm always surprised when people say that web development now days is as easy as client (eg winform) apps now that ASP.NET keeps track of state. To me, web development is always more complex and costly, but I admittedly am not that skilled in web dev.