Disabling Link Button Column in Datagrid

G

Guest

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
 
G

Guest

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
 

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,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top