By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,180 Members | 1,051 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,180 IT Pros & Developers. It's quick & easy.

Dynamically show/hide gridview footer?

P: n/a
Well, I am trying to use the footer row of a GridView for insertion
purpose. There are some articles about this, for example, the has an example, which always displays the footer row.

I would like to display the footer row, only when a LinkButton "Add
New" is clicked. And after the new record is saved to the database,
let the footer row disappear.

In the LinkButton's click event handler, I simply say:

protected myLinkButton_Click(object s, EventArgs e)
myGridView.ShowFooter = true;

I would attempt to make the footer disappear in the GridView's
rowcommand handler, but let's forget about this for now.

It seems to work, but somehow, the "Add New" button has to be clicked
twice for the footer to show up. This is the first problem. Note that
I am not using Ajax.

Another problem is that the footer refuses to show up no matter how
hard I click on myLinkButton if I place this GridView in a View
control of a MultiView. The GridView itself isn't dynamically
created, although I *do* dynmically set the ShowFooter property of the

Right now, I also let the GridView always display the footer, but only
show/hide the controls inside the footer. (I have template field in
the footer). This works fine, but there is a blank footer row at the
bottom. I think it's sorta nicer to only display the footer row when
"Add New" is clicked.

Not sure if I made the situation clear. If yes, anyone has an idea
why ?

Oct 23 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.