Mainly serves as my backup reference on programming & technology. Plus some random thoughts
- HOME
- PROGRAMMING
- TECHNOLOGIES
- GENERAL
- ABOUT ME
Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts
Hiding/Showing Div In Page Depending On Search Type
2011-04-16
Think about a scenario like this You have a master section like Country & an assosciated detailed section of the master such as States of the country you selected.
If you selected a country & then a button on it's click it should display the State & related details. And also From the States details you can view the Master.
Only 1 at a time after selection.
You can do it by displaying/hiding the Div tag of Master& Details section at the window load event of the HTML. So Make a javascript function & call this by registering to the Page by using
Page.RegisterClientScriptBlock("OnLoadEvent", codeJavaScript);
Code Behind
---------------
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace MinimizeMaximizeTab { public partial class HTMLTips : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnShowDetails_Click(object sender, EventArgs e) { string codeJavaScript = "<script language=javascript>"; codeJavaScript += "window.onload = DisplayMaster;"; codeJavaScript += "function DisplayMaster()"; codeJavaScript += "{"; codeJavaScript += "document.getElementById('MasterDiv').style.visibility = 'hidden';"; codeJavaScript += "document.getElementById('DetailsDiv').style.visibility = 'visible';"; codeJavaScript += "}"; codeJavaScript += "</script>"; Page.RegisterClientScriptBlock("OnLoadEvent", codeJavaScript); } protected void btnShowMaster_Click(object sender, EventArgs e) { string codeJavaScript = "<script language=javascript>"; codeJavaScript += "window.onload = DisplayMaster;"; codeJavaScript += "function DisplayMaster()"; codeJavaScript += "{"; codeJavaScript += "document.getElementById('MasterDiv').style.visibility = 'visible';"; codeJavaScript += "document.getElementById('DetailsDiv').style.visibility = 'hidden';"; codeJavaScript += "}"; codeJavaScript += "</script>"; Page.RegisterClientScriptBlock("OnLoadEvent", codeJavaScript); } } }
Works in following
How to display HTML tags in Blogger
2010-07-05
There are some bloggers who may want to post HTML tags in comments or posts but don't know how. If you try to type the HTML tag to display an image, for example:
<img src="photo URL" />
< to be replaced with ampersandsymbolPLUSlt;
> to be replaced with ampersandsymbolPLUSgt;
PLUS- not meant any symbol or word here, just added for readability
Subscribe to:
Posts (Atom)