muthu
muthu

Reputation: 87

loading value to asp.net control using javascript

iam into problem of reading the value of the control which i alterd using javascript the sequence goes like this i got the text box control by using its id cleared the value of the text box make the control disabled.

when i tried to retrive the value of the textbox in aspx.cs iam still getting the old value of the text box which i actualy cleared in the javascript

kindly suggest me to over come this issue

Thanks

Upvotes: 1

Views: 133

Answers (2)

AUSteve
AUSteve

Reputation: 3258

Disabled input controls don't get their values posted back so ASP.Net doesn't know you changed the value. You need to enable the control.

Upvotes: 1

stepanian
stepanian

Reputation: 11433

With ASP.NET Web Forms, IDs for elements get assigned automatically by the Page on the server side. It is tricky, but possible, to manipulate element values using javascript. One way to avoid this would be to use ASP.NET MVC where the HTML would be rendered as is and javascript or jquery can be easily used to "play" with the HTML elements. We need more information to help you with the details of your request.

Upvotes: 0

Related Questions