User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 402,036 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,448 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 2829 | Replies: 2
Reply
Join Date: Mar 2007
Posts: 4
Reputation: ariesL is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ariesL ariesL is offline Offline
Newbie Poster

Question get HTML table property on page load event

  #1  
Aug 24th, 2007
hi everyone,

is there a way to get the HTML Table property on page_load event, here is my current situation

on page_load i have my HTML table display property set to 'none'
on runtime i can have its display property set to ' ', thus showing the HTML table with its content, however when I click some ASP buttons and have some postback it resets the display property to 'none'

thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 58
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: get HTML table property on page load event

  #2  
Aug 24th, 2007
Need to see your code to be certain how to help.

Me I'd add an id and runat="server" attribute to the table to make it a server side System.Web.UI.HtmlControls.HtmlTable control and use the tabeid.visible = true/false property to turn it on and off server side.
Last edited by hollystyles : Aug 24th, 2007 at 4:30 pm.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote  
Join Date: Mar 2007
Posts: 4
Reputation: ariesL is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ariesL ariesL is offline Offline
Newbie Poster

Re: get HTML table property on page load event

  #3  
Aug 24th, 2007
dear HollyStyles,

in my JS file -- HotIssuesJScript.js

function checkBoxClick(checkBoxID,tableID) {
var myCBox=document.getElementById(checkBoxID);
var myTable=document.getElementById(tableID);
if (myCBox.checked == true) {
 
myTable.style.display='';
}
else {
myTable.style.display='none';
}
alert(myTable.style.display);
}

in my ASPX file
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<scriptlanguage=javascriptsrc=HotIssueJScript.js></script>
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title>
 
</head>
<body>
<form id="form1" runat="server">
<div>
<table id="table1" style="width: 337px; display: none;">
<tr>
<td style="width: 138px">
Secret Message</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td style="width: 138px; height: 21px;">
</td>
<td style="height: 21px">
</td>
<td style="height: 21px">
</td>
</tr>
<tr>
<td style="width: 138px; height: 21px">
</td>
<td style="height: 21px">
</td>
<td style="height: 21px">
</td>
</tr>
</table>
<table style="width: 337px; display: none;" id="table2">
<tr>
<td style="width: 138px">
Secret Message2</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td id="Table2" style="width: 138px">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td style="width: 138px; height: 21px">
</td>
<td style="height: 21px">
</td>
<td style="height: 21px">
</td>
</tr>
</table>
<br />
 
</div>
<br />
<asp:CheckBox ID="CheckBox1" runat="server" Text="Tick to Show Message1" />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<asp:CheckBox ID="CheckBox2" runat="server" Text="Tick To Show Message2" /><br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</body>
</html>

in my aspx.vb file
PartialClass Default2
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim tmpValue As String
tmpValue = "return checkBoxClick('CheckBox1','table1');"
CheckBox1.Attributes.Add("onClick", tmpValue)
tmpValue = "return checkBoxClick('CheckBox2','table2');"
CheckBox2.Attributes.Add("onClick", tmpValue)
End Sub
EndClass

thanks
Last edited by ariesL : Aug 24th, 2007 at 7:32 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 10:53 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC