how to change ShowSelectButton in a gridview programmatically?

M

michel

Hi,

there is a gridview with a Commandfield.
I would like to set the 'ShowEditButton' on 'true' programmatically.
I tried two ways without succes:

with "'Dim cf As CommandField
with "'Dim cf As new CommandField"

no error but no ShowEditButton:

aspx file:
-------
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:CommandField />
.........
</Columns>
</asp:GridView>


code-behind:
-------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
'Dim cf As CommandField
Dim cf As new CommandField
cf = GridView1.Columns.Item(0)
cf.ShowEditButton = True

....
 
G

Guest

Good morning Michael,

Everytime you change grid's view apperance, you have to rebind the data to
see the effect:

cf = GridView1.Columns.Item(0)
cf.ShowEditButton = True
GridView1.DataSource = dataSource
GridView1.DataBind()
 
M

michel

Thanks Miloz

Milosz Skalecki said:
Good morning Michael,

Everytime you change grid's view apperance, you have to rebind the data to
see the effect:

cf = GridView1.Columns.Item(0)
cf.ShowEditButton = True
GridView1.DataSource = dataSource
GridView1.DataBind()
 

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,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top