I have a master page attached to a webform .
I have 2 UserControl in the webform
When i click on the submit button the controls are dissappearing.
How can we make the usercontrol visible always.
Page_Init is the better place to dynamically add Controls because it is highly probable that it will persists values after post-back if you add dynamic controls at Page_Init.
Microsoft also recommends it.
Life is a computer program and everyone is the programmer of his own life.
Only HTML Elements with the word input really post back to the server. All others don't, it's a waste of time and bandwidth.
So a textbox and a dropdown box use the input element, which is programmable to act like a textbox, dropdownlist, radio button, checkbox and so forth.
Make a asp.net textbox object, and set the CSS display: none
Were using the CSS style because I'm skeptical of the visible attribute.
Let the textbox show until you prove it works, then use the display.
Off the top of my head;
<asp:textbox id="txt_geolocation" runat="server" clientIDmode="static" style=display: none;">
If you don't make the asp.net object, the textbox will most likely give you trouble posting back it's value.
document.getElementById('txt_geolocation').value('stuff you geolocation info in here');
I put the textbox outside the multiew control. I am really not sure what difference that makes.
Multiview control is used to pass values from one page to another. It gives the appearance that you are going from page to another.
For instance, in my case, I would like users to fill a form on on view, then when they click Next, all the values they entered previously are displayed in another view.
This gives them the opportunity to review what information they entered and certify that they are correct. If they are not, the users can return to previous "page" to make addditional changes. If they are correct, then they submit.
So, I tried putting the textbox inside one view, nothing happens. The box is blank.
I tried putting it outside the view.