470,562 Members | 2,442 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,562 developers. It's quick & easy.

Dynamically show/hide gridview footer?

Well, I am trying to use the footer row of a GridView for insertion
purpose. There are some articles about this, for example, the
gridviewguy.com 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
GridView.

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
0 2450

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by tfsmag | last post: by
4 posts views Thread by sydney.luu | last post: by
9 posts views Thread by Chris | last post: by
reply views Thread by Reinhard | last post: by
10 posts views Thread by gnewsgroup | last post: by
4 posts views Thread by Craig Buchanan | last post: by
7 posts views Thread by =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.