|
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
|
|
|
|
|
The sample javascript is below.
function showdiv()
{
//To hide div
document.getElementById("DIV").style.display='none';
//To show div
document.getElementById("DIV").style.display='block';
}
....
....
....
....
.....
Use this in your code as per your requirement and this should definitely help you out.
|
|
|
|
|
Make both the divs runat='server' and assign them some ID
and write your code according to that.
e.g. on Page_Load if u want to both the divs invisible then :
div1.Visible= false;
div2.Visible= false;
Similarly you can write code according to the radio button selection.
Happy Coding,
Vivek Rathore
|
|
|
|
|
Hi,
Please help me with your ideas for the following
1.Does .net support for WEBDAV protocol?
2.Can I implement .net remoting using WEBDAV protocol?
Right now I implemented .net remoting using TCP/IP protocol.It is working fine.I need to change this to support the WEBDAV protocol.
Please help me.
|
|
|
|
|
Don't crosspost. See the answers in the C# forum...
|
|
|
|
|
Hi,
Public MasterDispDt As String
Public Sub ExFunction()
MasterDispDt = DtlsDs.Tables("DtlsTab").Rows(r).Item("DispDate").ToString
End Sub
TxtDispDate is a Textbox, Calender Selected value assigned to it.
Dim TDate As Date = CDate(Trim(txtDespDate.Text))
Dim MDate As Date = CDate(Trim(MasterDispDt))
If TDate < MDate Then
'Some Code
Endif
TxtDispDate I selected as '28-04-2009'
The above Code giving Error :
Error : Conversion from string "28-04-2009" to type 'Date' is not valid.
Pl. Help me out
Ramesh Sambari
|
|
|
|
|
this problem can be beacuase of date format.
try other formats like "MM/dd/yyyy" and apply break and check the result.
|
|
|
|
|
Hi,
When I run from Source Code, there is no problem. it is working fine. Even i run without debugging, that time also its fine. When I publish it to a folder and open , then the problem is coming.
Ramesh Sambari
|
|
|
|
|
While u r converting it to date format just specify the format like it is shortdate string or whatever u like, to all date controls and variable.
|
|
|
|
|
To convert a string to date, the date format should be MM/DD/YYYY OR MM/DD/YY.
The date "28-04-2009" is in the format dd-mm-yyyy.
This is the reason for the error.
Convert the string to correct format and your will get the result.
|
|
|
|
|
I used p/invoke but i need to add the reference of the dll in the project which is not possible the normal way i.e through Add reference in the solution explorer.
But wen i manually copy-paste it into the website cache(run->%windir%\Microsoft.Net\Framework or C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\Temporary ASP.NET Files), it works.
I want to avoid this manual copy-paste and want to map this dll into the project.
How do i do it?
Thanks in advance
|
|
|
|
|
Add the dll with "Add Existing item"-command within VS IDE. This will put the file to your ASP project.
|
|
|
|
|
i tried that too but the dll was not detected till i copy-pasted it in the temp asp folder iv mentioned earlier
|
|
|
|
|
If its used to give a tool reference to your project,why shouldnt you try browsing of dll by this:
1.go to toolbox,
2.right click on any of them,as suited to you,
3.click the choose items button which is used to inherits the com object,
4.browse the dll,
5.ok its done u can use it directly from toolbox now.
|
|
|
|
|
what you said will work only if the dll is a Microsoft.NET dll wont work in my case where it is a borland C++ dll
|
|
|
|
|
And one thing dont ask a question again n again
|
|
|
|
|
sorry abt that but wanted the Q to be answered asap..
|
|
|
|
|
|
if you explain more we can help more
|
|
|
|
|
How can I LogOut when browser is closed?
Best Regards...
|
|
|
|
|
dataminers wrote: How can I LogOut when browser is closed?
what kind of logout are you performing ? Do want to close the session when browser is closed ? or you are maintain user logs in the database and you want to remove if user close the browser?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
I want to Application.Remove(..USER_ID..) and Session.Remove()
|
|
|
|
|
I want to Application.Remove(..USER_ID..) and Session.Remove()
Do you have any idea ???
|
|
|
|
|
When browser is closed the session get expired by itself.
|
|
|
|
|
My login method like this;
--------------------------
MyGlobalVariableClass gVars = new MyGlobalVariableClass();
gVars.UserID = txtUsername.Text;
gVars.IPaddress = Request.UserHostAddress;
gVars.HostName = System.Net.Dns.GetHostByAddress(Request.UserHostAddress).HostName;
Application.Add(gVars.UserID, gVars.IPaddress + "|" + gVars.HostName);
Session.Add("gVars", gVars);
Session["Authenticated"] = "true";
I CHECK USER BEFORE LOGIN WITH "isAlreadyLogged" FUNCTION
----------------------------------------------------------
protected bool isAlreadyLogged(ref MyGlobalVariableClass gv)
{
if (Application[gv.UserID] == null)
return false; // not logged yet
if (Application[gv.UserID].ToString() == (gv.IPaddress + "|" + gv.HostName))
return false; // already logged but from the same place
return true; // already logged from different place
}
My logout method like this;
---------------------------
MyGlobalVariableClass gv = (MyGlobalVariableClass)Session["gVars"];
Application.Remove(((MyGlobalVariableClass)Session["gVars"]).UserID);
Session.Remove("gVars");
|
|
|
|