PC Review


Reply
Thread Tools Rate Thread

how to change ShowSelectButton in a gridview programmatically?

 
 
michel
Guest
Posts: n/a
 
      17th Feb 2007
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

....



 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
Posts: n/a
 
      18th Feb 2007
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()

--
Milosz


"michel" wrote:

> 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
>
> ....
>
>
>
>

 
Reply With Quote
 
michel
Guest
Posts: n/a
 
      18th Feb 2007
Thanks Miloz

"Milosz Skalecki [MCAD]" <(E-Mail Removed)> schreef in bericht
news:3875B340-E1C6-4E6A-8ED3-(E-Mail Removed)...
> 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()
>
> --
> Milosz
>
>
> "michel" wrote:
>
>> 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
>>
>> ....
>>
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to change a GridView image file path programmatically... trint Microsoft ASP .NET 4 19th Apr 2007 06:23 PM
how to change ShowSelectButton in a gridview programmatically? michel Microsoft ASP .NET 2 18th Feb 2007 03:02 PM
Gridview, TemplateField Programmatically. cook.jonathan.m@gmail.com Microsoft ASP .NET 0 5th Feb 2007 01:52 PM
Using GridView programmatically Mike P Microsoft C# .NET 0 30th May 2006 02:52 PM
Add GridView Row Programmatically Chris Microsoft ASP .NET 0 20th Apr 2006 08:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:59 AM.