How can I add and remove an Html element dynamically using javascript?
Below is the javascript code which is used to add and remove div elements dynamically.Here the div tags are added in one base div tag container. <script> function AddHtmlElement() { var divElement = document.getElementById(’MYDIV’); var divNumber= document.getElementById(’hiddenValue’); var num = (document.getElementById(’hiddenValue’).value -1)+ 2; divNumber.value = num; var newdiv = document.createElement(’div’); var divIdName = ’MYDIV’+num; newdiv.setAttribute(’id’,divIdName); var divLoadedText=’Div ’+num+’ Is Added!’; divElement.appendChild(newdiv); newdiv.innerHTML =divLoadedText+’ ‘+'<a href=’#’ onclick=RemoveHtmlElement(’’+divIdName+’’)>Remove div ’’+divIdName+’’</a>’; } functionRemoveHtmlElement(divNum) { var divId = document.getElementById(’MYDIV’); var childId = document.getElementById(divNum); divId.removeChild(childId); } </script> <form id=’Form1′ > <input id=’hiddenValue’ type=’hidden’ value=’0′> <p> <a href=’#’ onclick=’AddHtmlElement()’>Add Html Elements</a> </p> <div id=’MYDIV’></div> </form>
When I open my new window using Javascript, all elements appear great, but the original window just displays [Object] why?
Check out How to open a new window with multiple parameters using datagrid?
Can I store my session state in a database other than tempdb, In SqlServer mode?
Yes. For more details Refer HOW TO: Configure ASP.NET for Persistent SQL Server Session State Management
What kind of objects can I store in a Session State
Depends on which mode you are using: InProc Mode- objects stored in session state are actually live objects, and so you can store whatever object you have created. State Server or SQL Server mode, objects in the session state will be serialized and deserialized when a request is processed. So make sure your objects are serializable and their classes must be marked as so. If not, the session state will not be saved successfully. In v1, there is a bug which makes the problem happen unnoticed in SQLServer mode and will make your request hang. The hanging problem is fixed in v1.1. The fix for KB 324479: ASP.NET SQL Server Session State Impersonation Is Lost Under Load also contains the fix for this problem. The problem will be fixed in v1 SP3 too. For more info: BUG: Session Data Is Not Saved in Out-of-Process Session State
How can I avoid specifying a plain password for my sql connection
Include a sql trusted connection, or put the connection string as encrypted data in the registry. Refer FIX: Stronger Credentials for processModel, identity, and sessionState How To Use the ASP.NET Utility to Encrypt Credentials and Session State Connection Strings