Home All Groups Group Topic Archive Search About

Disabling Link Button Column in Datagrid

Author
25 Nov 2005 3:11 AM
pradeep_TP
Hello world,



I have a simple datagrid on asp.net web form , in which I am showing a
single button column called EDIT. The code in the .aspx files for the same is
as below.

    <asp:ButtonColumn HeaderText="" ButtonType="LinkButton" Text="Edit"
CommandName="EditRec">
<ItemStyle Font-Bold="false" VerticalAlign="Top"
HorizontalAlign="left"    Width="30" Height="35"></ItemStyle>
    </asp:ButtonColumn>

Currently, I am displaying this Edit link button for every record in the
datagrid. I want to know how can i selectively disable EDIT link button for
few records based on what value is in any single datagrid column. I need to
disable it through the code and NOT when the user does anything on the screen.

(I am using ASP.NET 1.1)

Any ideas

thanks all
pradeep_TP

Author
25 Nov 2005 4:33 AM
Patrick.O.Ige
Try doing it in the ItemDataBound
Patrick

Show quoteHide quote
"pradeep_TP" <pradee***@discussions.microsoft.com> wrote in message
news:FE17609C-1F62-4CBE-A6C1-323B0DA86B0B@microsoft.com...
> Hello world,
>
>
>
> I have a simple datagrid on asp.net web form , in which I am showing a
> single button column called EDIT. The code in the .aspx files for the same
is
> as below.
>
> <asp:ButtonColumn HeaderText="" ButtonType="LinkButton" Text="Edit"
> CommandName="EditRec">
> <ItemStyle Font-Bold="false" VerticalAlign="Top"
> HorizontalAlign="left" Width="30" Height="35"></ItemStyle>
> </asp:ButtonColumn>
>
> Currently, I am displaying this Edit link button for every record in the
> datagrid. I want to know how can i selectively disable EDIT link button
for
> few records based on what value is in any single datagrid column. I need
to
> disable it through the code and NOT when the user does anything on the
screen.
>
> (I am using ASP.NET 1.1)
>
> Any ideas
>
> thanks all
> pradeep_TP
Are all your drivers up to date? click for free checkup

Author
25 Nov 2005 6:18 AM
pradeep_TP
thank you patrick. I have solved the problem myself :). Following is what I did

1) Added a template column and inside it i added a linkButton server control.
2) The enabled property of the link button was set as below

    <asp:LinkButton id="LinkButton1" Enabled =
'<%#Convert.ToInt16(DataBinder.Eval(Container.DataItem,"employeeid"))==1?Convert.ToBoolean("True"):Convert.ToBoolean("False")%>' runat="server">

cheers!
pradeep

Show quoteHide quote
"Patrick.O.Ige" wrote:

> Try doing it in the ItemDataBound
> Patrick
>
> "pradeep_TP" <pradee***@discussions.microsoft.com> wrote in message
> news:FE17609C-1F62-4CBE-A6C1-323B0DA86B0B@microsoft.com...
> > Hello world,
> >
> >
> >
> > I have a simple datagrid on asp.net web form , in which I am showing a
> > single button column called EDIT. The code in the .aspx files for the same
> is
> > as below.
> >
> > <asp:ButtonColumn HeaderText="" ButtonType="LinkButton" Text="Edit"
> > CommandName="EditRec">
> > <ItemStyle Font-Bold="false" VerticalAlign="Top"
> > HorizontalAlign="left" Width="30" Height="35"></ItemStyle>
> > </asp:ButtonColumn>
> >
> > Currently, I am displaying this Edit link button for every record in the
> > datagrid. I want to know how can i selectively disable EDIT link button
> for
> > few records based on what value is in any single datagrid column. I need
> to
> > disable it through the code and NOT when the user does anything on the
> screen.
> >
> > (I am using ASP.NET 1.1)
> >
> > Any ideas
> >
> > thanks all
> > pradeep_TP
>
>
>

Bookmark and Share