This is a migrated thread and some comments may be shown as answers.

CommandItemTemplate display after postback

2 Answers 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric Skaggs
Top achievements
Rank 2
Eric Skaggs asked on 04 Feb 2009, 05:40 PM
I have a page with a grid and that grid uses the commanditemtemplate.  When the page first loads, it's in a "New" mode that I use in my code to hide the commanditemtemplate.  Essentially, the page loads and since the mode is "New," runs this code in the PreRender method of RadGrid1:

RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; 

That part works fine.  However, I have a Save button above the grid (not part of the grid) that, when clicked, sets the mode to "Edit" and causes a page postback.  Now that the mode is "Edit," the PreRender method of RadGrid1 runs this code:

RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Bottom; 

This is the part that's not working.  After the first page postback, a blue "footer" appears at the bottom of the grid that says "Ready," but I get no commanditemtemplate.  My CommandItemTemplate only contains a Button control aligned on the right side of the grid.  Interestingly enough, if I click the Save button again to cause a second page postback, I do get my commanditemtemplate along with the blue "footer" that says "Ready."

Any ideas?

Thank you,

Eric Skaggs

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 05 Feb 2009, 06:47 AM
Hello Eric,

Try rebinding the grid in the after hiding or displaying the CommandItemTemplate as shown below:

cs:
RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Bottom; 
RadGrid1.MasterTableView.Rebind();     

Thanks
Princy.
0
Eric Skaggs
Top achievements
Rank 2
answered on 05 Feb 2009, 03:33 PM
That did it, thank you.  I forgot that a change to the grid structure requires a call to rebind for that change to take effect.
Tags
Grid
Asked by
Eric Skaggs
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Eric Skaggs
Top achievements
Rank 2
Share this question
or