Help with GridView and an button column

G

Guest

Hi,
I added a buttom column to my gridview. When a certain condition is met I
want to set the visible to True. I did the following but it is not working.

The button column in the page
<asp:ButtonField ButtonType="Image" CommandName="DeleteRow" Visible="false"
">
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" Width="10px" />
</asp:ButtonField>

At the GrrdView RowDataBound Event

Dim _button As ImageButton

If condition Then

_button = e.Row.Cells(1).Controls(0)
_button.Visible = True

End If

Any ideas?
 
G

Guest

Hi,
I have one suggestion.Initially add placeholder control(instead of
ImageButtron and making its visible property false) and let its visible
property be true.

At the GrrdView RowDataBound Event

Dim _button As ImageButton

If condition Then
//First cast it placeholder control and then add imagebuttton to
placeholder
((placeholder)e.Row.Cells(1).Controls(0)).Add.Controls(_button)

End If
Altough i have written pseduo code,you can give it try with little
modification.
Hope this helps you out.

Thanks and Regards,
Manish Bafna.
MCP and MCTS.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top