Click here to Skip to main content
15,880,608 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: When and where does a UserControl compile? Pin
Brady Kelly6-Apr-09 5:25
Brady Kelly6-Apr-09 5:25 
GeneralRe: When and where does a UserControl compile? Pin
Paddy Boyd6-Apr-09 5:29
Paddy Boyd6-Apr-09 5:29 
GeneralHide/Show Div when selecting radio button Pin
M. K. BASHER6-Apr-09 2:15
M. K. BASHER6-Apr-09 2:15 
GeneralRe: Hide/Show Div when selecting radio button Pin
Dev S6-Apr-09 2:23
Dev S6-Apr-09 2:23 
GeneralRe: Hide/Show Div when selecting radio button Pin
M. K. BASHER6-Apr-09 2:28
M. K. BASHER6-Apr-09 2:28 
GeneralRe: Hide/Show Div when selecting radio button Pin
Alok Sharma ji6-Apr-09 2:31
Alok Sharma ji6-Apr-09 2:31 
GeneralRe: Hide/Show Div when selecting radio button Pin
Dev S6-Apr-09 2:38
Dev S6-Apr-09 2:38 
AnswerRe: Hide/Show Div when selecting radio button [modified] Pin
PauloCastilho6-Apr-09 6:36
PauloCastilho6-Apr-09 6:36 
You can do it just using JavaScript. Download jQuery 1.3.2[^] and test the code below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<html><br />
<head><br />
	<title>DIV show / hide example</title><br />
	<script type="text/javascript" src="jquery-1.3.2.min.js"></script><br />
	<script type="text/javascript"><br />
		$(document).ready(function() {<br />
			$('#box_dv div').each(function() {<br />
				$(this).hide();<br />
			});<br />
			$('#box_rdo input:radio').each(function() {<br />
				$(this).click(function() {<br />
					$('#box_dv div').hide();<br />
					$('#' + $(this).attr('value')).show();<br />
				});<br />
			})<br />
		});<br />
	</script><br />
</head><br />
<body><br />
<div><br />
	<div id="box_rdo"><br />
	<input type="radio" id="r1" name="rdo" value="d1" /><label for="r1">DIV 1</label><br />
	<input type="radio" id="r2" name="rdo" value="d2" /><label for="r2">DIV 2</label><br />
	</div><br />
	<br /><br />
	<div id="box_dv"><br />
		<div id="d1"><br />
			<h1>DIV 1</h1><br />
			This is the DIV 1 content!<br />
		</div><br />
<br />
		<div id="d2"><br />
			<h1>DIV 2</h1><br />
			This is the DIV 2 content!<br />
		</div><br />
	</div><br />
</div><br />
</body><br />
</html>


If you gonna use asp.net server controls, instead of <input type="radio"> and <div> use <asp:RadioButtonList> and <asp:Panel>... Handle the OnSelectedIndexChanged event of the radio button list to manipulate the visibility of the asp:panel's (div's).

modified on Monday, April 6, 2009 12:47 PM

GeneralRe: Hide/Show Div when selecting radio button Pin
Hajab6-Apr-09 19:58
Hajab6-Apr-09 19:58 
AnswerRe: Hide/Show Div when selecting radio button Pin
vivek_r7-Apr-09 0:12
vivek_r7-Apr-09 0:12 
QuestionAsp.net support Webdav Protocol? Pin
balu123456-Apr-09 2:11
balu123456-Apr-09 2:11 
AnswerRe: Asp.net support Webdav Protocol? Pin
SeMartens6-Apr-09 2:30
SeMartens6-Apr-09 2:30 
QuestionDate Conversion Problem Pin
specialdreamsin6-Apr-09 1:34
specialdreamsin6-Apr-09 1:34 
AnswerRe: Date Conversion Problem Pin
Dev S6-Apr-09 1:49
Dev S6-Apr-09 1:49 
GeneralRe: Date Conversion Problem Pin
specialdreamsin6-Apr-09 2:01
specialdreamsin6-Apr-09 2:01 
GeneralRe: Date Conversion Problem Pin
Dev S6-Apr-09 2:07
Dev S6-Apr-09 2:07 
AnswerRe: Date Conversion Problem Pin
Hajab6-Apr-09 20:06
Hajab6-Apr-09 20:06 
Questionusing a borland C++ dll in ASP.NET project Pin
Sunuaj6-Apr-09 1:33
Sunuaj6-Apr-09 1:33 
AnswerRe: using a borland C++ dll in ASP.NET project Pin
SeMartens6-Apr-09 2:31
SeMartens6-Apr-09 2:31 
GeneralRe: using a borland C++ dll in ASP.NET project Pin
Sunuaj6-Apr-09 2:49
Sunuaj6-Apr-09 2:49 
AnswerRe: using a borland C++ dll in ASP.NET project Pin
Alok Sharma ji6-Apr-09 2:35
Alok Sharma ji6-Apr-09 2:35 
GeneralRe: using a borland C++ dll in ASP.NET project Pin
Sunuaj6-Apr-09 2:55
Sunuaj6-Apr-09 2:55 
AnswerRe: using a borland C++ dll in ASP.NET project Pin
Alok Sharma ji6-Apr-09 2:45
Alok Sharma ji6-Apr-09 2:45 
GeneralRe: using a borland C++ dll in ASP.NET project Pin
Sunuaj6-Apr-09 2:48
Sunuaj6-Apr-09 2:48 
Question[Message Deleted] Pin
abc_fm6-Apr-09 1:29
abc_fm6-Apr-09 1:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.