ASP.NET – Control Lifecyle

asp.net

I have an ASP.NET page where I am dynamically building LinkButton and TextBox elements. These elements are being built during the OnInit event of the page. The user can then perform an action that changes the values of these elements. The values of these elements are changed via JavaScript. When the user clicks a button, a server-side event is fired. This event parses the value in each control. I have noticed that the value for the TextBox is correct, but the value for the LinkButton is not.

Can only certain types of controls in ASP.NET be dynamically generated and have their values retrieved on the server side?

Thank you.

Best Answer

You can't get value of link button at server side. You can only get form elements' values at server side.

If you want to pass more values to server side, you can use hidden input elements.