Hi Jeronimo,
Thanks for your response.
For your question in the first response
===========
so regarding my first question, no control
variables are created on c# for controls I add to the template the same way
variables are created for controls that are added to the page?
===================
Yes, for sub controls nested in other container controls on the page, there
won't have direct control property in page class to access them. Only top
level controls has such member properties in page.
As for the showhide function, you can use the following code instead of
your original one:
=================================
function showhidetwo()
{
var div = document.getElementById("divTwo");
if(div.style.display != "none")
{
div.style.display = "none";
}else
{
div.style.display = "inline";
}
}
============================
the style.display can help hidden the html element and won't occupy the
space as well.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Subject: RE: .net 2.0 FormView questions
| From: Jeronimo Bertran <
[email protected]>
| References: <
[email protected]>
<PAo#
[email protected]>
| Organization: Your Company
| Message-ID: <
[email protected]>
| User-Agent: Xnews/??.01.30
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| Date: Thu, 20 Oct 2005 15:49:50 -0700
| NNTP-Posting-Host: c-069-063-192-218.sd2.redwire.net 69.63.192.218
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:5840
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| Steven,
|
| A couple of questions regarding hiding some controls based on the
| page....
|
| I basically added an html button to the headertemplate of the FormView:
|
| <HeaderTemplate>
| <input id="Button1" type="button" value="button"
| onclick="javascript:ShowHide()" />
| </HeaderTemplate>
|
| I then grouped a couple of the controls in the ItemTemplate inside a
| DIV:
|
|
| <div id="Div1">
| Field1:<asp:Label ID="Field1Label" runat="server" Text='<%# Bind
| ("Field1") %>'></asp:Label><br />
| Field2:<asp:Label ID="Field2Label" runat="server" Text='<%# Eval
| ("Field2") %>'></asp:Label><br />
| </div>
| <div id="Div2">
| Field3:<asp:Label ID="Field3Label" runat="server" Text='<%# Bind
| ("Field3") %>'></asp:Label><br />
| Field4:<asp:Label ID="Field4Label" runat="server" Text='<%# Eval
| ("Field4") %>'></asp:Label><br />
| </div>
|
|
| I then added the code to simply hide the div in order to see the
| results:
|
| function ShowHide()
| {
| var o = document.getElementById('Div1');
| if (o)
| {
| if (o.style.visibility == 'hidden')
| {
| o.style.visibility='visible';
| document.getElementById('Div2').style.visibility='hidden';
| }
| else
| {
| o.style.visibility='hidden';
| document.getElementById('Div2').style.visibility='visible';
| }
| }
|
| }
|
| This does hide the content inside DIV1 when I press the button and shows
| the contents of DIV2, but the space taken by each DIV remains blank
| after hiding and therefore it is like having an empty page before we get
| to the controls on the second DIV.
|
| I tried using an asp
anel instead of the div.... but I am unable to
| access the panel from my script.... I basically change the DIV1 tag to
| the following:
|
| <asp
anel ID="Div1" runat="server">
|
| but now getElementByID('Div1') return null.
|
| THanks again,
|
| Jeronimo
|
|
|
|
|
|