Make Footer invisible

T

tshad

I am using the footer of my Datalist to add a row into my database.

Is there a way to make the footer invisible when not adding a row, making it
visible when a button is pushed and making it invisible again when the page
is posted (after the row is added)?

I have a footer such as:

<FooterTemplate>
<SeparatorTemplate>
<hr style="margin:0">
</SeparatorTemplate>
<asp:textbox id="newQuestion" runat="server" />
<SeparatorTemplate>
<hr style="margin:0">
</SeparatorTemplate>
</FooterTemplate>

Thanks,

Tom
 
D

Daniel Fisher\(lennybacon\)

solution 1) ITemplate's (as FooterTemplate) can be set by code...

solution 2) define a variable set it when the button is clicked and use:

<FooterTemplate>
<asp:panel visible='<%=myVar%>'>
<asp:textbox id="newQuestion" runat="server" />
</asp:panel>
</FooterTemplate>
 
T

tshad

Daniel Fisher(lennybacon) said:
solution 1) ITemplate's (as FooterTemplate) can be set by code...

solution 2) define a variable set it when the button is clicked and use:

<FooterTemplate>
<asp:panel visible='<%=myVar%>'>
<asp:textbox id="newQuestion" runat="server" />
</asp:panel>
</FooterTemplate>

I tried that and it seems to work, but I can't seem to change it
programmably.

My FooterTemplate looks like so:

<FooterTemplate>
<SeparatorTemplate>
<hr style="margin:0">
</SeparatorTemplate>
<asp:panel id="newQuestionPanel" visible="false" runat="server">
<asp:textbox id="newQuestion" runat="server" />
<SeparatorTemplate>
<hr style="margin:0">
</SeparatorTemplate>
</asp:panel>
<asp:Button ID="CollapseAll" text="Collapse All" runat="server"
onClick="collapseAll_click" AlternateText="Click here to see
details"></asp:Button>&nbsp;&nbsp;
<asp:Button ID="ExpandAll" text="Expand All" runat="server"
onClick="expandAll_click" AlternateText="Click here to see
details"></asp:Button>
<asp:Button ID="AddQuestion" text="Add Question" runat="server"
onClick="AddQuestion_click" AlternateText="Click here to see
details"></asp:Button>
</FooterTemplate>

The code the AddQuestion calls is:

sub AddQuestion_click(sender as Object, e as EventArgs)
newQuestionPanel.visible = "true"
end sub

But when I run this I get:
************************************************************
Compiler Error Message: BC30451: Name 'newQuestionPanel' is not declared.

Source Error:

Line 305:
Line 306: sub AddQuestion_click(sender as Object, e as EventArgs)
Line 307: newQuestionPanel.visible = "true"
Line 308: end sub
***************************************************************

Why is not declared? It is declared in the FooterTemplate section, isn't
it?

Thanks,

Tom.
 
V

Vikesh Arora

Can't we use the ShowFooter property of the datagrid control the visiblity
of the control

Regards
Vikesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top